<?php 
require_once('Connections/localhost.php'); 

mysql_select_db($database_localhost,$localhost);
date_default_timezone_set('Etc/GMT-8');

$query_search = "select * from tempid";
$query_exec = mysql_query($query_search) or die(mysql_error());
$rowValue = mysql_fetch_array($query_exec);
$rows = mysql_num_rows($query_exec);

$userID = $rowValue['user_ID'];
$query_search2 = "select * from tbl_user where user_ID = '".$userID."'";
$query_exec2 = mysql_query($query_search2) or die(mysql_error());
$rowValue2 = mysql_fetch_array($query_exec2);

$userIDI = $rowValue2['user_ID'];
$userName = $rowValue2['username'];
//$ID = $_POST['Id'];
$dateToday = date('d-m-Y', time());
$timeNow = date('h:i:s a', time());
$action = "logout";

if($rows --> 0) { 
mysql_query("delete from tempid where user_ID='$userIDI'");
$result = mysql_query("insert into recordofuser (user_ID,username,udate,utime,uaction) value ('$userIDI','$userName','$dateToday','$timeNow','$action')");
			$_SESSION['AdminID'] = $userIDI;
echo "Y";
//mysql_query("Insert into mydatabase.tbl_user values('$ID','$useremail','$password')");
}
else  {
echo "N";
}
 //echo "<script language='javascript'>alert(".$row['username'].")</script>";
?>