Advertisement
Guest User

Untitled

a guest
May 14th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. $error = '';
  3.  
  4. // Form is gesubmit dus let's go on :P
  5. if (array_key_exists('formSubmit', $_POST) && trim($_POST['formSubmit']) != '')
  6. {
  7.     // geen username gevonden
  8.     if (!array_key_exists('username', $_POST) || trim($_POST['username']) == '')
  9.     {
  10.         $error = 'Please enter your username!';
  11.     }
  12.     // Geen password gevonden
  13.     else if (!array_key_exists('password', $_POST) || trim($_POST['password']) == '')
  14.     {
  15.         $error = 'Please enter your password!';
  16.     }
  17.     // Beide velden zijn ingevuld we kunnen door
  18.     else
  19.     {
  20.         // Code voor het controleren of inloggen is gelukt
  21.         // ..............
  22.         // ..............
  23.  
  24.         // Inloggen is gelukt stuur door naar anderepagina.php
  25.         die(header('Location: anderepagina.php'));
  26.     }
  27. }
  28.  
  29. ?>
  30.  
  31. <html>
  32. ...
  33. ...
  34.  
  35. <form name="blaForm" method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>" >
  36. Username: <input type="text" name="username" />
  37. Password: <input type="password" name="password" />
  38. <input type="submit" name="formSubmit" value="Log in" />
  39.  
  40. </form>
  41.  
  42.  
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement