this is part of the code that i have on my login screen
PHP Code:
$sql="SELECT * FROM user WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword,table is 1 row
if($count==1){
$_SESSION['myusername'] = $myusername;
header("location:.........");
}
else {
echo "Wrong Username or Password";
}
?>
and this is the other part of the code where i want it so that if a user is not logged in that they will be redirected to the login page to either register their account or login could someone give me some help as to what i'm doing wwong here since it still lets you access the page without being logged on
PHP Code:
<?PHP
session_start();
if(isset($_SESSION['myusername'])){
//session is set, user is logged in
}else{
header("location:.........");
}
?>