When someone logs in you should set a session
[php]
$_SESSION['logged_in'] = true;
[/php]
then on the admin page you check to see if this is set
[php]
if(isset($_SESSION['logged_in']))
{
# logged in
}
else
{
# not logged in
}
[/php]
Hi Markus,
I tried it and it's still not working - here is my login.php
[php]<?php
$host="localhost";
$username="root";
$password="root";
$db_name="data";
$tbl_name="login";
mysql_connect("$host", "$username", "$password")or die("Unable to connect");
mysql_select_db("$db_name")or die("Unable to select database");
$username=$_POST['username'];
$password=$_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("username");
session_register("password");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password, Please be careful when typing them.";
}
ob_end_flush();
?>[/php]