SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Code To Check If register_globals Are On?

    What code can I use to check if register_globals are on?

  2. #2
    SitePoint Zealot Teraflops's Avatar
    Join Date
    Apr 2002
    Location
    NYC
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use
    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    gives you a list of everything on the php that is on your server including if globals are on or off.
    OneX Square Creation
    One man said Why ? ... Another man said Why not ?

  3. #3
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, but I want to be able to check within a code to see if it's on. This is for a script written by one of my friends which he plans to distribute, but he coded it for register_globals = On.. So I'm looking for the code he can put to generate an error if it's off.

    ie.
    if (register.globals.are.off) {
    echo 'Register_globals are off in your php.ini file. It is required that register_globals be on for proper function. Please turn them off.';
    exit;
    }

    I just need to know how to check it..

  4. #4
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use

    PHP Code:
    ini_get('register_globals'

  5. #5
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also that should be the other way about;

    Check for globals being OFF and if so then run your script. If your friend has scripted for globals being ON then this posses a security risk, correct ?

    Doesn't really matter the version of PHP either as I believe.

    Just a thought really


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •