53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
date_default_timezone_set('America/Toronto');
|
|
|
|
if ($_SERVER["REMOTE_ADDR"] == "127.0.0.1" || $_SERVER["REMOTE_ADDR"] == "::1" || str_contains($_SERVER["HTTP_HOST"], "localhost")) {
|
|
// $host = "localhost";
|
|
$host = "192.168.2.166";
|
|
$user = "goiintra_root";
|
|
$pw = "L0C2CKN5GHHY";
|
|
$dbName = "goiintra_db";
|
|
} else if ($_SERVER['HTTP_HOST'] == "goi.ifreshy.com") {
|
|
$host = "localhost";
|
|
$user = "ifreshy_goi";
|
|
$pw = "L0C2CKN5GHHY";
|
|
$dbName = "ifreshy_goi";
|
|
|
|
}
|
|
else if ($_SERVER['HTTP_HOST'] == "www.goiintranet.com"|| $_SERVER['HTTP_HOST'] == "goiintranet.com") {
|
|
$host = "localhost";
|
|
$user = "goiintra_root";
|
|
$pw = "L0C2CKN5GHHY";
|
|
$dbName = "goiintra_db";
|
|
}
|
|
|
|
|
|
$conn = new mysqli($host, $user, $pw, $dbName);
|
|
|
|
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
|
|
|
/* DB 연결 확인 */
|
|
if(!$conn){ die( 'Could not connect: ' . mysqli_error($conn) ); }
|
|
|
|
mysqli_query($conn, "set names utf8");
|
|
|
|
function qry($qry){
|
|
global $conn;
|
|
return mysqli_query($conn, $qry);
|
|
}
|
|
|
|
function fetch_array($qryResult) {
|
|
return mysqli_fetch_array($qryResult, MYSQLI_ASSOC);
|
|
}
|
|
|
|
function db_insert_id() {
|
|
global $conn;
|
|
return mysqli_insert_id($conn);
|
|
}
|
|
|
|
function db_num_rows($db_query) {
|
|
return mysqli_num_rows($db_query);
|
|
}
|
|
?>
|