Hi Jessica,
You could do someting like this:
Let's say you have a FORM on your first page (index.php):
<?
if ($llx=="member") {
include ("adminMain.inc");
// see below
} else {
if ($submit=="login") {
include ("adminChkLogin.inc");
} else {
echo ("<P><P><P><center><table width=200><TR><td width=200 bgcolor=#ef8fd4>");
echo ("<form action=admin.php method=post>");
echo ("login<BR>");
echo ("<input type=text name=login size=10 maxlength=10><BR>");
echo ("password<BR>");
echo ("<input type=password name=passwd size=10 maxlength=10><BR>");
echo ("<input type=submit name=submit value=login>");
echo ("</TD></TR></TABLE></CENTER>");
echo ("</FORM>");
}
}
?>
Here is the File which checks the password:
filname: adminChkLogin.inc
<?
mysql_pconnect(host,user,password);
mysql_select_db(yourdatabase);
if (empty($login)) {
echo ("<p>Login field was empty");
}
elseif (empty($passwd)) {
echo ("<p>Password field was empty");
}
else {
// if you don't run mysql cut from here ...
$chkLogin=mysql_query("SELECT * FROM user WHERE usrLogin='$login'") or die ("database error");
if ($clrow=mysql_fetch_array($chkLogin)) {
if (ereg($clrow[usrPasswd],$passwd))
// ...and here and uncomment the next line
/*
if (($passwd=="yourpassword") && ($login=="yourlogin"))
*/
{
$llx=member;
include ("adminMain.inc");
}
else {
echo ("<p>ERROR");
}
}
else {
echo ("<p>ERROR");
}
}
?>
for this example you'll need a mysql database:
create table user (
usrId integer not null default '0' auto_increment,
usrLogin varchar(10) not null,
usrPasswd varchar(10) not null,
primary key (usrId));
I think this should work (although I didn't test it...)