ZacharyVincze

Untitled

Jul 19th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7. $confirmpwd = $_POST['confirmpwd'];
  8.  
  9. $servername = '127.0.0.1';
  10. $loginusername = '';
  11. $loginpassword = 'notdoingthatagain';
  12. $dbname = '';
  13.  
  14. if ($username && $password && $confirmpwd) {
  15.    
  16.     if ($password == $confirmpwd) {
  17.         $connect = new mysqli($servername, $loginusername, $loginpassword, $dbname);
  18.    
  19.         if ($connect->connect_error) {
  20.             die("Connection failed: " . $conn->connect_error);
  21.         }
  22.    
  23.         $query = "INSERT INTO user (username, password) VALUES ('$username', '$password')";
  24.    
  25.         $result = $connect->query($query);
  26.        
  27.         echo $result;
  28.     } else {
  29.         echo "Confirm password did not match...";
  30.     }
  31. } else {
  32.     echo "Please fill in all the fields...";
  33. }
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment