Unstoppable Domains

Function return false?

Spacemail by SpaceshipSpacemail by Spaceship
Watch

iNod

Eating PieVIP Member
Impact
66
Hello,

I have a dilemma. You see I need a function (logged) to return false if session admin isn't set.

Here is the code

PHP:
function logged() {
    if(session_is_registered('admin')) {
    }
}

Pretty much I want the function to return false is session admin isn't registred.

How would I go about doing this I try many different things including return true;/false and things.

iNod
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
The following should do what you want.

PHP:
function logged() {
    if(session_is_registered('admin'))
    {
         return true;
    }
    else
    {
         return false;
    }
}

just in case you was not aware there should be no quotes around true and false.
 
Last edited:
0
•••
Id also like to add.

Doing this function, logged(), make sure you challege the username/password to the ones in the database or wherever you have it stored. this way you wont have people spoofing the session to gain access.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back