Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 709 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

[PHP] register_globals ??

Thread title: [PHP] register_globals ??
Closed Thread    
    Thread tools Search this thread Display Modes  
01-21-2007, 11:28 PM
#1
Aaron Michael is offline Aaron Michael
Status: Member
Join date: Aug 2005
Location:
Expertise:
Software:
 
Posts: 392
iTrader: 0 / 0%
 

Aaron Michael is on a distinguished road

  Old  [PHP] register_globals ??

How do I turn register_globals off? I need it off for joomla, I did a search and nothing positive came up.

01-21-2007, 11:42 PM
#2
Paris Holley is offline Paris Holley
Status: Member
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 347
iTrader: 0 / 0%
 

Paris Holley is on a distinguished road

  Old

01-22-2007, 02:38 AM
#3
jono1 is offline jono1
jono1's Avatar
Status: Non-conformist
Join date: Jul 2005
Location: Canberra, Australia.
Expertise:
Software:
 
Posts: 1,172
iTrader: 0 / 0%
 

jono1 is on a distinguished road

  Old

If you're running your own server it will be in the php.ini file. If you're hosting with someone else, you'll need to ask the administrator to do it for ya.

01-22-2007, 02:49 AM
#4
Mark Bolyard is offline Mark Bolyard
Mark Bolyard's Avatar
Status: Member
Join date: Sep 2005
Location: Maryland
Expertise:
Software:
 
Posts: 431
iTrader: 3 / 100%
 

Mark Bolyard is on a distinguished road

Send a message via MSN to Mark Bolyard

  Old

You can also do it through htaccess http://www.itc.virginia.edu/desktop/...terglobal.html

01-22-2007, 02:54 AM
#5
Julian is offline Julian
Status: Simply to simplify
Join date: Apr 2005
Location: Foxton, Manawatu, New Zealand
Expertise:
Software:
 
Posts: 5,572
iTrader: 0 / 0%
 

Julian is on a distinguished road

  Old

register_globals is turned off by default by any install of php over PHP 4.2. If it is not then you will have to contact your web host and ask them to turn it to off for security reasons.

If they won't do this then you can do it through your own .htaccess file, add the following line:

php_flag register_globals off

Alternatively you can do this through php:

Originally Posted by php.net
This will emulate register_globals Off. Keep in mind, that this code should be called at the very beginning of your script, or after session_start() if you use it to start your session.
PHP Code:
<?php
// Emulate register_globals off
function unregister_GLOBALS()
{
    if (!
ini_get('register_globals')) {
        return;
    }

    
// Might want to change this perhaps to a nicer error
    
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
        die(
'GLOBALS overwrite attempt detected');
    }

    
// Variables that shouldn't be unset
    
$noUnset = array('GLOBALS',  '_GET',
                     
'_POST',    '_COOKIE',
                     
'_REQUEST''_SERVER',
                     
'_ENV',     '_FILES');

    
$input array_merge($_GET,    $_POST,
                         
$_COOKIE$_SERVER,
                         
$_ENV,    $_FILES,
                         isset(
$_SESSION) && is_array($_SESSION) ? $_SESSION : array());
    
    foreach (
$input as $k => $v) {
        if (!
in_array($k$noUnset) && isset($GLOBALS[$k])) {
            unset(
$GLOBALS[$k]);
        }
    }
}

unregister_GLOBALS();

?>

01-22-2007, 03:24 AM
#6
Aaron Michael is offline Aaron Michael
Status: Member
Join date: Aug 2005
Location:
Expertise:
Software:
 
Posts: 392
iTrader: 0 / 0%
 

Aaron Michael is on a distinguished road

  Old

^^ I've done it through the .htaccess but then the website doesn't show up at all =\

01-22-2007, 05:50 AM
#7
jono1 is offline jono1
jono1's Avatar
Status: Non-conformist
Join date: Jul 2005
Location: Canberra, Australia.
Expertise:
Software:
 
Posts: 1,172
iTrader: 0 / 0%
 

jono1 is on a distinguished road

  Old

Probably means you made a syntax error in your htaccess file. If you post it here I'm sure some members would be more than happy to help out.

01-22-2007, 07:57 AM
#8
Xi0s is offline Xi0s
Status: Sin Binner
Join date: Dec 2006
Location: Huddersfield, UK
Expertise:
Software:
 
Posts: 384
iTrader: 3 / 83%
 

Xi0s is on a distinguished road

Send a message via MSN to Xi0s

  Old

the only way to do it is through php.ini, that php code up there will work, but for full protection its the best way to go .

01-22-2007, 10:43 AM
#9
Julian is offline Julian
Status: Simply to simplify
Join date: Apr 2005
Location: Foxton, Manawatu, New Zealand
Expertise:
Software:
 
Posts: 5,572
iTrader: 0 / 0%
 

Julian is on a distinguished road

  Old

Yes but if you don't have access to the php.ini file you have to find alternatives.

Remember you can place that php script in a file and secure that php script via CHMOD permissions.

01-22-2007, 12:30 PM
#10
Aaron Michael is offline Aaron Michael
Status: Member
Join date: Aug 2005
Location:
Expertise:
Software:
 
Posts: 392
iTrader: 0 / 0%
 

Aaron Michael is on a distinguished road

  Old

Hey Julian or any other member can you guys make a .htaccess file for me ? I currently don't have one.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed