Hi
I dapted a script I found on the web to meke a login in my page. Unfortunately the end of it does not work and it appears to be due to deprecated functions, which I don't even understand what thet are supposed to do.
The login seems to work as I get a white page if the data is corrcet and the error message if it is not. What does not work is the connection between the end of the login script and another one that declares success and returns the vivitor to the front page. I am pasting below the end of one and the total of the other. Any help would be much appreciated, before I lose all my hairs!
$sql="SELECT * FROM $tbl_name WHERE user='$user' and password='$password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $user and $password, table row must be 1 row
if($count==1)
{
// Register $username, $password and redirect to file "login_success.php"
session_register('user');
session_register('password');
header("login_success.php");
}
else {
echo "Wrong Username or Password, or you have not registered yet.<br>
Please, go back and either reenter your login details, or press the register button";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
// Check if session is not registered, redirect back to main page.
// Put this code in first line of web page.
<?php
session_start();
if(!session_is_registered(user)){
header("register.php");
}
?>
<html>
<body>
Login Successful
</body>
</html>
</body>
</html>