SitePoint Sponsor

User Tag List

Results 1 to 25 of 25

Hybrid View

  1. #1
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP constants reference

    I would have thought this question was asked before, but I couldn't find any posts with it so here it is:
    Is there any place I get a FULL list of the php constants like$PHP_SELF and referer etc?
    And I don't need this: http://www.php.net/manual/en/language.constants.php
    or this:
    http://www.php.net/manual/en/languag....predefined.ph
    The first one is not what I mean, and the second url is not complete at all, even $PHP_SELF isn't given there.

    So does anyone know a complete list?
    thx,
    =X=

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Create a php file with this in it: <? phpinfo(); ?> and run it.

  3. #3
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it gives a lot of constants, but e.g. not
    HTTP_REFERER...
    I really want one with all constants/vars..

  4. #4
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It has HTTP_REFERER.

  5. #5
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it doesn't have it here...I sent you an e-mail (the address you have given sitepoint) with the url (I don't think it's the best idea to show it to potential hackers...)
    if you can find it there then I'm just blind as a bat

    my server admin will prolly have it disabled, but that doesn't help me

    this still doesn't give me a list with ALL constants, even the one that are disabled

  6. #6
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It won't output HTTP_REFERER if there isn't one. So to test this, make a page called test.html with a link to phpinfo.php. Click the link then search (ctrl-f) for test.html and you'll find the variable.

  7. #7
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes indeed, but is it NOW a full list? are there now no more other constants? or are there more constants like this?

  8. #8
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's stuff like HTTP_GET_VARS AND HTTP_POST_VARS but those are listed on http://php.net/manual/en/language.va...predefined.php

  9. #9
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx

    but I really think it's strange that there are no site wich post them all...php.net has such a great manual but not all the constants are given, I think that's really strange :/

    I think it's discrimination the functions are all given

  10. #10
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heh
    just found something
    they ARE mentioned in predefined variables lolz

  11. #11
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well here's a script I just made that gives you a list of all global variables and their contents:
    PHP Code:
    displayIt($GLOBALS);
    function 
    displayIt($myArray){
        
    ksort($myArray);
        foreach(
    $myArray as $key=>$val){
            if (
    is_string($val))
                
    $val str_replace("<br/?>","",$val);
            echo 
    "<b>$key</b>";
            if (!
    is_array($val))
                echo 
    "[$val]";
            echo 
    "<br />\n";
            if (
    is_array($val) && $key != "GLOBALS"){
                echo 
    "<blockquote>\n";
                
    displayIt($val);
                echo 
    "</blockquote>\n";
                }
            }


  12. #12
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx, but it gives an error with me, on
    function*displayIt($myArray)
    this line

  13. #13
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Which version of PHP are you using?

  14. #14
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP/4.0.4pl1

  15. #15
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess it's because I'm using 4.0.5...

  16. #16
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to connect to my f2s account (don't know wich version they use, maybe 4.06 or 4.05) but they are down again

    I hope I can connect soon, so I can use your script

  17. #17
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the error?

  18. #18
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    f2s uses the same version as my server

    The error is a parse error on this line:

    function*displayIt($myArray)
    so maybe $GLOBALS is the problem?
    Last edited by =X=; Jun 29, 2001 at 09:27.

  19. #19
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just installed 4.06 (on my own box - not on the server) and executed the code within phpEd
    still gives the parse error

  20. #20
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Weird, try this version I suppose:
    PHP Code:
    <?php
    function displayIt($myArray){
        
    ksort($myArray);
        foreach(
    $myArray as $key=>$val){
            echo 
    "<b>$key</b>";
            if (!
    is_array($val))
                echo 
    "[$val]";
            echo 
    "<br />\n";
            if (
    is_array($val) && $key != "GLOBALS"){
                echo 
    "<blockquote>\n";
                
    displayIt($val);
                echo 
    "</blockquote>\n";
                }
            }
    }

    displayIt($GLOBALS);
    ?>

  21. #21
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    parse error, same line

  22. #22
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It might help to post the exact code you tried using, someties the code can get transformed between your cut and paste job. I am sure it will help to see the relevant code as you percieved it.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  23. #23
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There isn't a parse error in the script, so either you're copying it wrong or there's some other difference between our setups. If you upload the script and the source I can check it out.

  24. #24
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh yeah - I'm on a Mac, and I cannot just cut and paste code from these forums into a script. Gotta massage all the line-breaks/carrige returns into shape.

  25. #25
    SitePoint Evangelist =X='s Avatar
    Join Date
    Jun 2001
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, I've uploaded the file and the code
    code=http://www.rlgaming.com/php/Noname2.htm
    file=http://www.rlgaming.com/php/Noname2.php

    I've changed the format a little bit, so it's more readable (still don't understand why peeps use that -what do they call it again- format) but that shouldn't be any problem, I always code like that, never gave me problems. And I got the same parse error on your coding style...I really don't think it has to do with a wrong copy/paste..

    My guesse is that the $GLOBALS is the problem...


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
  •