Using my own database and look
smaij
Joined: 2004-02-07
Posts: 3 |
Posted: Sat, 2004-02-07 10:55 |
I tried to follow the instructions descripted on http://www.txraves.org/code/dox/embedding_gallery.php My Gallery @ the moment = http://images.kvkeistad.nl) I got stuck on the UserDB.php file i think. I can login in my own system (The header and footer do change) but I dont see any user rights. Posted below are my files @ the moment The changed bit of init.php } elseif (!strcmp($GALLERY_EMBEDDED_INSIDE, "dtw")) { include($GALLERY_BASEDIR . "classes/dtw/UserDB.php"); include($GALLERY_BASEDIR . "classes/dtw/common.inc.php"); include($GALLERY_BASEDIR . "classes/dtw/User.php"); include($GALLERY_BASEDIR . "classes/dtw/auth.inc.php"); connecttodatabase(); $gallery->userDB = new Dtw_UserDB; //$gallery->userDB = new Gallery_UserDB; global $ingelogd; $ingelogd = CheckLogin(); if ($ingelogd){ $gebruiker = $GLOBALS['HTTP_SESSION_VARS']['UserID']; $gallery->user = $gallery->userDB->getUserByUid($gebruiker); } User.php <?php class Dtw_User extends Abstract_User { /* var $username; var $fullname; var $password; var $email; var $isAdmin; var $canCreateAlbums; var $uid; */ function Dtw_User($uid = '', $username = '', $email = '', $fullname = '', $isAdmin = '', $canCreateAlbums = ''){ Abstract_User::Abstract_User(); $this->uid = $uid; $this->username = $username; $this->email = $email; $this->fullname = $fullname; $this->isAdmin = $isAdmin; $this->canCreateAlbums = $canCreateAlbums; } function load($uid) { $query = mysql_query("SELECT UserID, UserName, Naam, Emailadres FROM users WHERE UserID = '$uid'") or die(mysql_error()); if ($gebruiker = mysql_fetch_array($query)){ $this->uid = $gebruiker['UserID']; $this->username = $gebruiker['UserName']; $this->email = $gebruiker['Emailadres']; $this->fullname = $gebruiker['Naam']; $this->isAdmin = true; $this->canCreateAlbums = true; } } function loadByUserName($username){ $query = mysql_query("SELECT UserID, UserName, Naam, Emailadres FROM users WHERE UserName = '$username'") or die(mysql_error()); if ($gebruiker = mysql_fetch_array($query)){ $this->uid = $gebruiker['UserID']; $this->username = $gebruiker['UserName']; $this->email = $gebruiker['Emailadres']; $this->fullname = $gebruiker['Naam']; $this->isAdmin = true; $this->canCreateAlbums = true; } } } ?> UserDB.php <?php class Dtw_UserDB extends Abstract_UserDB { /* var $userMap; var $nobody; var $everybody; var $loggedIn; var $version; */ function Dtw_UserDB() { global $gallery; $userDir = $gallery->app->userDir; //echo $userDir; $this->version = $gallery->user_version; $this->userMap = array(); $this->rebuildUserMap(); //print_r($this->userMap); if (!$this->nobody) { $this->nobody = new NobodyUser(); } if (!$this->everybody) { $this->everybody = new EverybodyUser(); } if (!$this->loggedIn) { $this->loggedIn = new LoggedInUser(); } } function getUserByUsername($username, $level=0) { global $gallery; if (!strcmp($username, $this->nobody->getUsername())) { return $this->nobody; } else if (!strcmp($username, $this->everybody->getUsername())) { return $this->everybody; } else if (!strcmp($username, $this->loggedIn->getUsername())) { return $this->loggedIn; } $user = new Dtw_User(); return $user->loadByUserName($username); } function getUserByUid($uid, $tryOldFormat=false) { global $gallery; if (!$uid || !strcmp($uid, $this->nobody->getUid())) { return $this->nobody; } else if (!strcmp($uid, $this->everybody->getUid())) { return $this->everybody; } else if (!strcmp($uid, $this->loggedIn->getUid())) { return $this->loggedIn; } $user = new Dtw_User(); return $user->load($uid); } function getUsername($uid) { return $this->userMap[$uid]; } function getUid($username) { return $this->userMap[$username]; } function rebuildUserMap() { global $gallery; $userDir = $gallery->app->userDir; $this->userMap = array(); /* foreach ($this->getUidList() as $uid) { $tmpUser = $this->getUserByUid($uid); $username = $tmpUser->getUsername(); $this->userMap[$username] = $uid; $this->userMap[$uid] = $username; } */ $query = mysql_query("SELECT UserID, UserName FROM users") or die(mysql_error()); while ($arrayuid = mysql_fetch_array($query)){ $username = $arrayuid['UserName']; $uid = $arrayuid['UserID']; $this->userMap[$username] = $uid; $this->userMap[$uid] = $username; } return safe_serialize($this, "$userDir/userdb.dat"); } function getUidList() { global $gallery; $uidList = array(); $query = mysql_query("SELECT UserID FROM users") or die(mysql_error()); while ($arrayuid = mysql_fetch_array($query)){ array_push($uidList, $arrayuid['UserID']); } array_push($uidList, $this->nobody->getUid()); array_push($uidList, $this->everybody->getUid()); array_push($uidList, $this->loggedIn->getUid()); sort($uidList); return $uidList; } } ?> I hope somebody is able to understand my problem and can help me. |
|
Posts: 3
This night I was looking @ this again and somehow I saw the wrong code:
Wondering why i made this fault... I dont know...
Well.. Now that is done, I'm wondering how i can get Gallery Remote working.
I tried this:
Username: smaij
Password: ************
Gallery Type: PhpNuke
PhpNuke login module: http:// images.kvkeistad.nl/login2.php?login=1&Naam=$USERNAME$&Password=$PASSWORD$
Gallery Module name: http:// images.kvkeistad.nl/$GALLERYFILE$
Now i;m wondering if somebody could tell me what the loginscript should contain so the gallery knows i;m logged in or not.
Posts: 3
Ok.. I'm trying to get gallery remote working. But the things I dont know
Is de password md5 before submitting???
Wich file do I need to recode? (gallery_remote.php OR gallery_remote2.php)
I'm working with the newest Gallery Remote Software!
I tried gallery_remote and gallery_remote2 both.
1
2
Posts: 3
I am having the exact same problem that smaij had in his first post but have no clue what he did to fix what ever the problem was in the second post. If someone could help me out here i would greatly appreciate it.
Thanks.