Advertisement
Guest User

Untitled

a guest
Jan 31st, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2.  
  3. include 'dbh.php';
  4. session_start();
  5. $username= $_POST['username'];
  6. $email= $_POST['email'];
  7. $password= $_POST['password'];
  8. $password2= $_POST['password2'];
  9. if($password == $password2){
  10. $sql="INSERT INTO user(username,email,password) values('$username','$email','$password')";
  11. $query=mysqli_query($conn,$sql) or Die("ERROR: ".mysqli_error($conn));
  12. if($query === FALSE){
  13. die(mysql_error());
  14. }
  15. else {
  16. $row=mysqli_fetch_row($query);
  17. $id=$row["id"];
  18. $_SESSION['id']=$id;
  19. $_SESSION['username']=$username;
  20. header("location:user.php");
  21. }
  22. }else {
  23. echo "Password doesn't match";
  24. }
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement