OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
creator
/
inc
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
01/21/2025 10:39:45 AM
rwxr-xr-x
📄
config.php
9.42 KB
01/21/2025 10:39:35 AM
rw-r--r--
📄
db_connect.php
261 bytes
01/21/2025 10:39:36 AM
rw-r--r--
📄
function.php
2.72 KB
01/21/2025 10:39:36 AM
rw-r--r--
📄
genai_func.js
15.21 KB
01/21/2025 10:39:38 AM
rw-r--r--
📄
handler.php
6.06 KB
01/21/2025 10:39:37 AM
rw-r--r--
📄
validate.logged.php
1.01 KB
01/21/2025 10:39:38 AM
rw-r--r--
Editing: function.php
Close
<?php function checkLike($conn, $userId, $articleId) { try { $sql = "SELECT COUNT(*) as count FROM reader_thumbs_up WHERE articleId = ? AND userId = ?"; $stmt = $conn->prepare($sql); if ($stmt === false) { throw new Exception("Prepare failed: " . $conn->error); } $stmt->bind_param("ii", $articleId, $userId); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); return $row['count'] == 1; } catch (Exception $e) { // Log the error message error_log($e->getMessage()); return false; // Indicate failure } finally { if (isset($stmt) && $stmt) { $stmt->close(); } } } function likeCount($conn, $articleId) { try { $sql = "SELECT COUNT(*) as count FROM reader_thumbs_up WHERE articleId = ?"; $stmt = $conn->prepare($sql); if ($stmt === false) { throw new Exception("Prepare failed: " . $conn->error); } $stmt->bind_param("i", $articleId); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); if ($row['count'] === 0) { return ''; } return $row['count']; } catch (Exception $e) { // Log the error message error_log($e->getMessage()); return false; // Indicate failure } finally { if (isset($stmt) && $stmt) { $stmt->close(); } } } function find_ipgeo_location() { // Fetch the client's 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'); // Default values $visitCity = ''; $visitCountry = ''; // Fetch geolocation data $response = @file_get_contents('http://www.geoplugin.net/php.gp?ip=' . urlencode($ip)); if ($response !== false) { $data = unserialize($response); if ($data && isset($data['geoplugin_city']) && isset($data['geoplugin_countryName'])) { $visitCity = $data['geoplugin_city']; $visitCountry = $data['geoplugin_countryName']; } } // Prepare the response in JSON format $result = [ 'City' => $visitCity, 'Country' => $visitCountry ]; return json_encode($result); } function createArticleURL($title) { if ($title <> '') { $title = str_replace(' ', '-', $title); $title = str_replace('%', '', $title); $title = str_replace("'", "", $title); return $title; } else { return ''; } }