Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <?php
  2. include 'koneksi.php';
  3. $user="ali";
  4. $email=$_POST['email'];
  5. $pass=$_POST['password'];
  6. $pass2=$_POST['password2'];
  7. // cek data
  8. // if ($user&&$email&&$pass&&$pass2) {
  9. // if (strlen($user)>10) {
  10. // echo "Username maksimal 10 character";
  11. // }else {
  12. // if (strlen($pass)>16 || strlen($pass2)<6) {
  13. // echo "Password 6-16 character";
  14. // }else {
  15. // if ($pass == $pass2) {
  16. $cek=mysqli_query($conn,"SELECT * FROM user WHERE username='$user'") or die(mysqli_error($conn));
  17. // $cek2=mysqli_num_rows($cek);
  18. // echo mysqli_num_rows($cek);
  19.  
  20. if (mysqli_num_rows($cek) < 1) {
  21. // $pass=md5($pass);
  22. // $pass=md5($pass2);
  23. $isi=mysqli_query($conn,"INSERT INTO user VALUES('','$user')") or die(mysqli_error($conn));
  24. if ($isi) {
  25. echo "BERHASIL";
  26. }else {
  27. echo "GAGAL";
  28. }
  29. }else {
  30. echo "Username telah digunakan";
  31. }
  32. // }else {
  33. // echo "Password tidak sama";
  34. // }
  35. // }
  36. // }
  37. // }else {
  38. // echo "Isi data dengan lengkap";
  39. // }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement