![]() |
|
#1
|
|||
|
|||
About PHP SessionTo whom it may concern;
I have been building my web site with PHP and MySQL. This is the first time to utilize PHP programming. I started to work out LOGIN logics but I have got a problem with SESSION use. I followed the instruction of a textbook..but I keep getting the following trouble. Login page -> Works fine (Storing Variables to SESSION) :-P 1st page (1st time) -> Works fine (Variables are kept in SESSION) :-P 1st page (2nd time) reflesh -> Works..but Variables are gone! Vanished! 2nd page (But the same SESSION ID are used) I really got confused about this strange behavior of variables. Somebody, please give me any advice. Fumichika ;-) |
|
#2
|
|||
|
|||
|
1. Are you using sessions ni files or database ?
2. If the variables are gone then I guess in the first page the Variables are not written to sessions. Try doing print_r($_SESSION); where you feel the variables are vanishing. Might as well do each time to write variable to check if its actually written. |
|
#3
|
|||
|
|||
ThanksThank you for your help.
1. I can't see php.ini file, but I think that it's stored in files. 2. Variables are surely stored in Session on the first page from login page. 3. I used echo("") instead to check it. Session will vanish after moving to other pages from the first page. Fumichika Quote:
|
|
#4
|
|||
|
|||
|
That is really not possible. If stored one page then it can be retrieved from another.
using print_r($_SESSION) you can see all session variables. |
|
#5
|
|||
|
|||
ThanksSo..I'm having a trouble to solve this problem.
I checked it with 'registered' function..but the first page from login page returns 'true'.. but the second page from the first page returns 'false'. I am sure I didn't unset registered variables... ID remains the same. ????? Quote:
|
|
#6
|
|||
|
|||
|
Oh. Then.
Open C:\Windows\php.ini or C:\Winnt\php.ini Search for register_globals = Ignore the ones that have ; in front - those are just comments. If you find anywhere register_globals = Off then change to register_globals = On |
|
#7
|
|||
|
|||
|
I don't see the php.ini file in directories since I'm borrowing provider's server.
I'm using some of functions to change default setting. I read that it's not good to set register_globals ON due to security reasons. Is that true? |
|
#8
|
|||
|
|||
|
Whats in the sessions table ? You'll see this using phpinfo();
|
|
#9
|
|||
|
|||
Register_GlobalsThanks. I tried {ini_set("register_globals", 1)},
but the problem remains the same. Quote:
|
|
#10
|
|||
|
|||
|
If you are changing the name of the cookie for the PHP sessions, make sure that you are doing that for all your pages. I made that mistake, and inadvertently had two sessions open. Oops. If that is okay, make sure that all of your if statements have two == for comparisons.
Otherwise you may want to post your code. |
Recent GIDBlog
A Week in Kuwait by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help ! I need help starting up on Php ! | onauc | MySQL / PHP Forum | 11 | 04-Jan-2005 23:57 |
| uisng php to display php | dopee | MySQL / PHP Forum | 6 | 14-May-2004 18:40 |
| php software | dopee | MySQL / PHP Forum | 0 | 04-May-2004 11:26 |
| [script] Password Protect web pages/site using PHP and MySQL | JdS | PHP Code Library | 0 | 23-Jul-2003 10:02 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 16:14 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The