


function logincookie($id, $password, $secret, $updatedb = true, $expires = null) {
if ($expires === null) {
$expires = time() + (30 * 24 * 60 * 60); // 30 дни
}
// Оставяме sha1 за съвместимост
$hash = sha1($id . $secret . $password . getip() . $secret);
// Сетваме cookies с новия синтаксис и флагове
setcookie("pass", $hash, [
'expires' => $expires,
'path' => '/',
'secure' => true, // само по HTTPS
'httponly' => true, // JS не може да го чете
'samesite' => 'Lax' // или 'Strict' според нуждите
]);
setcookie("uid", $id, [
'expires' => $expires,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax'
]);
if ($updatedb) {
$stmt = $GLOBALS["DBconnector"]->prepare("UPDATE users SET last_login = ? WHERE id = ?");
$stmt->bind_param("si", get_date_time(), $id);
$stmt->execute();
$stmt->close();
}
}
function logoutcookie() {
// Изтриваме cookies със същите флагове
setcookie("pass", "", [
'expires' => time() - 3600,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax'
]);
setcookie("uid", "", [
'expires' => time() - 3600,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax'
]);
} return $this; public function __construct(string $query) {
$this->query = $query;
return $this; // Not allowed in PHP 8+
}public function __construct(string $query) {
$this->query = $query;
// no return statement here
}$ip = $_SERVER['REMOTE_ADDR'];
$host = gethostbyaddr($ip);
if (strpos($host, 'googlebot.com') === false && strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== false) {
header("HTTP/1.1 403 Forbidden");
exit;
}if (is_valid_id($teams))
$updateset[] = "team = '$teams'";/*if (is_valid_id($teams))
$updateset[] = "team = '$teams'";*/
if (is_numeric($teams) && (int)$teams >= 0) {
$teams = (int)$teams;
$updateset[] = "team = $teams";
}
if (isset($_GET["takesignup"]) && $_GET["takesignup"] == "1") {if (!empty($_POST['honeypot'])) {
// If the honeypot field is filled - we deny registration.
show_error_msg(T_("SIGNUP_FAILED"), "Spam detected.", 1);
die();
}<tr>
<td align="center" colspan="2">
<input type="submit" value="<?php echo T_("SIGNUP"); ?>" />
</td>
</tr><tr style="display:none;">
<td>Leave this field blank:</td>
<td><input type="text" name="honeypot" value="" autocomplete="off" /></td>
</tr>// Server load
$LANG["OPERATING_SYSTEM"] = "OS";
$LANG["SERVER_LOAD"] = "Server Load";
$LANG["RAM_USED"] = "RAM Used";
$LANG["UPTIME"] = "Uptime";
$LANG["CPU_CORES"] = "CPU Cores";
$LANG["HDD_USED"] = "HDD Used";
$LANG["PHP_VERSION"] = "PHP Version";
$LANG["PHP_MEMORY_USAGE"] = "PHP Load";
$LANG["SERVER_CHARSET"] = "Server Charset";
function logincookie($id, $password, $secret, $updatedb = true, $expires = null) {
// Convert to integer to ensure it is a valid number
$id = (int)$id;
// Set cookie expiration to 30 days if not provided
if ($expires === null) {
$expires = time() + (30 * 24 * 60 * 60); // 30 days
}
// Hash the password with SHA-1
$hash = sha1($id . $secret . $password . getip() . $secret);
// Set secure cookies with the expiration date
setcookie("pass", $hash, $expires, "/", "", true, true);
setcookie("uid", $id, $expires, "/", "", true, true);
// Update the database if required
if ($updatedb) {
// Prepare the SQL statement
$stmt = $GLOBALS["DBconnector"]->prepare("UPDATE users SET last_login = ? WHERE id = ?");
// Bind the parameters
$stmt->bind_param("si", get_date_time(), $id);
// Execute the statement
$stmt->execute();
// Close the statement
$stmt->close();
}
}
function logoutcookie() {
// Delete the cookies by setting the expiration to the past
setcookie("pass", "", time() - 3600, "/", "", true, true);
setcookie("uid", "", time() - 3600, "/", "", true, true);
} // Get language and theme
$CURUSER = $GLOBALS["CURUSER"] ?? [];
// Query to get the user's theme or the default theme
$ss_a = mysqli_fetch_assoc(SQL_Query_exec("select uri from stylesheets where id='" .
($CURUSER ? $CURUSER['stylesheet'] : $site_config['default_theme']) . "'"));
$THEME = $ss_a["uri"] ?? ''; // Ensure $THEME is not null
// Query to get the user's language or the default language
$lng_a = mysqli_fetch_assoc(SQL_Query_exec("select uri from languages where id='" .
($CURUSER ? $CURUSER['language'] : $site_config['default_language']) . "'"));
$LANGUAGE = $lng_a["uri"] ?? ''; // Ensure $LANGUAGE is not null
// Load the language file if available
if (!empty($LANGUAGE)) {
require_once("languages/$LANGUAGE");
} 