kingb00zer Posted April 19, 2010 Share Posted April 19, 2010 I have a simple log in script which doesnt seem to log me in, it keeps saying wrong username or password for some reason and it isn't giving me what line any error is on, I know my username and pass is right coz i kept simple username ###### pass is face but for some reason it wont let me log in. index.html<html><body><h1> Thug Fights </h1><form name="form2" method="post" action="checklogin.php"><p>Username: <input type="text" name="username" id="username" size="15" maxlength="20" value=""/></p><p>Password: <input type="password" name="password" id="password" size="15" maxlength="20" value=""/></p><p> <input type="submit" name="login" value="Log in"></p><a href="register.php">New to thugfights Register Here</a></body></html> checklogin.php<?phpob_start();include('connection.php'); // Define $myusername and $mypassword$myusername=$_POST['username'];$mypassword=$_POST['password'];// To protect MySQL injection (more detail about MySQL injection)$myusername = stripslashes($myusername);$mypassword = stripslashes($mypassword);$myusername = mysql_real_escape_string($myusername);$mypassword = mysql_real_escape_string($mypassword);$sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";$result=mysql_query($sql);// Mysql_num_row is counting table row$count=mysql_num_rows($result);// If result matched $myusername and $mypassword, table row must be 1 rowif($count==1){// Register $myusername, $mypassword and redirect to file "login_success.php"session_register("myusername");session_register("mypassword");header("location:login_success.php");}else {echo "Wrong Username or Password";}ob_end_flush();?> login_success.php<?session_start();if(!session_is_registered(myusername)){header("location:index.php");}else{header ("location: phptestmenu.php")}?> If anyone can help me figure out why I cant log into my site that would be great beause I am unsure what it could be. Link to comment Share on other sites More sharing options...
Err Posted April 19, 2010 Share Posted April 19, 2010 error_reporting(E_ALL); ini_set('display_errors', 1); Put that at the top your script. This will display any errors or warnings you might be having. Link to comment Share on other sites More sharing options...
kingb00zer Posted April 19, 2010 Author Share Posted April 19, 2010 Thanks, after about 30 minutes of going hru te errors I managed to log myself into my game for the first time , too bad dont have any working actions yet hehe Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.