LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-23-2003, 12:22 AM   #1
stelar
LQ Newbie
 
Registered: Jun 2003
Posts: 3

Rep: Reputation: 0
php registerglobal = off workaround?


Hi all. I'm not sure whether to post this in security or software forum. So forgive me if I cross posted.

Anyway, my question is:

PHP's register global by default is turn off and this is good for security. Now, if I code my PHP in this way:

<?

$myvar = $_POST["myvar"];

if($myvar)
this is correct, so do what it's supposed to do
else
back to login
?>

Will I be actually back to square one, as if I'm using register global = on? I saw some tutorial uses:

<?
if ($_GET["myvar"])
alert admin
else if($_POST["myvar"])
ok
?>

But with tens of variables in lots of files, it's going to be difficult for me to change and debug. (Of course it can be done, but is it worth it?) Wouldn't it be slowing down the php processing?
 
Old 06-26-2003, 12:33 PM   #2
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: php registerglobal = off workaround?

Quote:
Originally posted by stelar
PHP's register global by default is turn off and this is good for security. Now, if I code my PHP in this way:

<?

$myvar = $_POST["myvar"];

if($myvar)
this is correct, so do what it's supposed to do
else
back to login
?>

Will I be actually back to square one, as if I'm using register global = on?
No. I think you'll be fine.

When you turn register_globals off, all URL variables go under _GET and won't be available in the global scope. So no matter what, nobody can 'overwrite' your myvar by passing a URL param by the same name.

The tutorials may have used to illustrate the point that you can even 'catch' an offender if you watch out.

HTH
 
Old 06-30-2003, 02:04 AM   #3
stelar
LQ Newbie
 
Registered: Jun 2003
Posts: 3

Original Poster
Rep: Reputation: 0
thanks for your confirmation, nxny!
 
  


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
PHP: Browser timeout workaround?? jpbarto Programming 2 08-05-2005 10:30 AM
Thrre has to be a workaround Pyrophorus Slackware - Installation 4 01-02-2005 07:31 AM
Bootloader Workaround??? Ken Ju-On Linux - Newbie 3 11-23-2003 01:05 AM
Is there a workaround? jpbarto Linux - Software 0 07-13-2003 10:22 PM
strange workaround contrasutra Linux - Networking 14 04-05-2003 09:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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