SirChick Posted September 1, 2007 Share Posted September 1, 2007 I think this is related to sessions lol. I have a question about it as im getting session errors all over the place and ive had 2 people who i was going to pay to fix this still couldn't work it out and concluded that my code has mind of its own but i think i might have found it but i thought id double check with you guys. This is going to a bit long winded but its the only way i can explain... Basically say i have a page as "test" This "test" has 2 includes "globalinclude" and "variableinclude" Now in "globalinclude" i have: session_Start() (globalinclude is and has to be on every page of the site) But in "variableinclude" i have the globalinclude as an include for that aswell for above reasons in bold... so is my "test" page effectively just loading the session_start() twice? Thus causing the error? This is my error but although it's self explanatory i don't have session_start() written twice any where.. so my only guess is the page is loading the one include twice because its also included on the second include lol =/ I got this on my page: <b>Notice</b>: A session had already been started - ignoring session_start() in <b>C:\xampp\htdocs\include.php</b> on line <b>2</b><br /> <br /> <b>Notice</b>: A session had already been started - ignoring session_start() in <b>C:\xampp\htdocs\include.php</b> on line <b>2</b><br /> <b>Warning</b>: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in <b>Unknown</b> on line <b>0</b><br /> If it is the double loading of the session, how else can get around that? Because the global include has to be there for it to allow the script to work... because it does a check if session has not started die and echo "you must be logged in".... I been having this problem all week so any thoughts on this is much appreciated. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 try removing session_start(); it happened to me Quote Link to comment Share on other sites More sharing options...
SirChick Posted September 1, 2007 Author Share Posted September 1, 2007 but then the include will log me out .... cos if the session is empty itll say "you must be logged in " ... and that is the only session_start(); you see? But because its include in a long strange way twice it could be reading it a second time and giving me an error you get me ? But im unsure if that would occur.. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 please paste the code Quote Link to comment Share on other sites More sharing options...
SirChick Posted September 1, 2007 Author Share Posted September 1, 2007 What all 4 includes? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 1, 2007 Share Posted September 1, 2007 Yes, it is because you are including it twice. Why not just include the one file that has both the files you need in it at the top of the page, then get rid of the include that you call on all your pages since that is already included in the other file? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 well if your getting session cache limiter your including it more than once FYI Quote Link to comment Share on other sites More sharing options...
SirChick Posted September 1, 2007 Author Share Posted September 1, 2007 Yes, it is because you are including it twice. Why not just include the one file that has both the files you need in it at the top of the page, then get rid of the include that you call on all your pages since that is already included in the other file? that is such a good point lol!!!!! I have done it but i got this still: Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 your register globals is disabled dont use those. Quote Link to comment Share on other sites More sharing options...
SirChick Posted September 1, 2007 Author Share Posted September 1, 2007 im not using them :/ dont even know what they are to start with lol Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 1, 2007 Share Posted September 1, 2007 $_REGISTER_GLOBALS= bad Quote Link to comment Share on other sites More sharing options...
SirChick Posted September 1, 2007 Author Share Posted September 1, 2007 definitely not got any of them Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 1, 2007 Share Posted September 1, 2007 Let's deal first with the Notice. It's NOT an error, it's notification in your case that your code attempts to start a session a second time. If you read the notice, you'll see that the php parser simply ignored your coding error and just advised you. Solution - don't use session_start more than once in a script, including any includes called by the script. Now let's deal with the register_globals issue. Once again it's NOT an error, it's a warning. Warning you that somewhere in your script you are using a variable without acquiring it via GET or POST (for example) and instead assuming that it existed in the global space. That used to be true in old versions of php; not anymore because register_globals is set to OFF by default. No comment on paying two people to fail to even recognize the problems given the obvious nature of the notices and warnings. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 1, 2007 Share Posted September 1, 2007 Hope you paid them in magic beans Quote Link to comment Share on other sites More sharing options...
Timma Posted September 2, 2007 Share Posted September 2, 2007 Hope you paid them in magic beans But then they get a kicking rad beanstalk, and lots of gold Quote Link to comment Share on other sites More sharing options...
SirChick Posted September 2, 2007 Author Share Posted September 2, 2007 i didnt pay them unless they knew how to fix it and they set a good price.. obviously they were probably trying to swindle me lol So the warnings are nothing to worry about then. I fixed the session part thankfully. Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 2, 2007 Share Posted September 2, 2007 ... obviously they were probably trying to swindle me lol Looks like it. So the warnings are nothing to worry about then Unfortunately not true. They're warning you of a problem which one day soon might become a real headache. Better to fix it while you're on a hot streak (and so it'll work if your host upgrades php) Quote Link to comment Share on other sites More sharing options...
SirChick Posted September 2, 2007 Author Share Posted September 2, 2007 somewhere in your script you are using a variable without acquiring it via GET or POST But thats suggesting ALL variables must be created via forms :S which cannot always be true surely, cos thats not exactly a fixable thing Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 3, 2007 Share Posted September 3, 2007 somewhere in your script you are using a variable without acquiring it via GET or POST But thats suggesting ALL variables must be created via forms ... or from cookies or from sessions or via URL links or from a database, etc. There are quite a few people who manage quite nicely without assuming globals are on. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.