1. PHP / Говнокод #4874

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    <?php
    echo "<table border=\"1\">";
    echo "<tr><td>" .$_SERVER['argv'] ."</td><td>argv</td></tr>";
    echo "<tr><td>" .$_SERVER['argc'] ."</td><td>argc</td></tr>";
    echo "<tr><td>" .$_SERVER['GATEWAY_INTERFACE'] ."</td><td>GATEWAY_INTERFACE</td></tr>";
    echo "<tr><td>" .$_SERVER['SERVER_ADDR'] ."</td><td>SERVER_ADDR</td></tr>";
    echo "<tr><td>" .$_SERVER['SERVER_NAME'] ."</td><td>SERVER_NAME</td></tr>";
    echo "<tr><td>" .$_SERVER['SERVER_SOFTWARE'] ."</td><td>SERVER_SOFTWARE</td></tr>";
    echo "<tr><td>" .$_SERVER['SERVER_PROTOCOL'] ."</td><td>SERVER_PROTOCOL</td></tr>";
    echo "<tr><td>" .$_SERVER['REQUEST_METHOD'] ."</td><td>REQUEST_METHOD</td></tr>";
    echo "<tr><td>" .$_SERVER['REQUEST_TIME'] ."</td><td>REQUEST_TIME</td></tr>";
    echo "<tr><td>" .$_SERVER['QUERY_STRING'] ."</td><td>QUERY_STRING</td></tr>";
    echo "<tr><td>" .$_SERVER['DOCUMENT_ROOT'] ."</td><td>DOCUMENT_ROOT</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_ACCEPT'] ."</td><td>HTTP_ACCEPT</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_ACCEPT_CHARSET'] ."</td><td>HTTP_ACCEPT_CHARSET</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_ACCEPT_ENCODING'] ."</td><td>HTTP_ACCEPT_ENCODING</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_ACCEPT_LANGUAGE'] ."</td><td>HTTP_ACCEPT_LANGUAGE</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_CONNECTION'] ."</td><td>HTTP_CONNECTION</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_HOST'] ."</td><td>HTTP_HOST</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_REFERER'] ."</td><td>HTTP_REFERER</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTP_USER_AGENT'] ."</td><td>HTTP_USER_AGENT</td></tr>";
    echo "<tr><td>" .$_SERVER['HTTPS'] ."</td><td>HTTPS</td></tr>";
    echo "<tr><td>" .$_SERVER['REMOTE_ADDR'] ."</td><td>REMOTE_ADDR</td></tr>";
    echo "<tr><td>" .$_SERVER['REMOTE_HOST'] ."</td><td>REMOTE_HOST</td></tr>";
    echo "<tr><td>" .$_SERVER['REMOTE_PORT'] ."</td><td>REMOTE_PORT</td></tr>";
    echo "<tr><td>" .$_SERVER['SCRIPT_FILENAME'] ."</td><td>SCRIPT_FILENAME</td></tr>";
    echo "<tr><td>" .$_SERVER['SERVER_ADMIN'] ."</td><td>SERVER_ADMIN</td></tr>";
    echo "<tr><td>" .$_SERVER['SERVER_PORT'] ."</td><td>SERVER_PORT</td></tr>";
    echo "<tr><td>" .$_SERVER['SERVER_SIGNATURE'] ."</td><td>SERVER_SIGNATURE</td></tr>";
    echo "<tr><td>" .$_SERVER['PATH_TRANSLATED'] ."</td><td>PATH_TRANSLATED</td></tr>";
    echo "<tr><td>" .$_SERVER['SCRIPT_NAME'] ."</td><td>SCRIPT_NAME</td></tr>";
    echo "<tr><td>" .$_SERVER['REQUEST_URI'] ."</td><td>REQUEST_URI</td></tr>";
    echo "<tr><td>" .$_SERVER['PHP_AUTH_DIGEST'] ."</td><td>PHP_AUTH_DIGEST</td></tr>";
    echo "<tr><td>" .$_SERVER['PHP_AUTH_USER'] ."</td><td>PHP_AUTH_USER</td></tr>";
    echo "<tr><td>" .$_SERVER['PHP_AUTH_PW'] ."</td><td>PHP_AUTH_PW</td></tr>";
    echo "<tr><td>" .$_SERVER['AUTH_TYPE'] ."</td><td>AUTH_TYPE</td></tr>";
    echo "</table>"
    ?>

    http://www.php.net/manual/en/reserved.variables.server.php#91080

    Много полезного написано в комментариях в мануале PHP, но есть там и полный бред.

    Запостил: sectus, 09 Декабря 2010

    Комментарии (16) RSS

    • Автору этого кода удобно, чтоб названия были справа?
      Ответить
    • настоящий пыхокод
      Ответить
    • Это надо было назвать function phpinfo();
      Ответить
    • Это _ПОЛЬЗОВАТЕЛЬСКИЙ_ комментарий к документации.
      Ответить
    • да ладно....
      phpinfo(INFO_VARIABLES);

      вот! http://www.php.net/manual/en/function.phpinfo.php#70306
      <?php
      
      /* parse php modules from phpinfo */
      
      function parsePHPModules() {
       ob_start();
       phpinfo(INFO_MODULES);
       $s = ob_get_contents();
       ob_end_clean();
      
       $s = strip_tags($s,'<h2><th><td>');
       $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$s);
       $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$s);
       $vTmp = preg_split('/(<h2[^>]*>[^<]+<\/h2>)/',$s,-1,PREG_SPLIT_DELIM_CAPTURE);
       $vModules = array();
       for ($i=1;$i<count($vTmp);$i++) {
        if (preg_match('/<h2[^>]*>([^<]+)<\/h2>/',$vTmp[$i],$vMat)) {
         $vName = trim($vMat[1]);
         $vTmp2 = explode("\n",$vTmp[$i+1]);
         foreach ($vTmp2 AS $vOne) {
         $vPat = '<info>([^<]+)<\/info>';
         $vPat3 = "/$vPat\s*$vPat\s*$vPat/";
         $vPat2 = "/$vPat\s*$vPat/";
         if (preg_match($vPat3,$vOne,$vMat)) { // 3cols
           $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]),trim($vMat[3]));
         } elseif (preg_match($vPat2,$vOne,$vMat)) { // 2cols
           $vModules[$vName][trim($vMat[1])] = trim($vMat[2]);
         }
         }
        }
       }
       return $vModules;
      }
      ?>
      Ответить
      • лол!
        чсх, все каменты ниже посвящены с применению регэкспов к выводу пхпинфо =)
        Ответить
    • вообще-то там написан лютый пиздец %)
      Ответить
    • HTML! Выходи на построение
      Ответить

    Добавить комментарий