Jump to content

[SOLVED] Variable contents being stored on a server?!?


stephenk

Recommended Posts

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!

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

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.