Advertisement
tolikpunkoff

test-curl-testing-php-script-POST

Mar 29th, 2018
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2.     ini_set('error_reporting', E_ALL);
  3.     ini_set('display_errors', 1);
  4.     ini_set('display_startup_errors', 1);  
  5.     if (empty($_POST))
  6.     {
  7.         echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><body>";
  8.         echo "<form action='".$_SERVER['PHP_SELF']."' method='POST'>";
  9.         echo "User: <input type='text' name='username'><br>";
  10.         echo "Password: <input type='password' name='pass'><br>";
  11.         echo "<input type='submit' name='button' value='Enter'>";
  12.         echo "</form></body></html>";
  13.     }
  14.     else
  15.     {
  16.         if (isset($_POST['username'], $_POST['pass']))
  17.         {
  18.             if ($_POST['username']=='user')
  19.             {
  20.                 if ($_POST['pass']=='666')
  21.                 {
  22.                     echo "OK";
  23.                    
  24.                 }
  25.                 else
  26.                 {
  27.                     //header('403 Forbidden', true, 403);
  28.                     http_response_code(403);
  29.                    
  30.                 }
  31.             }
  32.             else
  33.             {
  34.                 //header('403 Forbidden', true, 403);
  35.                 http_response_code(403);
  36.             }
  37.         }
  38.         else
  39.         {
  40.             //header('418 I am a teapot', true, 418);
  41.             http_response_code(418);
  42.         }
  43.     }  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement