I can show you how I did it. What I did was check to see if the username posted matched the admin user/pass. if it did not I checked the database for the user, if it existed i check the make sure the passwords matched. If they matched I set the admin cookie that is set if the admin user/pass originally match. the thing is that you have to set that cookie using the admin/pass in the config file so I did something along the lines of...
` if (isset($_POST['login']) && isset($_POST['user']) && isset($_POST['pass'])) {
And you see that i have the session `$_SESSION['notReallyaAdmin']` that is set because I have more menus being worked on and I don't want the user to see those tabs. You can remove that if need be. If you need help I can probably help
Comments
` if (isset($_POST['login']) && isset($_POST['user']) && isset($_POST['pass'])) {
$user = $_POST['user'];
$pass = $_POST['pass'];
$adminUser = zp_conf("adminuser");
$adminPass = zp_conf("adminpass");
$redirect = $_POST['redirect'];
if ($user == $adminUser){
if ($pass == $adminPass) {
setcookie("zenphoto_auth", md5($adminUser.$adminPass), time()+5184000, $cookiepath);
$_zp_loggedin = true;
$_SESSION['notReallyAdmin'] = false;
// FIXME: Breaks IIS
if (!empty($redirect)) { header("Location: " . FULLWEBPATH . $redirect); }
}
} else {
$userLogin = mysql_query("SELECT * FROM ".prefix(users)." WHERE `username` = '$user'") or die(mysql_error());
$userExist = mysql_num_rows($userLogin);
$password = md5($pass);
if (($userExist) == 1){
$userArray = mysql_fetch_array($userLogin);
if (($password) == $userArray['password']){
$_SESSION['notReallyAdmin'] = true;
setcookie("zenphoto_auth", md5($adminUser.$adminPass), time()+5184000, $cookiepath);
$_zp_loggedin = true;
// FIXME: Breaks IIS
if (!empty($redirect)) { header("Location: " . FULLWEBPATH . $redirect); }
//Breaks IIS
}
}else{
// Clear the cookie, just in case
setcookie("zenphoto_auth", "", time()-368000, $cookiepath);
$error = true;
}`
And you see that i have the session `$_SESSION['notReallyaAdmin']` that is set because I have more menus being worked on and I don't want the user to see those tabs. You can remove that if need be. If you need help I can probably help