Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Help creating a login variable
02-17-2006, 07:05 PM #1
- Join Date
- Feb 2006
- Thanked 0 Times in 0 Posts
Help creating a login variable
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, 10:07 AM #2
// Start session before any output!
// Define session variables
$_SESSION[colour] = "red";
$_SESSION[object] = "book";
And to end the session....PHP Code:
// 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]";
// 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
Last edited by goughy000; 02-18-2006 at 10:15 AM.