Np brother. I got ya on this one.
here is my script:
<?php
if(isset($login)){
include("connection.inc");
$db = mysql_connect("localhost","username","password");
mysql_select_db("dbname",$db);
$sql = "Select * from table where username='$admin_username'";
$result = mysql_query($sql);
if (mysql_num_rows($result) < 1) {
echo"You are not a registered Administrator.";
print("<meta http-equiv='refresh' content='3; url=index.php'>");
exit;
}else{
while ($row = mysql_fetch_array($result)) {
$password1 = $row['password'];
$id = $row['admin_id'];
}
}
if($admin_password != $password1){
echo"Your password is invalid. Check and login again";
print("<meta http-equiv='refresh' content='3; url=index.php'>");
exit;
}else{
Session_start();
Session_register('$id');
include("adminmain.inc");
exit;
}
}
include("indexform.inc");
?>
---------indexform.inc------------
<form method="POST" action="index.php">
<div align="center">
<table border="1" width="61%" cellspacing="0" cellpadding="0">
<tr>
<td width="17%">Username</td>
<td width="83%"><input type="text" name="admin_username" size="30"></td>
</tr>
<tr>
<td width="17%">Password</td>
<td width="83%"><input type="password" name="admin_password" size="30"></td>
</tr>
<tr>
<td width="100%" colspan="2"><input type="submit" value="Login Now!" name="login"></td>
</tr>
</table>
</div>
</form>
------end indexform.inc-----------
Hope this helps! I have done hundreds of these. Mostly they look the same with a few other additions added in. Start a session after they log in is a great idea! It will save you from setting a frikin' cookie! I hate those and so does your clients/customers.
Hope it helps!
Chad