I have a problem with thsis code while trying to log in with this code
In this line of code it checks database to see if the username and password matches the input fields which is shown below
mysql_connect ("$dbhost", "$dbuser", "$dbpass") or die ("Can not Connect");
mysql_select_db("$db_name") or die ("Can not connect to the database");
$myusername =$_POST['user'];
$mypassword =$_POST['password'];
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and
password='$mypassword'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count==1){
session_register("user");
session_register("password");
header("location:login_success.php");
}
else{
echo "Wrong Username or Password";
}
and the second code below checks the session and redirects me back to the main page
session_start();
if(!session_is_registered(user)){
include ("index.html");
}
When i select the login button this error keeps coming up:
Notice: Use of undefined constant user - assumed 'user' in H:\p3t\phpappfolder\public_php\project\login_success.php on line 3
Can anyone try and help me to fix it please