Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Undefined variable: $PHP_SELF ?????

    Hi there, I just install manualy PHP in an IIS 5.0 Server, and alot of my old scripts are not running 'cos errors like:
    Code:
    Notice: Undefined variable: PHP_SELF in C:\Inetpub\wwwroot\Eranor Web\wert.php on line 10
    and here is the source of wert.php:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <?php 
       echo($PHP_SELF); 
       echo("wert");
    ?>
    </body>
    </html>
    I also have to pull the value of the URL passed variables like this (let's say that the url is http://www.mysite.com/wert.php?MyUrlVariable=10):
    Code:
    <?php 
    
    $Ten = $HTTP_GET_VARS['MyUrlVariable']; 
    echo($ten);
    //so this echo displays: 10
    
    ?>
    when I used to do it simply like this (with the same url as above):
    Code:
    echo($MyUrlVariable);
    //so this echo displays: 10
    please is any thing I've do wrong??
    how to configure my php.ini file??
    Thnx any help will be useful...

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    If you have just installed php, I'm assuming it's the latest version? If so, you'll need to use the super gobals, such as $_SERVER['var_name'], $_GET['var_name'] etc

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes is the last one, PHP 4.3.2,
    How do I do that?

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    You will now have to access server variables such as PHP_SELF the proper way:

    $_SERVER["PHP_SELF"]

    You will have to access POST variables the proper way:

    $_POST["variablename"]

    You will have to access GET variables the proper way:

    $_GET["variablename"];

    It's all in the PHP manual at www.php.net
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I see, thnx,
    and just curiose, whay they do that?

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by wert
    I see, thnx,
    and just curiose, whay they do that?
    It's in the manual:

    http://us2.php.net/manual/en/securit...terglobals.php
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #7
    piz
    piz is offline
    Regular Coder
    Join Date
    Jul 2002
    Location
    Barcelona
    Posts
    246
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh I didn't know that....

    In the new PHP Version you can't use $PHP_SELF and the registererd Variables in the session just like in the other versiones??

  • #8
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    I beleive you can modify the register_globals in the php.ini file to be On which will allow you to use $_POST[] and $_GET var the old way, but I'm not sure if it fixes the $PHP_SELF. I think it does.

  • #9
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by bcarl314
    I beleive you can modify the register_globals in the php.ini file to be On
    You can but you shouldn't unless you absolutely have to at the moment. That kind of defeats the purpose of making things more secure.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

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