Page 1 of 1
Check if logged in with phpnuke
Posted: Tue Mar 16, 2004 2:16 pm
by mikegotnaild
Well as you can see im a lazy person who modifies phpnuke

im not ashamed though.
Anyway If anyone has expirience with it. How do i check weather someone is logged in or not. than if not it takes them to the register/or login page. Because I have download links and i want to make a page to check weather they are logged in or registered or not before they can download it. than if they are registered and logged in it redirects them to the download link but if they arent registered or logged in it takes them to either login or register page.
Re: Check if logged in with phpnuke
Posted: Tue Mar 16, 2004 2:24 pm
by TheBentinel.com
mikegotnaild wrote:Well as you can see im a lazy person who modifies phpnuke

im not ashamed though.
And you shouldn't be ashamed! Good programmers are lazy, they don't duplicate code or over-complicate things. They don't store the same data in two places. Lots of good programming practice comes from laziness.
There's a phpNuke web site with docs and forums where you'll probably have more success, though:
http://www.phpnuke.org/
Posted: Tue Mar 16, 2004 3:39 pm
by mikegotnaild
I believe this is it..? The validation
// session id check
if ($sid == " || $sid != $userdata['session_id'])
{
message_die(GENERAL_ERROR, 'Invalid_session');
}
Posted: Tue Mar 16, 2004 3:59 pm
by PrObLeM
this is what i do...
it returns true if they are loged in and false if they are not
also you can use it to get thier uid and stuff
Code: Select all
function uid() //returns the pn_uid of the logged in user
{
connect();
$uid_query = mysql_query("SELECT pn_uid FROM nuke_session_info WHERE pn_sessid='".$_COOKIE['POSTNUKESID']."'");
$uid_row = mysql_fetch_object($uid_query);
return $uid_row->pn_uid;
}
function loggedIn()//makes sure they are logged in
{
if(uid()>0)
{return true;}
else
{return false;}
}
Posted: Tue Mar 16, 2004 4:08 pm
by mikegotnaild
THANKS!
Posted: Tue Mar 16, 2004 4:13 pm
by PrObLeM
Doh!....i thought it said post nuke...my bad....im sure they are pretty close anyways you sould get the idea
Posted: Tue Mar 16, 2004 4:26 pm
by mikegotnaild
yea instead of uid its sid.. i think
Posted: Tue Mar 16, 2004 4:27 pm
by PrObLeM
ok