Jump to content

[SOLVED] Accessing POST Variables


JaredKnapp

Recommended Posts

I have a PHP site written by someone else that has been running for a long time. Unfortunately, I need to move this site to a new server. One of the interesting features of this site is that when a form is submitted, the Action PHP page has access to the $ variables from the form.

 

For example, the field

 

<input type='text' name='firstname' />

 

results in a field called

 

$firstname

 

This is not working on the new site. Does anyone know how this could be working on the old site? What do I need to do or install to make this work?

Link to comment
Share on other sites

I think that's it!

 

The site is working on the old server, and is not working on the new server. The code is exactly the same.

 

Magically (I SWEAR) the variables appear without being set. They are just there for use.

 

I'll test, and see what happens....

 

Thanks for all the responses.

Link to comment
Share on other sites

The code is dependent on register_globals being on to "magically" populate program variables from post data. Unfortunately, register_globals were a huge security blunder and allowed session variables to also be magically set to values that hackers put on the end of urls as get data. Register_globals were turned off 6 years ago. No code written after 2002 should have relied on register_globals. Register_globals have been completely removed in upcoming php6.

 

To fix this you will need to modify the code to set your program variable from the  correct $_POST['firstname'] variable where the data is actually at -

 

$firstname = $_POST['firstname'];

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.