From 4f68f5ece4d8e6bb04cf33ed037d3599ae990bcd Mon Sep 17 00:00:00 2001 From: Hyojin Ahn Date: Tue, 17 Mar 2026 12:14:03 -0400 Subject: [PATCH] Preparing Server Transfer 001 --- public_html/assets/dbCon.php | 66 ++++----- public_html/config/config_db.php | 52 +++---- public_html/index_intranet.20240507.php | 146 -------------------- public_html/login_intranet.20231017.php | 172 ------------------------ 4 files changed, 40 insertions(+), 396 deletions(-) delete mode 100644 public_html/index_intranet.20240507.php delete mode 100644 public_html/login_intranet.20231017.php diff --git a/public_html/assets/dbCon.php b/public_html/assets/dbCon.php index bb1662b..3a6d442 100644 --- a/public_html/assets/dbCon.php +++ b/public_html/assets/dbCon.php @@ -2,51 +2,35 @@ 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"; - } +$host = getenv('DB_HOST') ?: 'mis-mysql'; +$user = getenv('DB_USER') ?: 'goiintra_root'; +$pw = getenv('DB_PASSWORD') ?: ''; +$dbName = getenv('DB_NAME') ?: 'goiintra_db'; +mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); +try { $conn = new mysqli($host, $user, $pw, $dbName); + $conn->set_charset('utf8'); +} catch (mysqli_sql_exception $e) { + error_log($e->getMessage()); + exit('[DB Error. Please contact administrator.]'); +} - mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); +function qry($qry){ + global $conn; + return mysqli_query($conn, $qry); +} - /* DB 연결 확인 */ - if(!$conn){ die( 'Could not connect: ' . mysqli_error($conn) ); } +function fetch_array($qryResult) { + return mysqli_fetch_array($qryResult, MYSQLI_ASSOC); +} - mysqli_query($conn, "set names utf8"); +function db_insert_id() { + global $conn; + return mysqli_insert_id($conn); +} - 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); - } -?> +function db_num_rows($db_query) { + return mysqli_num_rows($db_query); +} \ No newline at end of file diff --git a/public_html/config/config_db.php b/public_html/config/config_db.php index 137de7c..1b98730 100644 --- a/public_html/config/config_db.php +++ b/public_html/config/config_db.php @@ -1,40 +1,18 @@ exec("set names utf8"); - - -?> \ No newline at end of file +try { + $pdo = new PDO( + "mysql:host={$DB_HOST};dbname={$DB_NAME};charset=utf8", + $DB_USER, + $DB_PASSWORD, + [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION] + ); +} catch (PDOException $e) { + error_log($e->getMessage()); + exit('[DB Error. Please contact administrator.]'); +} \ No newline at end of file diff --git a/public_html/index_intranet.20240507.php b/public_html/index_intranet.20240507.php deleted file mode 100644 index 057dd43..0000000 --- a/public_html/index_intranet.20240507.php +++ /dev/null @@ -1,146 +0,0 @@ - alertBack($msg); - session_destroy(); - $func -> modalMsg ($msg, "/login_intranet.php"); - exit; - } - else { - include getenv("DOCUMENT_ROOT")."/doc/".$view.".php"; // Main - } -} -else include getenv("DOCUMENT_ROOT")."/doc/customer_list.php"; - - -// Start of footer -include getenv("DOCUMENT_ROOT")."/include/footer.php"; - -?> - -fQuery($query, "fetched query error"); - - if($result['UID'] == "") { - $columns[] = "CNT_DATE"; - $columns[] = "CNT_NUMBER"; - - $values[] = $today; - $values[] = 1; - $jdb->iQuery("tbl_counter", $columns, $values); - } - else { - $nowNo = $result['CNT_NUMBER']+1; - //echo "BEFORE[$result[CNT_NUMBER]]"; - $query = " update tbl_counter set CNT_NUMBER = '$nowNo' where UID = '".$result['UID']."' "; - $jdb->nQuery($query, "query error"); - } - - // IP - $user_ip = $_SERVER["REMOTE_ADDR"]; - $referer = $_SERVER["HTTP_REFERER"]; - $user_agent = $_SERVER["HTTP_USER_AGENT"]; - - if ($refurl == "") { - if (!$referer) $referer="Typing or Bookmark Moving On This Site"; - } - - - $rt_geo = json_decode(file_get_contents("http://ip-api.com/json/{$user_ip}")); - //print_r ($rt_geo); - //echo "{$rt_geo->country},{$rt_geo->city}";//CA,Rogers Communications Canada Inc. - - - $columns = array(); - $values = array(); - - unset($columns); - unset($values); - - $columns[] = "CNT_DATE"; - $columns[] = "CNT_IP"; - $columns[] = "CNT_REFERER"; - $columns[] = "CNT_USERAGENT"; - - $columns[] = "CNT_INFO_AS"; - $columns[] = "CNT_INFO_CITY"; - $columns[] = "CNT_INFO_COUNTRY"; - $columns[] = "CNT_INFO_COUNTRYCODE"; - $columns[] = "CNT_INFO_ISP"; - $columns[] = "CNT_INFO_LAT"; - $columns[] = "CNT_INFO_LON"; - $columns[] = "CNT_INFO_ORG"; - $columns[] = "CNT_INFO_REGION"; - $columns[] = "CNT_INFO_REGIONNAME"; - $columns[] = "CNT_INFO_STATUS"; - $columns[] = "CNT_INFO_TIMEZONE"; - $columns[] = "CNT_INFO_ZIP"; - - - $values[] = $todayDetail; - $values[] = $user_ip; - $values[] = $referer; - $values[] = $user_agent; - - $values[] = $rt_geo->as; - $values[] = $rt_geo->city; - $values[] = $rt_geo->country; - $values[] = $rt_geo->countryCode; - $values[] = $rt_geo->isp; - $values[] = $rt_geo->lat; - $values[] = $rt_geo->lon; - $values[] = $rt_geo->org; - $values[] = $rt_geo->region; - $values[] = $rt_geo->regionName; - $values[] = $rt_geo->status; - $values[] = $rt_geo->timezone; - $values[] = $rt_geo->zip; - - - $jdb->iQuery("tbl_count_details", $columns, $values); - - setcookie("LOGCHECK", "1", time()+3600); // 1h - //$_SESSION['ss_LOGCHECK'] = "1"; // ǿ Ѵ. - -} - -//setcookie("LOGCHECK", "1", time()-3600); // expire cookie - -?> diff --git a/public_html/login_intranet.20231017.php b/public_html/login_intranet.20231017.php deleted file mode 100644 index aa779e4..0000000 --- a/public_html/login_intranet.20231017.php +++ /dev/null @@ -1,172 +0,0 @@ - modalMsg ($msg, "/index_intranet.php"); - exit; -} - -?> - - - - - - - - - - GOI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-

WE RECYCLE YOUR

-

USED COOKING OIL

-

- AND TRANSFORM IT INTO VALUABLE FEEDSTOCK
- TO RENEWABLE ENERGY -

-
-
-
-
- -
- -
-
- -
-

Welcome to Green Oil Inc.

-

INTRANET SYSTEM

-
- - - -
- -
- - -
-
- - -
- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - \ No newline at end of file