Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Código exercicio 1:
- if( !empty( $_POST['user'] ) ) {
- $username = $_POST['user'];
- $password = $_POST['password'];
- if( $username == "ABC" && $password == "123" ) {
- echo "Seja bem-vindo ao sistema!";
- } else {
- echo "Dados inválidos, tente novamente!";
- }
- }
- // Código exercicio 2:
- $img = "";
- if( !empty( $_GET['url'] ) ) {
- $img = $_GET['url'];
- }
- ?>
- <html>
- <head>
- <title>POST & GET</title>
- </head>
- <body>
- <center>
- <h1>POST & GET</h1>
- <br><br>
- <form action="index.php" method="POST">
- <div>
- <label for="user">Usuario:</label>
- <input type="text" name="user" />
- </div>
- <div>
- <label for="password">Senha:</label>
- <input type="password" name="password" />
- </div>
- <br>
- <div class="button">
- <button type="submit">Entrar</button>
- </div>
- </form>
- <a href="index.php?url=a2.jpg">Link de imagem</a>
- <br><br>
- <img src="<?php echo $img ?>" style="width: 250px" />
- </center>
- </body>
- </html>
Add Comment
Please, Sign In to add comment