0byt3m1n1
Path:
/
var
/
www
/
listcrawler.app
/
public_html
/
[
Home
]
File: db.php
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); $servername = "localhost"; $database = "listcrawler_db"; $username = "usrprodating"; $password = "usr9rod@t1ng"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } mysqli_query( $conn, "SET NAMES 'utf8mb4'" ); mysqli_query( $conn, "SET CHARACTER_SET 'utf8mb4'" ); $site_title = "ListCrawler"; function get_location_id($location_name) { global $conn; $chkRec = "SELECT id FROM `locations` WHERE LOWER(REPLACE(`location_name`, ' ', '_')) = '" . $location_name . "' LIMIT 1" ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row['id']; } return false; } function get_location_name($location_id) { global $conn; $chkRec = "SELECT `location_name` FROM `locations` WHERE `id` = $location_id LIMIT 1 " ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row['location_name']; } return false; } function get_region_id($location_id) { global $conn; $chkRec = "SELECT `region_id` FROM `locations` WHERE `id` = $location_id LIMIT 1 " ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row['region_id']; } return false; } function get_subarea_name($subarea_id) { global $conn; $chkRec = "SELECT `subarea_name` FROM `subareas` WHERE `id` = $subarea_id LIMIT 1 " ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row['subarea_name']; } return false; } function get_photo_count($list_id) { global $conn; $chkRec = "SELECT `id` FROM `photos` WHERE `list_id` = $list_id " ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); return $count; } function get_ip_address() { $ip = getenv('HTTP_CLIENT_IP')?: getenv('HTTP_X_FORWARDED_FOR')?: getenv('HTTP_X_FORWARDED')?: getenv('HTTP_FORWARDED_FOR')?: getenv('HTTP_FORWARDED')?: getenv('REMOTE_ADDR'); return $ip; } function get_mobile_number($mobile_id) { global $conn; $chkRec = "SELECT `mobile_number` FROM `contacts` WHERE `id` = $mobile_id LIMIT 1 " ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row['mobile_number']; } return false; } function get_link_url($link_slug) { global $conn; $chkRec = "SELECT `ad_url` FROM `links` WHERE `ad_slug` = '" . $link_slug . "' LIMIT 1" ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row['ad_url']; } return false; } function get_link($field) { global $conn; $chkRec = "SELECT $field FROM `links` WHERE id=1 LIMIT 1" ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row[$field]; } return false; } function get_seo($field) { global $conn; $chkRec = "SELECT $field FROM `seo` WHERE `id` = 1 LIMIT 1" ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return $row[$field]; } return false; } function get_location_info($field, $location_id) { global $conn; $chkRec = "SELECT $field FROM `location_info` WHERE `id` = $location_id LIMIT 1" ; $chkResult = mysqli_query($conn, $chkRec); $count = mysqli_num_rows($chkResult); if ($count > 0) { $row = mysqli_fetch_assoc($chkResult); return trim($row[$field]); } return false; } $page_title = "$site_title - Home"; ?>