coldfirezz Posted November 12, 2008 Share Posted November 12, 2008 I cant figure out what is wrong with my login script.... You can try it out on my website here: http://sereneadventure.net/area51/login.php (Usernmame:Test and Pass: Test) The Errors Are As Follows: FF: Source IE: No Working Chrome: Page Not Avalible Heres the code: <?php session_start(); $Direct="."; $Design="design"; include("".$Direct."/inc/database.php"); include("".$Direct."/inc/global.php"); //Already Logged In if(isset($_COOKIE['Username'])) { include("".$Direct."/inc/head.php"); include("".$Direct."/inc/start.php"); include("".$Direct."/".$Design."/banner.php"); $Caption="Error"; include("".$Direct."/".$Design."/caption.php"); include("".$Direct."/".$Design."/tablep1.php"); echo"You are already logged in"; include("".$Direct."/".$Design."/tablep2.php"); die; } //End Already Logged In elseif($_GET['action']==start){ $Username = $_POST["username"]; $Pass = $_POST["password"]; $Password = md5($Pass); $db = mysql_select_db('Members'); //Check Username entered $Check = "SELECT Username FROM Users WHERE Username = '".$Username."'"; $CheckDB = mysql_query($Check,$con); $Amount = mysql_num_rows($CheckDB); //Username Does not exist if($Amount == 0) { include("".$Direct."/inc/head.php"); include("".$Direct."/inc/start.php"); include("".$Direct."/".$Design."/banner.php"); $Caption="Error"; include("".$Direct."/".$Design."/caption.php"); include("".$Direct."/".$Design."/tablep1.php"); echo"The Username You Entered Does not Exist"; include("".$Direct."/".$Design."/tablep2.php"); die; } //End Username Does Not Exist //Check to see if password for user is correct $Check = "SELECT Password FROM Users WHERE Username='$Username'"; $CheckDB = mysql_query($Check,$con); $row = mysql_fetch_array($CheckDB); //Password is inncorrect if($row['Password'] != $Password) { include("".$Direct."/inc/head.php"); include("".$Direct."/inc/start.php"); include("".$Direct."/".$Design."/banner.php"); $Caption="Error"; include("".$Direct."/".$Design."/caption.php"); include("".$Direct."/".$Design."/tablep1.php"); echo"Password does not match. Please Try Again."; include("".$Direct."/".$Design."/tablep2.php"); die; } //Log user in else{ setcookie("Username","".$Username."",$CookieTime,"/"); setcookie("Password","".$Password."",$CookieTime,"/"); setcookie("SessionEnd", "True",$CookieTime,"/"); $result = mysql_query("SELECT * FROM Users WHERE Username = '".$Username."'"); while($row = mysql_fetch_array($result)){ setcookie("UserID", "".$row['ID']."",$CookieTime,"/"); $UserID=$row['ID']; setcookie("Access_Level", "".$row['Access_Level']."",$CookieTime,"/"); } $db = mysql_select_db('Promo'); $result = mysql_query("SELECT * FROM Battle WHERE Name='Coins'"); while($row = mysql_fetch_array($result)){ setcookie("ExpPromo","".$row['Times']."",$CookieTime,"/"); } if($_COOKIE['CoinPromo']==0){ setcookie("CoinPromo","1",$CookieTime,"/"); } setcookie("ExpPromo","1"); $result = mysql_query("SELECT * FROM Battle WHERE Name='Exp'"); while($row = mysql_fetch_array($result)){ setcookie("ExpPromo","1",$row['Times'],"/"); } if($_COOKIE['ExpPromo']==0){ setcookie("ExpPromo","1",$CookieTime,"/"); } include("".$Direct."/inc/selectcharacterlogin.php"); include("".$Direct."/inc/selectnpc.php"); include("".$Direct."/inc/head.php"); include("".$Direct."/inc/start.php"); include("".$Direct."/design/banner.php"); $Caption="Success!"; include("".$Direct."/".$Design."/caption.php"); include("".$Direct."/".$Design."/tablep1.php"); echo"Your Login was successful. Please wait while you are redirected."; include("".$Direct."/".$Design."/tablep2.php"); $db = mysql_select_db('Members'); $Edit="UPDATE Users SET UniqueID='".$SessionID."', Location='".$Location."' WHERE Username='".$Username."'"; mysql_query($Edit, $con); $db = mysql_select_db('Logs'); $sql = "INSERT INTO Login (Action, IP, Username, Session,Time) VALUES ('Logged In', '".$IP."', '".$_COOKIE["Username"]."','".$SessionID."','".$Time."')"; mysql_query($sql,$con); ?><meta http-equiv="Refresh" content="4; url=http://sereneadventure.net/area51/"><?php die; } } else { include("".$Direct."/inc/head.php"); include("".$Direct."/".$Design."/banner.php"); $Caption="Login"; include("".$Direct."/".$Design."/caption.php"); include("".$Direct."/".$Design."/tablep1.php"); echo"<form id='login' name='login' method='post' action='login.php?action=start'> Username<br /> <input type='text' name='username' id='username' /><br /> Password<br /> <input type='password' name='password' id='password' /><br /> <input type='submit' name='login' id='login' value='Login' /> </form>"; include("".$Direct."/".$Design."/tablep2.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/132368-need-help-with-my-login-script/ Share on other sites More sharing options...
Alt_F4 Posted November 12, 2008 Share Posted November 12, 2008 have you fixed you issues? Works fine in IE 7, Chrome and FF 3.0.3 for me logs in and redirects to what i assume is the right page. Link to comment https://forums.phpfreaks.com/topic/132368-need-help-with-my-login-script/#findComment-688238 Share on other sites More sharing options...
coldfirezz Posted November 12, 2008 Author Share Posted November 12, 2008 have you fixed you issues? Works fine in IE 7, Chrome and FF 3.0.3 for me logs in and redirects to what i assume is the right page. I have yet to fix it. Try it a few times. Link to comment https://forums.phpfreaks.com/topic/132368-need-help-with-my-login-script/#findComment-688239 Share on other sites More sharing options...
Alt_F4 Posted November 12, 2008 Share Posted November 12, 2008 what is supposed to happen so i can check it? Link to comment https://forums.phpfreaks.com/topic/132368-need-help-with-my-login-script/#findComment-688243 Share on other sites More sharing options...
coldfirezz Posted November 12, 2008 Author Share Posted November 12, 2008 what is supposed to happen so i can check it? When you login it should redirect you to the homepage (Not the ring/circle directory) Link to comment https://forums.phpfreaks.com/topic/132368-need-help-with-my-login-script/#findComment-688245 Share on other sites More sharing options...
Alt_F4 Posted November 12, 2008 Share Posted November 12, 2008 ok still works for chrome and ff, but am getting an error in IE that says i am already logged in. when i click logout it tells me that i am not logged in. is this what you r getting? Link to comment https://forums.phpfreaks.com/topic/132368-need-help-with-my-login-script/#findComment-688248 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.