LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 04-22-2003, 03:38 PM   #1
lokee
Member
 
Registered: Feb 2003
Distribution: Gentoo
Posts: 381

Rep: Reputation: 30
PHP Script argument passing error...


Hi,
Currently, I have httpd 2.0.40 running with the imap, perl, ssl, mysql, ldap modules installed.

Here's my problem: I can't pass arguments to my php scripts...
Imagine I had a script named test.php containing:
<?php echo"$y" ?>
When I try to pass argument y from the browser(test.php?y=gsd) nothing gets printed!

Is this a normal behavior? I mean that this isn't supported on my version or that I need a special module or something...

Thanks in Advance,
Best regards,
 
Old 04-22-2003, 04:18 PM   #2
netdur
LQ Newbie
 
Registered: Apr 2003
Posts: 5

Rep: Reputation: 0
look at php.ini and change this line:
"register_globals = Off" to "register_globals = On"
but that can be bad idea... for multi-reasons, so do not set it "On" and if you want get variables from url you must write (as your example):
PHP Code:
<?Php
print $_GET['y'];
?>
so if you want get variables from URL use $_GET['var'] and from form $_POST['var'] and cookie $_COOKIE['var'] and server as $PHP_SELF must be $_SERVER['$PHP_SELF'].
there more as $_SESSION, $_REQUEST, $_ENV, $_FILES and $GLOBALS... just check http://php.net/variables
 
Old 04-23-2003, 11:19 AM   #3
lokee
Member
 
Registered: Feb 2003
Distribution: Gentoo
Posts: 381

Original Poster
Rep: Reputation: 30
Thanks it works fine now!

In php.ini it says that it's insecure... But every Webpage provider I know has this feature on.
Is it really inscure, if so, Why?
 
Old 04-23-2003, 02:32 PM   #4
netdur
LQ Newbie
 
Registered: Apr 2003
Posts: 5

Rep: Reputation: 0
This is stupid example but can explain,
PHP Code:
<?Php
if ($stored_password == $_POST['password'])
{
    
$login true;
}
else
{
    
$login false;
}
if (
$login == true)
{
    
mysql_query('DROP DATABASE mysql');
}
?>
code above... need password to remove database, if register_globals is on, you can just write on browser "page.php?login=true" to remove database without password needed...
 
Old 04-23-2003, 02:36 PM   #5
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Newbie thought: Have vital things like login as local/private/non-global variables.
 
Old 04-24-2003, 09:42 AM   #6
lokee
Member
 
Registered: Feb 2003
Distribution: Gentoo
Posts: 381

Original Poster
Rep: Reputation: 30
I tought of a similar thing at first but that won't work since $stored_password won't be equal to $_GET['y'], thus login will be set to false in all cases.
 
  


Reply



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
segfault when passing array[] as argument froboozle Programming 11 06-28-2005 03:06 PM
PHP pass argument to shell script monzter Programming 2 08-14-2004 06:16 AM
passing function pointer as argument worldmagic Programming 7 08-04-2004 03:33 PM
Passing variables from AWK script to my shell script BigLarry Programming 1 06-12-2004 04:32 AM
How does passing argument to main work Linh Programming 5 06-27-2003 01:08 PM

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

All times are GMT -5. The time now is 12:31 AM.

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