Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.82 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>Registreren</title>
  6. </head>
  7.  
  8. <body>
  9. <h1>Persoon Inloggen</h1>
  10. <form action="" method="post" enctype="multipart/form-data">
  11.     <dl>
  12.         <dt><label for="emails_home">email:</label></dt>
  13.         <dd><input id="emails_home" name="emails_home" type="text" value="<?php echo @$_POST['emails_home']; ?>" placeholder="Geef hier je email in" /></dd>
  14.        
  15.        
  16.         <dt><label for="paswoord">Paswoord:</label></dt>
  17.         <dd><input id="paswoord" name="paswoord" type="password" value="<?php echo @$_POST['paswoord']; ?>" placeholder="Geef hier een paswoord in" /></dd>
  18.        
  19.        
  20.         <dd><input name="submit" type="submit" value="Log in" /></dd>
  21.        
  22.     </dl>
  23.     <div id="result"></div>
  24.    
  25.     <a href="registreren.php">registreren</a>
  26. </form>
  27. <?php
  28.  
  29. session_start();
  30.  
  31.  
  32. if ( !empty($_POST) && isset($_POST['submit']) ) {
  33.  
  34.  
  35.  
  36.  
  37.     $emails_home = $_POST['emails_home'];
  38.     $paswoord = $_POST['paswoord'];
  39.        
  40.     if(empty($emails_home) || empty($paswoord)) die('Vul alle waarden in');
  41.  
  42.     require_once '../application/db.php';
  43.        
  44.     $sql="SELECT * FROM users WHERE emails_home=? and password=?";
  45.              
  46.    
  47.            
  48.     if ($stmt = $db->prepare($sql)) {
  49.         $stmt->bind_param('ss', $emails_home, $paswoord);
  50.         $stmt->execute();
  51.        
  52.         if ( $stmt->fetch() ) {
  53.            
  54.                 $_SESSION['loggedIn'] = true;
  55.  
  56.              
  57.                 $user = array(
  58.                     "emails_home" =>$user_row["emails_home"],
  59.                     "lastname" =>$user_row["lastname"],
  60.                     "firstname" =>$user_row["firstname"]
  61.                 );
  62.  
  63.              $_SESSION["user"] = $user;
  64.                
  65.             $URL="ingelogd.php";
  66.             header ("Location: $URL");
  67.            
  68.         } else {
  69.             echo 'alias of paswoord niet correct';
  70.         }
  71.         $stmt->close();
  72.     }
  73.    
  74. }
  75. ?>
  76. </body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement