0

hello,

ive recently created a login in and register page for a website im working on and when using the register.php page to sign up, then entering the details into the login.php page all the login page seems to be doing is refreshing and removing the entered information and not moving onto the next page, im not sure on the problem if anyone can help or suggest anything.

below is the login.php script:

login.php script:

<?php
require('config.php');

if (isset ($_POST['submit'])){
    $uname = mysql_escape_string($_POST['uname']);
    $pass = mysql_escape_string($_PASS['pass']);
    $pass = md5($pass);

    $sql = mysql_query("SELECT * FROM `tut` WHERE `uname` = '$uname' AND `pass` = '$pass'");
    if(mysql_num_rows($sql) > 0){
        echo"You are now logged in";
        exit();
    }else{
        echo"Wrong Username or Password";   
    }

}else {

$form = <<<EOT
<form action="login.php" method="POST">
Username: <input type="text" name="uname"/><br />
Password: <input type="password" name="pass"/><br />
<input type="submit" name"submit" value="Log In"/>
</form>  
EOT;

echo $form;

}

?>
2
Contributors
3
Replies
25
Views
4 Years
Discussion Span
Last Post by jon92
2

Two issues. Your IF statement is failing because you missed the = between name and "submit" online 23 so the name of your submit button isn't being passed:

<input type="submit" name"submit" value="Log In"/>
Change To
<input type="submit" name="submit" value="Log In"/>

This looks like a tpyo, $_PASS should be $_POST on line 6
$pass = mysql_escape_string($_PASS['pass']);
Chage to
$pass = mysql_escape_string($_POST['pass']);

0

gliderpilot, ok cheers will give it a try and let you know how i get on

thanks.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.