SunQuest
 
           General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 30th, 2003, 12:03 PM
ZieST ZieST is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 ZieST User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Passing variables in URL

Hi,

When i run the following php script on my local machine it doesn't pass the variables in the URL but it will do it on my server. I am currently running Apache and mySQL locally. This is just a small example to show what the problem is.

<html>
<head>
<title>Dev Page</title>
</head>
<body>
<font face="Arial" size=2>
<?php
if(isset($add)) { // if the user wants to the database
?>

<form action="index.php" method="POST">
<p>Type your text here:<br>
<textarea name="text" rows="10" cols="40" wrap></textarea><br>
<input type="submit" name="submit_text" value="SUBMIT"/>
</p>
</form>

<?php
} else { // default page display
echo ("<p><a href='index.php?add=1'>Add some text</a></p>");
}
?>
</font>
</body>
</html>

Could anyone tell me why this is happening?

Thanks

Reply With Quote
  #2  
Old January 30th, 2003, 01:09 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
Its passing - you just need to retrieve the values the proper way. Your local machine is set with register_globals 'off' while your remote machine is set with register_globals 'on'. Retrieve your variables in both cases using ->
PHP Code:
if ( isset( $_GET['add'] ) ) 

You would obviously use the correct global, ie: $_GET, $_POST, $_COOKIE, $_ENV, $_REQUEST...
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #3  
Old January 31st, 2003, 05:31 AM
garethr garethr is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Newcastle upon Tyne, UK
Posts: 7 garethr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am just coming across this register_globals option. I had in switched on on my home Linux setup by default but then ported something to an online service and had to modify the httpd.conf file to get the scripts to work.

I have been told that its a security feature.

What are the pro's and cons of turning register_globals on?

Any advice much appreciated

Thanks

Reply With Quote
  #4  
Old January 31st, 2003, 11:12 AM
ZieST ZieST is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 ZieST User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The one feature of PHP that can be used to enhance security is configuring PHP with register_globals = off. By turning off the ability for any user-submitted variable to be injected into PHP code, you can reduce the amount of variable poisoning a potential attacker may inflict. They will have to take the additional time to forge submissions, and your internal variables are effectively isolated from user submitted data.

While it does slightly increase the amount of effort required to work with PHP, it has been argued that the benefits far outweigh the effort.

Just an extract from the php manual.


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Passing variables in URL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway