Thank you, the login works again now. For some reason I had to also change this if($count==0), However, even with session_start() at the top of the other pages I can still access the pages without logging in. What else can I do?
login,php
<?php
$connection = mysql_connect('localhost', 'root', 'hp44kw5');
if (!$connection){
die("Database Connection Failed" . mysql_error());
}
$select_db = mysql_select_db('login');
if (!$select_db){
die("Database Selection Failed" . mysql_error());
}
if (isset($_POST['username']) and isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$query = mysql_query("select * from members where password='$password' AND username='$username'", $connection);
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==0){
$_SESSION["authorized"] = true;
header("location:membersarea.php");
} else
header ("Location: login.html");
}
?>
membersarea.php
<?php
session_start();
if ($_SESSION["authorized"] = true) {
}
else
{
header("Location: login.html");
}
?>