Unstoppable Domains โ€” Expired Auctions

Function return false?

NamecheapNamecheap
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.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
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 TransferDynadot โ€” .com Transfer
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Zero Commission
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back