Guest User

PHP view

a guest
Feb 4th, 2020
196
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <style>
  3. table { margin: 30px 20px;}
  4. </style>
  5. <?php
  6. echo "<h3>PHP server</h3> Put any PHP script in scripts/ to parse it.";
  7. $files=scandir("./scripts");
  8. echo "<table><caption>FILES</caption>";
  9. foreach ($files as $f) {
  10.     if(preg_match("/.+\.php/",$f)) { echo "<tr><td><a href='/".$f."'>".$f."</a></td></tr>"; }
  11. }
  12. echo "</table>";
  13.  
  14. echo "php.ini: ".php_ini_loaded_file()."<br>";
  15. rebuild_sql();
  16. function rebuild_sql() {
  17.     $sql=new SQLite3("sqlite.db"); //create DB in web/node/home
  18.     $sql->query("drop table users");
  19.     //do some tests:
  20.     $sql->exec("create table users (
  21.         id integer primary key,
  22.         name char[50] not null,
  23.         pass char[50] not null,
  24.         contents char[200]
  25.     )");
  26.     $sql->exec("insert into users(id,name,pass,contents) values (12,'Test','xvzf','- Secret content -')");
  27.     $sql->exec("insert into users(id,name,pass) values (23,'Rudolf','horse1')");
  28.     $sql->exec("insert into users(id,name,pass) values (20,'Louis','strongarm')");
  29.     #print_r($sql->query("select * from users")->fetchArray());
  30. }
  31.  
  32.  
  33. echo "<table><caption>EXTENSIONS</caption>";
  34. echo "<tr><td> pgSQL: ".(extension_loaded("pgsql")?"OK":"NO")." </td></tr>";
  35. echo "<tr><td> PDO: ".(extension_loaded("pdo")?"OK":"NO")." </td></tr>";
  36. echo "<tr><td> SQLite 3: ".(extension_loaded("sqlite3")?"OK":"NO")." </td></tr>";
  37. echo "</table>";
  38.  
  39. $indicesServer = array('PHP_SELF',
  40. 'argv',
  41. 'argc',
  42. 'GATEWAY_INTERFACE',
  43. 'SERVER_ADDR',
  44. 'SERVER_NAME',
  45. 'SERVER_SOFTWARE',
  46. 'SERVER_PROTOCOL',
  47. 'REQUEST_METHOD',
  48. 'REQUEST_TIME',
  49. 'REQUEST_TIME_FLOAT',
  50. 'QUERY_STRING',
  51. 'DOCUMENT_ROOT',
  52. 'HTTP_ACCEPT',
  53. 'HTTP_ACCEPT_CHARSET',
  54. 'HTTP_ACCEPT_ENCODING',
  55. 'HTTP_ACCEPT_LANGUAGE',
  56. 'HTTP_CONNECTION',
  57. 'HTTP_HOST',
  58. 'HTTP_REFERER',
  59. 'HTTP_USER_AGENT',
  60. 'HTTPS',
  61. 'REMOTE_ADDR',
  62. 'REMOTE_HOST',
  63. 'REMOTE_PORT',
  64. 'REMOTE_USER',
  65. 'REDIRECT_REMOTE_USER',
  66. 'SCRIPT_FILENAME',
  67. 'SERVER_ADMIN',
  68. 'SERVER_PORT',
  69. 'SERVER_SIGNATURE',
  70. 'PATH_TRANSLATED',
  71. 'SCRIPT_NAME',
  72. 'REQUEST_URI',
  73. 'PHP_AUTH_DIGEST',
  74. 'PHP_AUTH_USER',
  75. 'PHP_AUTH_PW',
  76. 'AUTH_TYPE',
  77. 'PATH_INFO',
  78. 'ORIG_PATH_INFO') ;
  79.  
  80. echo '<table><caption>SERVER</caption>' ;
  81. foreach ($indicesServer as $arg) {
  82.     if (isset($_SERVER[$arg])) {
  83.         echo '<tr><td>'.$arg.'</td><td>' . $_SERVER[$arg] . '</td></tr>' ;
  84.     }
  85.     else {
  86.         #echo '<tr><td>'.$arg.'</td><td>-</td></tr>' ;
  87.    }
  88. }
  89. echo '</table>' ;
  90.  ?>
  91. </html>
RAW Paste Data