//check for POST data indicating a form submission session_start(); if($_POST[submit]==='Y') { //check to see if the username and authcode match a profile in the 'database' $found=true; $profiles=parse_ini_file('./database/personneldata.ini',true); $found=false; foreach($profiles as $key => $p) { if($p['name']==$_POST['officer']) { $profilekey=$key; $found=true; } } if($found) { if(md5($_POST['authcode'])==$profiles[$profilekey][authcode] AND $profiles[$profilekey][active]==1) { $_SESSION['key']=$profilekey; $_SESSION['logon_time']=time(); $_SESSION['id']=SID; $_SESSION['access']=$profiles[$profilekey]['access']; header("Location: admin.php"); } elseif(md5($_POST['authcode'])!=$profiles[$profilekey][authcode]) { //bad authcode print("You have submitted an invalid authcode. Please try again or contact the webmaster for assistance."); } elseif($profiles[$profilekey][active]!==1) { print("Your account has been locked out or disabled. Please contact the webmaster for assistance."); } } else { print("A profile for '$_POST[officer]' was not found! Please contact the webmaster for assistance! "); } } else { //do the normal login page page $title=$loc[0]='Administration'; //page title for the browser goes here include('includes/header.php'); ?>