LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-13-2006, 01:41 AM   #1
swmok
Member
 
Registered: Jul 2003
Posts: 152

Rep: Reputation: 30
[Urgent, pls. Help] apache2 setting


Hi All:

I use apache2 in Debian Linux.

I use a homepage to read the username and password for user.
The user type in the username and password and then click submit button.
BUT, I cannot read the input. That means, the variables [username] and [password] are empty.

It works in apache (1.3).

Is there anything wrong in apached2 setting? or missing modules?

Pls. help.
 
Old 06-13-2006, 03:00 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
First of all, nothing is urgent when you post here.

1) Are you using this in combination with php? If so, see 2, else I don't know

2)
Are you referring to $HTTP_POST_VARS['username'] and $HTTP_POST_VARS['password'] being empty or to $username and $password being empty (or $HTTP_GET_VARS in case of a GET method)?
There is indeed a setting somewhere (can't remember which one) that can prevent use of $username and $password. If that's indeed the problem, use $HTTP_POST_VARS or $HTTP_GET_VARS; I guess the former will be the case (makes sense as GET will display password in url) but I'm not sure if your form uses POST or GET for the method.

PS I think that the setting you're looking for is register_globals in php.ini. The default value has changed somewhere along the line for security reasons (see http://www.php.net/register_globals )
 
Old 06-13-2006, 03:56 AM   #3
penguintutor
Member
 
Registered: Jun 2006
Location: UK
Distribution: Ubuntu, Mandriva, Redhat and Fedora
Posts: 118

Rep: Reputation: 15
If this is PHP it does sound like it's the register_globals setting which has changed as a result of PHP being upgraded.

In earlier versions of PHP, or with register_globals set then you could just refer to a variable passed using a get or post using the parameter as a variable name. So you could just refer to $username and as long as that was in the get/post it would work.

The problem with this is that if you didn't declare a variable properly then any variable could be passed on the URL with potentially disastrous results.

It is therefore strongly advised that you do NOT change the register_globals setting, but instead update your php to explicitly load any variables.

The simplist way of retrieving this is using the $_GET and $_POST variables.

If using a get (ie. variables are passed on the url) then you would use:
$username = $_GET[username];

if using post (method=post in the forum) then it would be
$username = $_POST[username];

You should of course still check that the data entered is valid, before you make use of it. I usually use a regexp to ensure that the variable only contains alphanumeric characters, so that no programming / SQL syntax can be inserted into the field.
 
Old 06-15-2006, 12:41 AM   #4
swmok
Member
 
Registered: Jul 2003
Posts: 152

Original Poster
Rep: Reputation: 30
Hi All:
Thanks all you guys.
I fixed the problem. Yes, it is the global variable problems is PHP.
Thanks again.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Me, Pls Is very Urgent metrodc Linux - Networking 7 08-27-2004 01:57 PM
DNS problem (Pls HELP, Urgent) kcwoo Linux - General 1 03-27-2002 10:41 PM
Mail Problem Pls Help Me -- URGENT jaishivaya Linux - General 0 03-20-2002 11:43 PM
URGENT ! PLS HELP :Mail problem kcwoo Linux - General 3 01-29-2002 11:46 PM
ftpd rpm -Urgent Pls bktpv Linux - Networking 0 12-20-2001 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:16 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