Please forgive the newbie code....I know its not very clean, but it works fine on most machines...
<?php
// Check to see if valid login
$try = $_POST["user_alias"];
$db = mysql_connect("localhost", "psvanvic", "*****");
mysql_select_db("******",$db);
$result = mysql_query("SELECT FROM ********",$db);
while ($temprow = mysql_fetch_row($result)){
if($temprow[2] == $try) {
setcookie ("userfamily",$temprow[3],time()+3600);
setcookie ("usernamefirst",$temprow[0],time()+3600);
setcookie ("usernamelast",$temprow[1],time()+3600);
setcookie ("useralias",$temprow[2],time()+3600);
setcookie ("useraccess",$temprow[5],time()+3600);
setcookie ("usersanta",$temprow[4],time()+3600);
$tempname=$temprow[0].' '.$temprow[1];
$tempfamily=$temprow[3];
$found=1;
if($temprow[5]==1)
{$superuser=1;}
}
}
// If not, kick back to login page
if($found==0){
$link="index.php";
$text="Not a valid Elf Id, Try to Login Again";
printf('<a href="%s">%s</a>',$link,$text);
}
// If good, present menu
if($found==1)
{
$sql = "INSERT INTO santaserver_log (Alias,time_on,date_col,Family,agentinfo,agenthost) VALUES ('$tempname','$temptime','$tempdate','$tempfamily','$HTTP_USER_AGENT','$REMOTE_ADDR')";
$result = mysql_query($sql);
printf('<meta http-equiv="refresh" content="1;url=main.php">');
}
?>