<?php
//Login To Database
include("Database.php");
include("OpenDatabase.php");
//Get The Functions
include("Functions.php");
//The Headers
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>

<?php
	 
$username=$_GET['username'];
$password=$_GET['password']; 
$action=$_GET['action'];
$receiver=$_GET['receiver'];
$timestamp=$_GET['timestamp'];	
$check_username_password=mysql_fetch_array(mysql_query("SELECT * FROM members WHERE Id='$username' AND Password='$password'"));
   
//view mail from sender
if($action=="Read_Mail" AND "$check_username_password[0]")
{ 
//Page Title And CSS Theme
echo FlareXhead($uthm,$stitle);
echo "<p align=\"center\">";
echo "<small><p2>".date("D d M y - H:i",time() )."</a></p2></small><br/>";
$TimeZone="0"; ////Change the TimeZone accordingly!
$New_Time = time() + ($TimeZone * 60 * 60);

$show_date=date("D dS F, Y",$New_Time); 
$show_time=date("H:i",$New_Time); 
$Hour=date("G",$New_Time);
 
$mail2=mysql_fetch_array(mysql_query("SELECT Letter FROM mailbox WHERE Receiver='$receiver' AND Valid='1'")); 
echo $mail2[0];
mysql_query("UPDATE mailbox SET Valid='0' WHERE Letter='".$mail2[0]."'");
	
echo"<br/><a href=\"index.php?action=main&username=$username&password=$password\">Back To Home</a>";
echo FlareXfoot();
}else{
//Page Title And CSS Theme
echo FlareXhead($uthm,$stitle);
echo "<p align=\"center\">";
echo "<small><p2>".date("D d M y - H:i",time() )."</a></p2></small><br/>";
$TimeZone="0"; ////Change the TimeZone accordingly!
$New_Time = time() + ($TimeZone * 60 * 60);

$show_date=date("D dS F, Y",$New_Time); 
$show_time=date("H:i",$New_Time); 
$Hour=date("G",$New_Time);
echo "You Are Not Logged In!</a><br/>";
echo "<form action=\"Login.php?username=$username&password=$password\" method=\"GET\">";
echo "<p3>Username:</p3> <input type=\"text\" name=\"username\"><br/>";
echo "<p3>Password:</p3> <input type=\"password\" name=\"password\"><br/>";
echo "<input type=\"submit\" value=\"Login!\">"; 
echo "</form>"; 
echo FlareXfoot();
} 

?>
