date function =>sessions in the databse(Expired SESSIONS)

A

Anonymous

Guest
I'm inserting the session_time in the database using time() function
It will insert the date like this
1143365175

How can I read this Number & know the date and time for it?

I want to make Expiration for the sessions inserted two hours or one day ago :)
 
I'm searching for a function to delete the expired sessions from the database (sessions table) by finding if the session sime expired after 2 hours ago or a day ago??
 
ameenov said:
I'm searching for a function to delete the expired sessions from the database (sessions table) by finding if the session sime expired after 2 hours ago or a day ago??
$tHour = (60 * 60);
$tDay = ($tHour * 24);
$tWeek = ($tDay * 7);
$nexttime = time() + $tDay;
 
Code:
<?php

// Current time
$Time = time();

// 2 hours in seconds
$sessLifeTime = 7200;

// Now run:
mysql_query("DELETE FROM session_table WHERE ($Time - created) > $sessLifeTime");

// Where created is the field where you'll store sessions' creation time (with time() too).

?>
 
Back
Top