Location: PHPKode > projects > Modular Site Manager > htdocs/misc/login.php
<?
chdir("../");
include "inc/functions.inc.php";
$mysql = new mysql(DB_MAIN);
$sel = $mysql->select(PRE."members", "username='".$_POST['username']."'", "id");
if(!$sel)
{
	header("Location: ".SITE_URL."?merror=notuser");
} else {
	while($c = mysql_fetch_array($sel))
	{
		if($c['active'] == "yes")
		{
			if(dohash(MY_SECRET.$_POST['password']) !== $c['password'])
			{
				header("Location: ".SITE_URL."?merror=badpass");
			} else {
				setcookie("mid", $c['id'], time()+(60*60*24*7), "/");
				setcookie("user", $c['username'], time()+(60*60*24*7), "/");
				setcookie("pass", dohash(MY_SECRET.$c['password']), time()+(60*60*24*7), "/");
				//header("Location: ".$HTTP_REFERER);
				pleasewait("login");
			}
		} else {
			header("Location: ".SITE_URL."?merror=notactive");
		}
	}
}
?>
Return current item: Modular Site Manager