Location: PHPKode > projects > Akasha > validate_login.php
<?

	include ("includes/global.inc"); 	// Global Variables
	include ("includes/functions.inc");	// Standart Functions

	mt_srand((double)microtime()*10000);
	$ID1 = md5(mt_rand(1,60000));
	$ID2 = crypt($txtusername);
	$ID = "$ID2$ID1";
	$ID=ereg_replace("/","X",$ID);
	setcookie("akashaID", $ID, time()+ 12000);

	$mbox = @imap_open("{".$domain."/pop3:110}INBOX", "$txtusername", "$txtpassword");
	if ( $mbox ) {
		imap_close($mbox);
		$user_id = findUser("$txtusername");
		if ($user_id == 0) {
			$ip = $REMOTE_ADDR;
			$user_id = addUserToDB($txtusername,$txtpassword,$ip);
		}

		$date = date('Y-m-d');
		$time = date('H:i');
		$query = "insert into tblLoggedUsers values(NULL,'$txtusername','$txtpassword','$ID','$REMOTE_ADDR','$date','$time','$user_id')";
 		$result = mysql_db_query("$dbname",$query);

		$txt_outbox = "Sent Mail";
		$txt_trash = "Trash";

 		$query = "update tblMailBoxes set mboxname='$txt_outbox' where user_id = $user_id and mbox_tip = 1";
 		$result = mysql_db_query("$dbname",$query);

 		$query = "update tblMailBoxes set mboxname='$txt_trash' where user_id = $user_id and mbox_tip = 2";
 		$result = mysql_db_query("$dbname",$query);

		Header("Location: mailbox.php?ID=$ID&mbox_id=inbox&giris=1");

	} else {
			Header("Location: main.php?error_code=1");		
			die;
	}

?>
Return current item: Akasha