NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page do I always have to do session_start()???

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 06-01-2006, 02:42 PM THREAD STARTER               #1 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



do I always have to do session_start()???


Do I always have to do session_start, even on pages I don't want to use any session variables? Will it still remember all the variables?

Thanks
Tom
PoorDoggie is offline  
Old 06-01-2006, 02:51 PM   #2 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,272
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
Hello,

You only need to really use it if you plan on calling a $_SESSION['variable'] to get what the session contains.

- Steve
__________________
I feel old.
iNod is offline  
Old 06-01-2006, 02:52 PM THREAD STARTER               #3 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



thanks - its not going to forget that variable if I don't use it though?
PoorDoggie is offline  
Old 06-01-2006, 03:38 PM   #4 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
It won't forgot them, I do not believe.. unless you did a session_destory, unset, or $_SESSION = array(); to kill it. I'm not sure, however. I've not worked w/sessions much tbh.
Eric is offline  
Old 06-01-2006, 04:06 PM THREAD STARTER               #5 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



thanks a lot - am just about to launch into a whole user script for 6yd.net. Am making a few different things for it that will run off a user database. My goodness it looks complicated though! well... wish me luck - may be back for more help later!
PoorDoggie is offline  
Old 06-02-2006, 12:42 AM   #6 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
it really depends on wether the user is using cookies or not. I beleive if the user has cookies turned off (and as such the url is appended with the session variable) then there will be no way for the server to know which session it is and will start a new 1.
Peter is offline  
Old 06-02-2006, 07:52 AM THREAD STARTER               #7 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



Originally Posted by filth@flexiwebhost
it really depends on wether the user is using cookies or not. I beleive if the user has cookies turned off (and as such the url is appended with the session variable) then there will be no way for the server to know which session it is and will start a new 1.
so if I have a session variable $_SESSION['name'] - it will append my url with:
????: NamePros.com http://www.namepros.com/programming/203279-do-i-always-have-do-session_start.html

script.php?name=filth@...???
PoorDoggie is offline  
Old 06-02-2006, 10:13 AM   #8 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



If you don't put it on the top of all pages, you will probably see some inconsistancies.
eagle12 is offline  
Old 06-02-2006, 11:17 AM THREAD STARTER               #9 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



so you are saying, put it there anyway?
PoorDoggie is offline  
Old 06-02-2006, 01:28 PM   #10 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Originally Posted by PoorDoggie
so if I have a session variable $_SESSION['name'] - it will append my url with:

script.php?name=filth@...???
no it doesnt append the url with the session variables it will append it with the session name and session id so it would look something like:-
Code:
page_name.php?sid=82cf054ebb3f3a88d9e4a4c4668cd9f7
if you look in the servers temp folder you will see a file called 82cf054ebb3f3a88d9e4a4c4668cd9f7 which stores the session variables.
????: NamePros.com http://www.namepros.com/showthread.php?t=203279

All of this of course really depends on the server configuration.
Peter is offline  
Old 06-02-2006, 03:17 PM THREAD STARTER               #11 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



oh right. So there is always a sid?

Thanks
Tom
PoorDoggie is offline  
Old 06-02-2006, 04:13 PM   #12 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
yes there is always a sid (session ID) otherwise the server would have no way of recognising which session the person is using. The url is ussually only appended IF the user has cookies disabled but this behaviour can be changed in the php.ini file (or using ini_set()
Peter is offline  
Old 06-02-2006, 05:07 PM THREAD STARTER               #13 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



oh right. Would there be any point doing that though? Would I ever need to use a session id?
PoorDoggie is offline  
Old 06-03-2006, 03:21 AM   #14 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
i take it you mean changing the behaviour of the sessions. Yes 1 possible reason is if you do not want to issue cookies.

Again if the user has cookies disabled and your server doesnt have session.use_trans_sid enabled the user will not be able to traverse your site properly if it relies on sessions.
Peter is offline  
Old 06-03-2006, 11:34 AM THREAD STARTER               #15 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



how would I get round that?

I am hosted with an external hosting company... do you think that use_trans_sid would be enabled? Is there any reason that they would turn it off?

Thanks
Tom
PoorDoggie is offline  
Old 06-04-2006, 01:42 AM   #16 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
easiest way to find out is to create a phpinfo page:-

PHP Code:
<?PHP
????: NamePros.com http://www.namepros.com/showthread.php?t=203279
phpinfo
();
?>
the chances are it is already enabled as there is no reason for a host to disable it and would cause alot of problems if they did.
Peter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 11:35 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger