PHP - Fatal error: Call to undefined function session_is_registered() in /homepa

can anyone help me with this code? I only started using php three days ago and all that i have read i think I’ve go the gist of things. Doesn’t seem to be as complicated as I thought. But i’ve been stuck on this one thing…

//if no session set, redirect

//start the session
session_start();

//check to make sure the session variable is registered
if(!session_is_registered(‘username’)){

//the session variable is registered, the user is allowed to see anything that follows

header( “Location: members.html” );

}
Can anyone help me?
All’s i get is:

Fatal error: Call to undefined function session_is_registered() in /homepages/14/d471312818/htdocs/check_login.php on line 8

In my browser… I’ve tried different soultions without any luck… Any help shall be appreciated.

Thanks
Bones

session_is_registered is no longer valid, you’re probably using php 5.4 or greater.

http://php.net/manual/en/function.session-is-registered.php

Replace:

[php]if(!session_is_registered(‘username’)){[/php]

with:

[php]if(!isset($_SESSION[‘username’])){[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service