session_start(); include_once 'includes/db_connect.php'; $time=time(); /// LOGIN \\\ //// SECURITY MESURE \\\\ if($_POST['username'] == "LOCKDOWN" && $_POST['password'] == "thelockdownpassword"){ mysql_query("UPDATE site_stats SET logou='1' WHERE id='1'"); print "GAME LOCKED DOWN !!!!!!!!!!!!!!!!!!"; } if (($_POST['username']) || ($_POST['password'])){ if(!$_POST['username']){ $message="Please enter your username"; }elseif(!$_POST['password']){ $message="Please enter your password"; }else{ $username = $_POST['username']; $username_c = $_POST['username']; $password =$_POST['password']; $sql = mysql_query("SELECT * FROM `users` WHERE `username`='$username' AND `password=`'$password'"); $newsql= mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'")or die(mysql_error()); $login_check = mysql_num_rows($newsql); $targetstats = mysql_query("SELECT username, password, status, tos, online, cryo, referal FROM users WHERE username='$username'"); while($ts = mysql_fetch_array($targetstats)){ $username= $ts[0]; $pw = $ts[1]; $status = $ts[2]; $tos = $ts[3]; $online= $ts[4]; $cryo= $ts[5]; $referal= $ts[6]; } if($username === $username_c){ if($pw!==$password){ $message="Incorrect username and password"; }elseif($login_check == 0 ){ $message="Incorrect username and password"; }elseif($pw!=$password){ $message="Incorrect username and password"; }elseif ($status == "Dead"){ $message=""; }elseif ($status == "Banned"){ $message=""; }elseif ($cryo > $time){ $message="You are frozen!"; }else{ if($ts[4] > $time){ $message="This account is already logged in! Please try again in 5 minutes."; }else{ $_SESSION['username'] = $username; $_SESSION['password'] = $password; $now = time(); $domain = $_SERVER['REMOTE_ADDR']; if($online == "0" && $referal != "0"){ $fkage=mysql_fetch_object(mysql_query("SELECT points FROM users WHERE username='$referal'")); $pnt=$fkage->points+2; mysql_query("UPDATE users SET online='$time' WHERE username='$username'"); mysql_query("UPDATE users SET points='$pnt' WHERE username='$referal'"); } mysql_query("UPDATE users SET ip='$domain' WHERE username='$username'"); if($tos == "0"){ echo ""; }else{ echo ""; } } } }else{ $message="Invalid Username. Note username is case sensitive !"; }}} if(session_is_registered('username')){ $checkpassword = $_SESSION['password']; $checkusername = $_SESSION['username']; $checklogin = mysql_query("SELECT id FROM users WHERE username='$checkusername' AND password='$checkpassword'"); $checkloginrows = mysql_num_rows($checklogin); if($checkloginrows > 0 ){ echo ""; exit(); }else{ unset($_SESSION['username'],$_SESSION['password']); } } ?>