Advertisement
Guest User

Untitled

a guest
Apr 5th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <?php include("db.php"); ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5.     <title>EasySchool</title>
  6.     <meta charset="utf-8">
  7.     <link rel="stylesheet" type="text/css" href="css/styles.css">
  8.     <link rel="shortcut icon" href="img/schoolwin.png">
  9.    
  10. </head>
  11. <body>
  12.  
  13.        <?php include("include/navbar.php"); ?>
  14.  
  15.          <h1>Inscription </h1>
  16.  
  17.  
  18.     <form method="post" class="forminscription">
  19.          <input type="text" name="pseudo" id="pseudo" class="inputbasic">
  20.          <input type="password" name="password" id="password" class="inputbasic">
  21.          <input type="email" name="email" id="email" class="inputbasic mail">
  22.          <input type="text" name="name" id="name" class="inputbasic">
  23.          <input type="text" name="surname" id="surname" class="inputbasic">
  24.          <input type="submit" name="formsend" id="formsend">
  25.      </form>
  26.  
  27.      <?php if(isset($_POST['formsend'])){
  28.  
  29.               $pseudo = $_POST['pseudo'];
  30.               $password = $_POST['password'];
  31.               $email = $_POST['email'];
  32.               $name = $_POST['name'];
  33.               $surname = $_POST['surname'] ;
  34.  
  35.           if(!empty($pseudo) && !empty($password) && !empty($email) && !empty($name) && !empty($surname)){                                       
  36.  
  37.             $options = [
  38.                 'cost' => 12,
  39.             ];
  40.  
  41.             $hashpass = password_hash($password, PASSWORD_BCRYPT, $options);
  42.  
  43.             $req = $pdo->prepare('INSERT INTO user SET username =  ?, password = ?, email =  ?, name = ?, surname = ?');
  44.             $req->execute([
  45.                 $pseudo,
  46.                 $hashpass,
  47.                 $email,
  48.                 $name,
  49.                 $surname   
  50.                 ]);
  51.            
  52.     }
  53.  
  54.      } ?>
  55.  
  56.       <?php include("include/footer.php"); ?>
  57.  
  58. </body>
  59.  
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement