Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $maplist_name="waaaaaaat";
- $sudoers=['o5'=>'ANSI_password'];
- $default_charset="cp1251"; //лиса всё равно выбирает юникод
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- // always modified
- header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
- header("Cache-Control: post-check=0, pre-check=0", false);
- header("Pragma: no-cache"); // HTTP/1.0
- if (!isset($_SERVER['PHP_AUTH_USER'])||!isset($_SERVER['PHP_AUTH_PW'])) {
- header('WWW-Authenticate: Basic realm="My Realm"');
- header('HTTP/1.0 401 Unauthorized');
- echo 'кыш отсюда';
- exit;
- } else
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=cp1251" />
- <meta property="og:type" content="article"/>
- <title>Редактирование списка карт</title>
- <link rel="icon" href="images/favicon.ico" type="image/x-icon">
- <link href="images/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
- </head>
- <body>
- <?php
- {
- if($sudoers[$_SERVER['PHP_AUTH_USER']]!=$_SERVER['PHP_AUTH_PW']) {
- echo 'кыш отсюда';
- } else {
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- if(file_put_contents($maplist_name,htmlspecialchars_decode($_POST["mplist"]))){
- echo "new maplist is <br><br><br><br><br>", implode("<br>",file($maplist_name));
- } else {
- echo 'failed to write new map list';
- }
- } else {
- echo '<form action="',${basename(__FILE__)},'" method="post">';
- echo '<textarea name="mplist" rows="40" cols="40">';
- echo htmlspecialchars(file_get_contents($maplist_name));
- echo '</textarea><br>';
- echo '<input class="button" value="Перезаписать список карт" type="submit">';
- }
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement