mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-11-29 17:06:51 +01:00
Session prefix, if you are hosting multiple sites, make the session name different to avoid conflict.
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
<?php
|
||||
function setSession($key, $data) {
|
||||
global $sessionPrefix;
|
||||
$_SESSION[$sessionPrefix.$key] = $data;
|
||||
}
|
||||
function getSession($key) {
|
||||
global $sessionPrefix;
|
||||
return (isset($_SESSION[$sessionPrefix.$key])) ? $_SESSION[$sessionPrefix.$key] : false;
|
||||
}
|
||||
// Fetch and sanitize POST and GET values
|
||||
function getValue($value) {
|
||||
return (!empty($value)) ? sanitize($value) : false;
|
||||
@@ -152,7 +160,7 @@ function znote_visitor_insert_detailed_data($type) {
|
||||
$time = time();
|
||||
$ip = ip2long(getIP());
|
||||
if (user_logged_in()) {
|
||||
$acc = $_SESSION['user_id'];
|
||||
$acc = (int)getSession('user_id');
|
||||
mysql_insert("INSERT INTO `znote_visitors_details` (`ip`, `time`, `type`, `account_id`) VALUES ('$ip', '$time', '$type', '$acc')");
|
||||
} else mysql_insert("INSERT INTO `znote_visitors_details` (`ip`, `time`, `type`, `account_id`) VALUES ('$ip', '$time', '$type', '0')");
|
||||
}
|
||||
|
||||
@@ -994,7 +994,7 @@ function user_update_account($update_data) {
|
||||
$update[] = '`'. $field .'` = \''. $data .'\'';
|
||||
}
|
||||
|
||||
$user_id = sanitize($_SESSION['user_id']);
|
||||
$user_id = (int)getSession('user_id');
|
||||
|
||||
mysql_update("UPDATE `accounts` SET ". implode(', ', $update) ." WHERE `id`=". $user_id .";");
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ function user_update_znote_account($update_data) {
|
||||
$update[] = '`'. $field .'` = \''. $data .'\'';
|
||||
}
|
||||
|
||||
$user_id = sanitize($_SESSION['user_id']);
|
||||
$user_id = (int)getSession('user_id');
|
||||
|
||||
mysql_update("UPDATE `znote_accounts` SET ". implode(', ', $update) ." WHERE `account_id`=". $user_id .";");
|
||||
}
|
||||
@@ -1449,7 +1449,7 @@ function user_login_03($username, $password) {
|
||||
|
||||
// Verify that user is logged in
|
||||
function user_logged_in() {
|
||||
return (isset($_SESSION['user_id'])) ? true : false;
|
||||
return (getSession('user_id') !== false) ? true : false;
|
||||
}
|
||||
|
||||
function guild_war_invitation($cid, $gid) {
|
||||
|
||||
Reference in New Issue
Block a user