Hadi1989

Untitled

Dec 26th, 2018
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     require_once 'conn.php';
  4.    
  5.     if(ISSET($_POST['register'])){
  6.         $username = $_POST['username'];
  7.         $password = $_POST['password'];
  8.         $firstname = $_POST['firstname'];
  9.         $lastname = $_POST['lastname'];
  10.        
  11.         $query = "INSERT INTO `member` (username, password, firstname, lastname) VALUES(:username, :password, :firstname, :lastname)";
  12.         $stmt = $conn->prepare($query);
  13.         $stmt->bindParam(':username', $username);
  14.         $stmt->bindParam(':password', $password);
  15.         $stmt->bindParam(':firstname', $firstname);
  16.         $stmt->bindParam(':lastname', $lastname);
  17.        
  18.         if($stmt->execute()){
  19.             $_SESSION['success'] = "Successfully created an account";
  20.             header('location: index.php');
  21.         }
  22.  
  23.     }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment