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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.