Guest User

Untitled

a guest
May 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1. <?php
  2.  
  3.     // Código exercicio 1:
  4.     if( !empty( $_POST['user'] ) ) {
  5.  
  6.         $username = $_POST['user'];
  7.         $password = $_POST['password'];
  8.  
  9.         if( $username == "ABC" && $password == "123" ) {
  10.             echo "Seja bem-vindo ao sistema!";
  11.         } else {
  12.             echo "Dados inválidos, tente novamente!";
  13.         }
  14.  
  15.     }
  16.  
  17.     // Código exercicio 2:
  18.     $img = "";
  19.     if( !empty( $_GET['url'] ) ) {
  20.  
  21.         $img = $_GET['url'];
  22.  
  23.     }
  24.  
  25. ?>
  26.  
  27. <html>
  28.  
  29.     <head>
  30.         <title>POST & GET</title>
  31.     </head>
  32.  
  33.     <body>
  34.  
  35.         <center>
  36.         <h1>POST & GET</h1>
  37.  
  38.         <br><br>
  39.  
  40.         <form action="index.php" method="POST">
  41.             <div>
  42.                 <label for="user">Usuario:</label>
  43.                 <input type="text" name="user" />
  44.             </div>
  45.             <div>
  46.                 <label for="password">Senha:</label>
  47.                 <input type="password" name="password" />
  48.             </div>
  49.             <br>
  50.             <div class="button">
  51.                 <button type="submit">Entrar</button>
  52.             </div>
  53.         </form>
  54.  
  55.         <a href="index.php?url=a2.jpg">Link de imagem</a>
  56.  
  57.         <br><br>
  58.  
  59.         <img src="<?php echo $img ?>" style="width: 250px" />
  60.  
  61.  
  62.         </center>
  63.  
  64.     </body>
  65.  
  66. </html>
Add Comment
Please, Sign In to add comment