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.
Check if logged in with phpnuke
Moderator: General Moderators
-
mikegotnaild
- Forum Contributor
- Posts: 173
- Joined: Sat Feb 14, 2004 5:59 pm
Check if logged in with phpnuke
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.
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
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.mikegotnaild wrote:Well as you can see im a lazy person who modifies phpnukeim not ashamed though.
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
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
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