stephenk Posted June 25, 2007 Share Posted June 25, 2007 I have been working on a script and it worked perfectly on my local server. However when I uploaded it I had problems due to a few variables acting strangely. Eventually i deleted all the script's contents and entered this: <?php echo $variable; ?> and I found that, when uploaded and ran, it returned the contents that I had set when running the full script earlier. I have now gone to the point of declaring all variables for the script using $variable=""; ... etc at the start. Has anyone had experience of this happening before? It took me about 30 mins to finally debug what was happening! Stephen Edit: sorry, just realised I posted in the mysql forum, please move it to the PHP one if necessary! Quote Link to comment Share on other sites More sharing options...
per1os Posted June 25, 2007 Share Posted June 25, 2007 Is register_globals on? Quote Link to comment Share on other sites More sharing options...
stephenk Posted June 25, 2007 Author Share Posted June 25, 2007 They are, yeah. I thought register_globals only meant anything when using $variable instead of $_GET['variable']? When I run the script saying $variable="" ..., then run a script saying echo $variable it still returns the contents from ages ago. :S Stephen Quote Link to comment Share on other sites More sharing options...
Wildbug Posted June 25, 2007 Share Posted June 25, 2007 Are you using sessions? Quote Link to comment Share on other sites More sharing options...
stephenk Posted June 25, 2007 Author Share Posted June 25, 2007 Nope, no sessions or cookies. I closed the firefox tab and re-opened. Now it's back to normal. However I don't think that doing that would have cleared the session cookie, even if it was set. It seems so strange! Quote Link to comment Share on other sites More sharing options...
per1os Posted June 25, 2007 Share Posted June 25, 2007 register_globals would be what is jacking it up if you ask me. Because if $variable is some type of a cookie or session etc inadvertently it will be assigned that value each time the page is reloaded. I highly suggest turning off register_globals, that is a huge security breach. The thing that should be key is that you closed the tab in FF and re-opened and viola it was back to normal, that usually means it is a session issue of some type. Quote Link to comment Share on other sites More sharing options...
stephenk Posted June 25, 2007 Author Share Posted June 25, 2007 I have now spotted the problem, and yeah, its to do with register_globals. It's because I'm using a POST HTML name the same as a variable name, just for convenience within the script. What a nightmare. Thanks for helping me find the problem. Stephen 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.