Thread: My Login Script
View Single Post
Old 10-05-2012, 12:41 PM   PM User | #21
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,500
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by Feerick11 View Post
The session would of kept that alive
No it wouldn't. $stat would be forgotten as soon as the script ended.

To use a session, anything you want remembered between scripts must be put into the $_SESSION array. I've made this clear more than once to you yet you seem to do anything but accept it.

Quote:
Originally Posted by Feerick11 View Post
But now I have to use session variables. Is that correct?
No it's not correct. You've ALWAYS had to use session variables it's just that you have not been doing so. If you go back and read my previous replies you will see I have been telling you this multiple times.

Normal variables that you use (eg $User or $stat) were never remembered by sessions. They were available in other files that you might include() or require() but not between scripts on different urls and http calls.

Anything you want remembered between two scripts that are at different urls must go into the $_SESSION array. I've given you a basic code sample above so please use it! It isn't hard, just a call to session_start() in your script and then use the $_SESSION array just like any other array. It's really easy to do
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote