Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Function return false?

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
SpaceshipSpaceship
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
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
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back