Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.96 KB | None | 0 0
  1. <?php
  2. $maplist_name="waaaaaaat";
  3. $sudoers=['o5'=>'ANSI_password'];
  4.  
  5. $default_charset="cp1251"; //лиса всё равно выбирает юникод
  6. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
  7. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  8. // always modified
  9. header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
  10. header("Cache-Control: post-check=0, pre-check=0", false);
  11. header("Pragma: no-cache");                          // HTTP/1.0
  12. if (!isset($_SERVER['PHP_AUTH_USER'])||!isset($_SERVER['PHP_AUTH_PW'])) {
  13.     header('WWW-Authenticate: Basic realm="My Realm"');
  14.     header('HTTP/1.0 401 Unauthorized');
  15.     echo 'кыш отсюда';
  16.     exit;
  17. } else
  18. ?>
  19. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  20. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  21. <head>
  22.     <meta http-equiv="content-type" content="text/html; charset=cp1251" />
  23.     <meta property="og:type" content="article"/>
  24.  
  25.     <title>Редактирование списка карт</title>
  26.     <link rel="icon" href="images/favicon.ico" type="image/x-icon">
  27.     <link href="images/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
  28.  
  29. </head>
  30.  
  31. <body>
  32. <?php
  33. {
  34.     if($sudoers[$_SERVER['PHP_AUTH_USER']]!=$_SERVER['PHP_AUTH_PW']) {
  35.         echo 'кыш отсюда';
  36.     } else {
  37.         if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  38.             if(file_put_contents($maplist_name,htmlspecialchars_decode($_POST["mplist"]))){
  39.                 echo "new maplist is <br><br><br><br><br>", implode("<br>",file($maplist_name));
  40.             } else {
  41.                 echo 'failed to write new map list';
  42.             }
  43.         } else {
  44.             echo '<form action="',${basename(__FILE__)},'" method="post">';
  45.             echo '<textarea name="mplist" rows="40" cols="40">';
  46.             echo htmlspecialchars(file_get_contents($maplist_name));
  47.             echo '</textarea><br>';
  48.             echo '<input class="button" value="Перезаписать список карт" type="submit">';
  49.         }
  50.     }
  51. }
  52. ?>
  53. </body>
  54.  
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement