GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Mar-2005, 15:01
Fummy74 Fummy74 is offline
New Member
 
Join Date: Mar 2005
Posts: 7
Fummy74 is on a distinguished road
Question

About PHP Session


To 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  
Old 27-Mar-2005, 06:42
anjanesh anjanesh is offline
New Member
 
Join Date: Mar 2005
Location: Mumbai, India
Posts: 16
anjanesh is on a distinguished road
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  
Old 28-Mar-2005, 16:16
Fummy74 Fummy74 is offline
New Member
 
Join Date: Mar 2005
Posts: 7
Fummy74 is on a distinguished road

Thanks


Thank 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:
Originally Posted by anjanesh
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.
  #4  
Old 28-Mar-2005, 19:31
anjanesh anjanesh is offline
New Member
 
Join Date: Mar 2005
Location: Mumbai, India
Posts: 16
anjanesh is on a distinguished road
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  
Old 28-Mar-2005, 21:05
Fummy74 Fummy74 is offline
New Member
 
Join Date: Mar 2005
Posts: 7
Fummy74 is on a distinguished road

Thanks


So..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:
Originally Posted by anjanesh
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.
  #6  
Old 28-Mar-2005, 22:05
anjanesh anjanesh is offline
New Member
 
Join Date: Mar 2005
Location: Mumbai, India
Posts: 16
anjanesh is on a distinguished road
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  
Old 29-Mar-2005, 02:28
Fummy74 Fummy74 is offline
New Member
 
Join Date: Mar 2005
Posts: 7
Fummy74 is on a distinguished road
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  
Old 29-Mar-2005, 03:04
anjanesh anjanesh is offline
New Member
 
Join Date: Mar 2005
Location: Mumbai, India
Posts: 16
anjanesh is on a distinguished road
Whats in the sessions table ? You'll see this using phpinfo();
  #9  
Old 31-Mar-2005, 02:25
Fummy74 Fummy74 is offline
New Member
 
Join Date: Mar 2005
Posts: 7
Fummy74 is on a distinguished road

Register_Globals


Thanks. I tried {ini_set("register_globals", 1)},
but the problem remains the same.





Quote:
Originally Posted by anjanesh
Whats in the sessions table ? You'll see this using phpinfo();
  #10  
Old 31-Mar-2005, 14:32
tycooner tycooner is offline
New Member
 
Join Date: Mar 2005
Location: Canada
Posts: 19
tycooner is on a distinguished road
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 GIDBlogNot selected for officer school by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 19:14.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.