Check if logged in with phpnuke

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikegotnaild
Forum Contributor
Posts: 173
Joined: Sat Feb 14, 2004 5:59 pm

Check if logged in with phpnuke

Post 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.
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: Check if logged in with phpnuke

Post 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/
mikegotnaild
Forum Contributor
Posts: 173
Joined: Sat Feb 14, 2004 5:59 pm

Post by mikegotnaild »

I believe this is it..? The validation

// session id check
if ($sid == " || $sid != $userdata['session_id'])
{
message_die(GENERAL_ERROR, 'Invalid_session');
}
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post 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;}
}
mikegotnaild
Forum Contributor
Posts: 173
Joined: Sat Feb 14, 2004 5:59 pm

Post by mikegotnaild »

THANKS!
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

Doh!....i thought it said post nuke...my bad....im sure they are pretty close anyways you sould get the idea
mikegotnaild
Forum Contributor
Posts: 173
Joined: Sat Feb 14, 2004 5:59 pm

Post by mikegotnaild »

yea instead of uid its sid.. i think
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

ok
Post Reply