Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.     if (!empty($_POST)) {
  3.         $user = $_POST['user'];
  4.         $pass = $_POST['pass'];
  5.  
  6.         if($user == "admin"
  7.         && $pass == "admin")
  8.         {
  9.             $file = 'Путь к файлу';
  10.  
  11.             if (file_exists($file)) {
  12.                 header('Content-Description: download');
  13.                 header('Content-Type: ' . mime_content_type($file));
  14.                 header('Content-Disposition: attachment; filename='.basename($file));
  15.                 header('Expires: 0');
  16.                 header('Cache-Control: must-revalidate');
  17.                 header('Pragma: public');
  18.                 header('Content-Length: ' . filesize($file));
  19.                 ob_clean();
  20.                 flush();
  21.                 readfile($file);
  22.                 exit;
  23.             }
  24.         }
  25.     }
  26. ?>
  27.  
  28. <form method="POST" action="">
  29.     <input type="text" name="user" placeholder="Логин" /><input type="password" name="pass" placeholder="Пароль" />
  30.     <input type="submit" name="submit"></input>
  31. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement