LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 12-28-2002, 06:11 PM   #1
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Rep: Reputation: 30
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
 
Old 12-28-2002, 06:18 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,762
Blog Entries: 4

Rep: Reputation: 78
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.
 
Old 12-28-2002, 06:36 PM   #3
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Original Poster
Rep: Reputation: 30
thanks bulliver
 
Old 12-28-2002, 08:39 PM   #4
nxny
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: Reputation: 30
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.
 
Old 02-02-2003, 03:20 PM   #5
anilpujara
LQ Newbie
 
Registered: Feb 2003
Posts: 1

Rep: Reputation: 0
Question 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.
 
Old 02-02-2003, 04:21 PM   #6
nxny
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: Reputation: 30
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP on redhat cjw0367 Programming 1 04-17-2005 02:21 PM
PHP on Redhat 9 webcookie Red Hat 1 06-08-2004 10:06 PM
Redhat and PHP 4.3.2 Cynthia Blue Linux - Newbie 1 07-14-2003 12:53 PM
PHP + redhat jakublgz Linux - General 4 05-28-2002 09:55 AM
redhat 7 + php 4.0.1 gogo Linux - Software 0 05-02-2001 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration