37 lines
725 B
PHP
37 lines
725 B
PHP
<?php
|
|
|
|
/*
|
|
* smzint/Auth (c) schmamazon.com 2025
|
|
*/
|
|
|
|
include('db.ini.php');
|
|
|
|
function cleanSessions(){
|
|
global $dbservername;
|
|
global $dbname;
|
|
global $dbusername;
|
|
global $dbpassword;
|
|
|
|
// Create connection
|
|
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
|
|
// Check connection
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
|
|
// sql to delete a record
|
|
$sql = "DELETE FROM smz_auth_sessions WHERE expiry < ".time()." OR active = 0";
|
|
|
|
if ($conn->query($sql) === TRUE) {
|
|
echo "Record deleted successfully";
|
|
} else {
|
|
echo "Error deleting record: " . $conn->error;
|
|
}
|
|
|
|
$conn->close();
|
|
}
|
|
|
|
echo "Starte SessionCleaner";
|
|
cleanSessions();
|
|
|
|
?>
|