View Full Version : Help creating a login variable

02-17-2006, 08:05 PM
Need a little direction here.. Basically, what I'm trying to do is:

1. Have people log in to my website using a login page with an ID# (which they already know>

2. The ID# needs to be stored as a variable for use on the following page, where it will be included as a hidden field in a form the person will be submitting for inclusion in a MySQL DB

3. This whole thing will be hosted on a kiosk, so I need two things to happen. The variable needs to be reset (cleared, whatever..) on a certain inactivity timeout period, or at the completion of the session (which will be activited by clicking an "exit" button).

I'm pretty well versed in PHP, HTML, etc., it's more a matter of figuring out the best way to store this variable for later use, and then having it reset at a certain point so the next user can start from scratch. Any help in the right direction is greatly appreciated!!!

02-18-2006, 11:07 AM


example code..


// Start session before any output!

// Define session variables
$_SESSION[colour] = "red";
$_SESSION[object] = "book";


<a href="page2.php">GO!</a>



// Start, well "resume", the session (before any output)

// Session variables not defined on this page but carried over from last page
echo "oh look a $_SESSION[colour] $_SESSION[object]";


And to end the session....

// Load session

// Kill session

Also adding to that...

Calling this code BEFORE session_start(); you can set how long the session should last (in minutes) before being ended... I think you would either be able to put this on every page to update it to say.. 30mins.. every new page, or just on the first page. But you might have to call it on every page, never used it before