Session prefix, if you are hosting multiple sites, make the session name different to avoid conflict.

This commit is contained in:
Stefan Brannfjell
2014-09-06 13:43:49 +02:00
parent e0ad3aae09
commit 8ab9f11ef5
6 changed files with 21 additions and 15 deletions

View File

@@ -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')");
}