Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-28-2002, 06:11 PM
|
#1
|
Member
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992
Rep:
|
php in RedHat 8.0
test.html
*******
<html>
<form action=test.php method=post>
<input type=text name=memname value="hello">
</form>
</html>
test.php
********
<?php
print $memname;
?>
this prints
hello
in RH 7.2
but in Rh 8.0 doesn't print anything.
what is the reason
|
|
|
12-28-2002, 06:18 PM
|
#2
|
Senior Member
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,762
Rep:
|
The version of php in redhat 8 has the "register_globals" directive in php.ini is set to "Off" by default for security reasons. You can change this in php.ini or better yet register your global variables manually.
|
|
|
12-28-2002, 06:36 PM
|
#3
|
Member
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992
Original Poster
Rep:
|
thanks bulliver
|
|
|
12-28-2002, 08:39 PM
|
#4
|
Member
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771
Rep:
|
As bulliver said, the register_globals have been turned off by default so that malicious users wont be able to override your globals by passing them through the URL.
I would keep the settings that way and start accessing get and post variables by being more explicit $_GET["varname"] or _POST["memname"] in the above example.
|
|
|
02-02-2003, 03:20 PM
|
#5
|
LQ Newbie
Registered: Feb 2003
Posts: 1
Rep:
|
POST with FORMS in PHP with Linux 8.0
Thank you for all assistance in advance.
I have been having some problems with the PHP in Linux 8.0 It seems that RH's newest version seems awfully buggy and it is very hard on us programmers. I fixed the register_globals to On so that I can access the FORM elements with just the dollar sign. For example,
<FORM ACTION="admin.php" METHOD="POST">
<INPUT TYPE="text" NAME="password">
</FORM>
In the PHP file, to echo it out it would be:
<?
echo $password;
?>
Usually it will work and print out what the user had in that box. However, instead it prints this (if the user entered "chris" in the password box):
chrispassword=chris
It seems that it does get the value that was entered, but adds the "password=chris".
How do I fix this problem? Even if I use the $_POST, and $_GET commands, it still dosn't fix the problem.
|
|
|
02-02-2003, 04:21 PM
|
#6
|
Member
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771
Rep:
|
Re: POST with FORMS in PHP with Linux 8.0
Welcome to LQ!!
Quote:
I have been having some problems with the PHP in Linux 8.0 It seems that RH's newest version seems awfully buggy
and it is very hard on us programmers
|
Hehe. Think positive. Thats a good way to start. What other 'bugs' have you found on RH 8.0? Did you buy this software? Have you tried reaching RH support if you did? What else do you program?
Quote:
I fixed the register_globals to On so that I can access the FORM elements with just the dollar sign.
|
What you've just done is *NOT* a fix. You have *DISABLED* a security feature that prevents a malicious user from guessing your global scope variables and overwriting them by injecting variables into the URL. Please try and understand that if some things have changed, they have changed for a *REASON*
Quote:
For example,
<FORM ACTION="admin.php" METHOD="POST">
<INPUT TYPE="text" NAME="password">
</FORM>
In the PHP file, to echo it out it would be:
<?
echo $password;
?>
|
If you have register_globals on - assuming you have PHP setup correctly - it will work. At this point, reading some documentation will be worthwhile.
Quote:
Usually it will work and print out what the user had in that box. However, instead it prints this (if the user entered "chris" in the password box):
chrispassword=chris
|
Double check your files. There something you're missing here.
Quote:
How do I fix this problem? Even if I use the $_POST, and $_GET commands, it still dosn't fix the problem.
|
using $_POST["password"] is the preferred way to access the POSTed variable.
|
|
|
All times are GMT -5. The time now is 03:06 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|