sepoto Posted May 9, 2011 Share Posted May 9, 2011 <?php session_start(); if(!$_SESSION('logged_in')) { echo "No user logged in."; } else { echo "User logged in."; }?> Firstly I would like to check if a session is started yet before I call session_start(); but I don't know how to do that yet. Secondly when I am running this code $_SESSION('logged_in') is not defined yet which is as it should be however my code keeps turning up this error. Fatal error: Function name must be a string in C:\inetpub\wwwroot\dsg\login.php on line 3 I can't seem to figure out why this error is coming up. Link to comment Share on other sites More sharing options...
birbal Posted May 9, 2011 Share Posted May 9, 2011 Fatal error: Function name must be a string in C:\inetpub\wwwroot\dsg\login.php on line 3$_SESSION('logged_in') here $_SESSION is an associative array which will have something like $_SESSION['logged_in']Firstly I would like to check if a session is started yet before I call session_start();session starts only after session_start() if there is a active session passed it will resume to that session else it will start a new one. Link to comment Share on other sites More sharing options...
sepoto Posted May 9, 2011 Author Share Posted May 9, 2011 $_SESSION('logged_in') here $_SESSION is an associative array which will have something like $_SESSION['logged_in']session starts only after session_start() if there is a active session passed it will resume to that session else it will start a new one.You are a great help. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.