\n"; echo "\n"; echo "\n"; } /* * Include database connectivity variables */ include_once "config.php"; /* * include metabase lib */ include_once(CORE_RELPATH."lib_wfw.php"); if ($perform=="login") { $aLogin=htmlentities($aLogin,ENT_QUOTES); //$aPw=htmlentities($aPw,ENT_QUOTES); $res=db_queryDatabase("select id from persons where name='$aLogin' and password='$aPw'"); db_fetchRow($res); $id=db_fetchValue($res,"id"); if ($id!=0) { mt_srand((double)microtime()*1000000); $randval = mt_rand(0,99999999); $query = "delete from logins where pid=$id"; $res=db_queryDatabase($query); $query = "insert into logins(sessionid, pid) values ('$randval', $id)"; $res=db_queryDatabase($query); setcookie("wfwSession",$randval, mktime()+2678400); echo "Login succeeded".popup("Login succeeded").""; exit; } else { echo "Login failed".popup("Login failed").""; exit; } } if ($perform=="logout") { setcookie("wfwSession","", mktime()+2678400); echo "Logout succeeded"; exit; } include ("header.php"); echo "
"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; echo "
Login:
Password:

\n"; echo "
\n"; include ("footer.php"); ?>