";exit;
exit;
}
// Open session handler
function openSession() {
// No action needed, but required by session handler
return true;
}
// Close session handler
function closeSession() {
// No action needed, but required by session handler
return true;
}
// Read session data from MySQL
function readSession($id) {
global $PAAPP_CONFIG_DB_LINK;
$pdo = $PAAPP_CONFIG_DB_LINK;
$stmt = $pdo->prepare("SELECT data FROM sessions WHERE id = :id");
$stmt->execute(['id' => $id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
return $row ? $row['data'] : '';
}
// Write session data to MySQL
function writeSession($id, $data) {
global $sessionID;
global $PAAPP_CONFIG_DB_LINK;
$sessionID = $id;
echo "".$id."
";
$pdo = $PAAPP_CONFIG_DB_LINK;
$stmt = $pdo->prepare("REPLACE INTO sessions (id, data, timestamp) VALUES (:id, :data, NOW())");
return $stmt->execute([
'id' => $id,
'data' => $data
]);
}
// Destroy a session
function destroySession($id) {
global $PAAPP_CONFIG_DB_LINK;
$pdo = $PAAPP_CONFIG_DB_LINK;
$stmt = $pdo->prepare("DELETE FROM sessions WHERE id = :id");
return $stmt->execute(['id' => $id]);
}
// Garbage collection (delete old sessions)
function gcSession($maxLifetime) {
global $PAAPP_CONFIG_DB_LINK;
$pdo = $PAAPP_CONFIG_DB_LINK;
$stmt = $pdo->prepare("DELETE FROM sessions WHERE timestamp < :threshold");
return $stmt->execute(['threshold' => time() - $maxLifetime]);
}
if (session_status() == PHP_SESSION_NONE) {
try {
ob_start();
// Set custom session handler functions
session_set_save_handler(
'openSession',
'closeSession',
'readSession',
'writeSession',
'destroySession',
'gcSession'
);
session_start();
$_SESSION["TEST"] = true;
} catch (Exception $e) {
die('Session start failed: ' . $e->getMessage());
}
}
setcookie("MyCookie",$sessionID,1400);
//echo "
----+++-
";
//print_r($_SESSION);
//echo "
#########
";
//echo "
=====
";
exit;
?>
require_once 'init.php';
redirect(APP_URL.'/intel_analytics_dashboard.php');