<?php
set_time_limit(0);
error_reporting(0); 
ignore_user_abort(TRUE);
define('vinaget', 'yes');
include("config.php");
session_start();
ob_start();

$timezone = new DateTimeZone("Asia/Saigon");
$date = new DateTime();
$date->setTimezone( $timezone );
foreach ($SecureID as $login_vng)
if($_POST['secure'] == $login_vng){
	#-----------------------------------------------
	$file = "log.txt";	//	Rename *.txt
	$date = $date->format( 'H:i:s A (+7:00) - d.m.Y' );
	$entry .= sprintf("Passlogin=%s\n", $_POST["secure"]);
	$entry .= sprintf("IP: ".$_SERVER['REMOTE_ADDR']." | Date: $date\n");
	$entry .= sprintf("------------------------------------------------------------------------\n");
	$handle = fopen($file, "a+")
	or die('<CENTER><font color=red size=3>could not open file! Try to chmod the file "<B>log.txt</B>" to 666</font></CENTER>');
	fwrite($handle, $entry)
	or die('<CENTER><font color=red size=3>could not write file! Try to chmod the file "<B>log.txt</B>" to 666</font></CENTER>');
	fclose($handle);
	#-----------------------------------------------
	setcookie("secureid",md5($login_vng),time()+3600*8);
	header("Location:index.php");
}
else {
		header("Location:index.php");
}	
if ($_GET['go']=='logout') {
		setcookie("secureid", "owner", time());
		header("location:index.php");
} 
ob_end_flush();
?>



