anujphp Posted December 20, 2008 Share Posted December 20, 2008 Hello the below code i got in forum to check where a user is logged in or not <?php if (isset($_SESSION['session_name_here'])) { // Code to be run here } ?> can anyone tell me what is this session_name_here means... in my login page i am not giving any name to the session i am starting the session and saving name and other data in variable.. does this means the name i save in variable or it is that i can give a name to session like we give to a function THANK YOU IN ADVANCE Quote Link to comment Share on other sites More sharing options...
lanmonkey Posted December 20, 2008 Share Posted December 20, 2008 thats the name of a variable to be stored in the session. $username = "bill gates" $_SESSION['username'] = $username; read this: http://www.w3schools.com/PHP/php_sessions.asp Quote Link to comment Share on other sites More sharing options...
anujphp Posted December 21, 2008 Author Share Posted December 21, 2008 THANK YOU LANMONKEY the link is great..thanks once again Quote Link to comment Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 While your into sessions look at this example bit off a mind blower i say. this is a session created with a array but now you got 3 session's set. <?php session_start(); $x=array("john"=>"Has a big bike","paul"=>"has got a color tv","kevin"=>"has a motor bike"); foreach($x as $key=>$val){ $_SESSION['username'][$key]=$val; echo " $key ".$_SESSION['username'][$key]."<br><br> "; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.