Advertisement
ph4x35ccb

validaçao login PHP

Mar 13th, 2020
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. $x="";
  3. if(isset($_GET['btn'])){
  4.     $user = $_GET['user'];
  5.     $pass = $_GET['pass'];
  6.     /*
  7.     echo $user."<br>";
  8.     echo $pass."<br>";*/
  9.     $x=verificalogin($user,$pass);
  10. }
  11.  
  12.  
  13.  
  14. function verificalogin($user, $pass){
  15.     if($user == "andre" && $pass == "abc123"){
  16.         return 'Sucesso';
  17.     }else{
  18.         return 'Erro';
  19.     }
  20. }
  21. ?>
  22. <!DOCTYPE html>
  23. <html lang="pt-br">
  24. <head>
  25.     <meta charset="UTF-8">
  26.     <title>Document</title>
  27. </head>
  28. <body>
  29.     <form action="formulario.php" method="GET">
  30.         <input type="text" name="user">
  31.         <input type="pass" name="pass">
  32.         <input type="submit" name="btn">
  33.     </form>
  34.     <?php
  35.     if($x=="Erro"){
  36.         echo "login invalido";
  37.     }else{
  38.         echo "OK";
  39.     }
  40.     ?>
  41. </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement