<?php


date_default_timezone_set('Africa/Khartoum');
$entry_date = date("Y-m-d H:i:s",time()-3600); 

$table_name = $_SESSION['db_prefix']."_active_users";
$update_active_query = "UPDATE $table_name SET last_active = '".$entry_date."' WHERE username = '".$_SESSION['username']."' ";
$update_active_result = mySQL_query($update_active_query);

//$active = date("i", strtotime($entry_date));
//
//$a1 = date("i", strtotime($entry_date ));
//$a3 = date("h", strtotime($entry_date ));
//$active_query = "SELECT username, log_in, last_active  FROM $table_name  ";
//$active_result = mySQL_query($active_query);
//$active_num = mysql_num_rows($active_result);
//$i=0;
//while ($i<$active_num) {
//	$a0 = mysql_result($active_result, $i, "username");
//	$a2 = mysql_result($active_result, $i, "last_active");
//	$a2 = date("i", strtotime($a2 ));
//	$a4 = date("h", strtotime($a2 ));
//	
//	if ((abs($a4-$a3)<=0)) {
//		$del_query = "DELETE FROM $table_name WHERE username = '".$a0."' ";
//		$del_result = mySQL_query($del_query);
//	}
//	
//	
//	if ((abs($a2-$a1)) > 30) {
//		$del2_query = "DELETE FROM $table_name WHERE username = '".$a0."' ";
//		$del2_result = mySQL_query($del2_query);
//	}
//	
//	$i++;
//}




?>