Welcome visitor
* Login
* Register
It is currently March 23rd, 2019, 8:21 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Server Side » PHP



Post new topic Reply to topic  [ 4 posts ] 
Author Message
  variable on many pages
PostPosted: February 7th, 2009, 10:29 pm 
User avatar

Posts: 61
Good day everybody,

what im doing now is building a system, with users, passwords and all of that. Now, what i can do, so when the user has logged in, he could surf through all the wibsite and remain logged in, how would you do that?


Top
 Profile  
 
  Re: variable on many pages
PostPosted: February 7th, 2009, 10:42 pm 
User avatar

Posts: 48
u can use the url to send a value, like to validate that the usser has logged in, or, more pro, u may use session variables


Top
 Profile  
 
  Re: variable on many pages
PostPosted: February 7th, 2009, 11:19 pm 
User avatar

Posts: 61
Thanks for your comment, now, can you talk a bit more about the sessions, please?


Top
 Profile  
 
  Re: variable on many pages
PostPosted: February 7th, 2009, 11:20 pm 
User avatar

Posts: 48
a session variable is a variable that can be used on any page that share the session, and it will be stored as long as the session is not destroyed or the browser is closed. you can also set time for this kind of variables.
session_start(); //this is to open the session, and should be on every page that uses the session
$_SESSION['x'] = value; //the 'x' session variable, as you see, is stored on the $_SESSION array
session_destroy(); //this line destroys the session, you may use a function to call it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

FORUMS » Server Side » PHP


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron