Jump to content

Php User Login Issue


subha rr

Recommended Posts

Hi...Below the code<?phpinclude "pass.php";session_start();$user = isset($_POST['user']) ? $_POST['user'] : $_SESSION['user'];$pass = isset($_POST['pass']) ? md5($_POST['pass']) : $_SESSION['pass'];mysql_query("insert into login('', '$user', '$pass')");$link = mysql_connect($hostname, $username, $password);if($link){$db = mysql_select_db("time", $link);}$sql = "select * from login where username = '$user' and password = password('$pass')";$result2 = mysql_query($sql);if(!isset($pass) || !isset($user)){if($result2){?><form method=POST action=""><div align=center >Enter login details</div><br><table align = center><tr><td>Username</td><td><input type=text name=user value=""><tr><td>Password</td><td><input type=password name=pass value=""><tr><td><input type=submit value="Submit"></td></tr></table></form><?php}}else if($result2 != 'pass'){echo "<font>Authentication Failed</font>";}?>issue for this code for password is correct or incorrect, the result will be occured Authentication failed..What is the issue for this code?pls help..regardssubha

Link to comment
Share on other sites

The $result2 variable is a MySQL resource - you need to use mysql_fetch_assoc() or similar to get the actual value.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...