SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to turn register_globals off?

    I'm trying to turn the register_globals off. The problems is that I don't have access to the php.ini, because my site is hostet by the university.

    So, is it possible to turn the register_globals og in a .htaccess file? Like this:
    PHP Code:
    <IfModule mod_php4.c>
         
    php_value register_globals 0
    </IfModule
    -Helge

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i use
    Code:
    php_flag register_globals off
    and it works... oh yeah to answer your question you can do that with a .htaccess file

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for answering my question redemption!

    Ok, here's the actual reason why I asked the first question:

    When I put php_flag register_globals off in the .htaccess file I get the following error_message:

    Warning: Undefined variable: SCRIPT_NAME in /usr/local/others/****/header.inc.php3 on line 33

    Line 33 in header.inc.php3:
    PHP Code:
    $fileName str_replace(".php3"""end(explode("/"$SCRIPT_NAME))); 
    Why is his happening?

    -Helge
    Last edited by Helge; Apr 8, 2002 at 08:58.

  4. #4
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe... that's the .htaccess working there

    $SCIPT_NAME apparently is now not registered as global cos you just turned register_globals off ... i think it should be available as $HTTP_SERVER_VARS['SCRIPT_NAME'] (or something else... i'm not familiar with that)

  5. #5
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ooh, I'm a bit embarrased

    Works great with this: $_SERVER["SCRIPT_NAME"]

    -Helge


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
  •