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;

}

?>

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']);

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

thanks.

that has sorted it thank you very much mate.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.