Hey all,
I am trying to put a login form on the front pages (index, contact us, about us) of my site. I want the members to put in username and pass, and when they click submit, it takes them to the /members/ area of the site.
Right now this is how I have the form.
<form method="POST" action="login.php">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Login">
</form>
I have this, but the members area consist of several pages and not just on location.
if ($_SESSION['authorized'] != true)
{
header("Location: login_form.php");
exit;
}
Finally, I am going to create a login.php page that has this in it.
$select_user =
mysql_query('select * from users where username = "' .
$_POST['username'] . '" and password = "' .
md5($_POST['password'] . '"'));
if (mysql_num_rows($select_user) != 0)
{
session_start();
session_register('authorized');
$_SESSION['authorized'] = true;
header("Location: protected_content.php");
exit;
}
else
{
header("Location: login_form.php");
exit;
}
So My questions are, How can I make it so they can access the entire /members/ area (directory)
and what would I put in the database ‘members’ when I create it. All members are going to use the same username and pass. So there is only need for 1 query for username and 1 for password.
I appreciate anyone help in advance.