![]() |
|
zenphoto for bbPress - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: zenphoto for bbPress (/thread-1222.html) |
zenphoto for bbPress - Null - 2007-02-28 Hi, I am planning to convert zenphoto into a plugin for bbPress (bbpress.org). To start this I want to know if the following is possible: Is it possible to use bbPress's users, admins and passwords instead of zenphotos one? And if so, how? Thx zenphoto for bbPress - trisweb - 2007-02-28 Sure, why not? zp_auth.php contains the auth logic, just use bbpress's functions instead and set the appropriate variable. :-) zenphoto for bbPress - beoba - 2007-03-01 I'd recommend posting a wiki article describing how this can be done. Could be a useful feature for potential users. zenphoto for bbPress - demosthenes705 - 2007-03-01 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'])) { $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 |