make a config file
config.php
PHP Code:
<?php
mysql_pconnect("host","name","pass");
mysql_select_db("dbname");
?>
then your index.php page should contain the log in form
PHP Code:
<?php include("config.php"); ?>
bunch of HTML or what ever you have coded in
in this bunch you need to have a
log in form that looks something like this
<table cellpadding=0 cellspacing=0 width=50%>
<form method=post action=login.php>
<tr><td width="67" with=10>Email:</td>
<td width="145"><input type=text name=email></td></tr>
<tr><td with=10>Password:</td><td><input type=password name=pass></td></tr>
<tr><td colspan=2 align=center><input type=submit value=Login></td></tr></table></form>
then you need a login page
PHP Code:
<?php
if (!$email || !$pass) {
include("config.php");
print "Please fill out all fields.";
exit;
}
include("config");
$sql = mysql_query("select * from dbname where email='$email' and pass='$pass'");
$logres = mysql_num_rows($sql);
if ($logres <= 0) {
print "Login failed.";
exit;
} else {
session_register("email");
session_register("pass");
print " <br>Welcome back. Please click
<a href=membersonly.php>here</a> to continue..";
}
?>
you might consider a register page as well
you should beable to figure out how to make it after seeing this post and looking at the sites mentioned above