Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'koneksi.php';
- if($_POST['user']){
- $user=$_POST['user'];
- $email=$_POST['email'];
- $pass=$_POST['password'];
- $pass2=$_POST['password2'];
- // cek data
- if ($user&&$email&&$pass&&$pass2) {
- if (strlen($user)>10) {
- echo "Username maksimal 10 character";
- }else {
- if (strlen($pass)>16 || strlen($pass2)<6) {
- echo "Password 6-16 character";
- } else {
- $cek=mysqli_query($conn,"SELECT * FROM out WHERE user='$user'");
- $cek2=mysqli_num_rows($cek);
- if ($cek == 0) {
- $pass=md5($pass);
- $isi=mysqli_query($conn ,"INSERT INTO out VALUES ('','$user','$email','$pass','$pass2')");
- if ($isi) {
- echo "BERHASIL";
- }else {
- echo "GAGAL";
- }
- }else {
- echo "Username telah digunakan";
- }
- }
- }
- }else {
- echo "Isi data dengan lengkap";
- }
- } else {
- }
- ?>
- <script type="text/javascript">
- function konfirpass()
- {
- password1 = document.getElementById("pw1").value;
- password2 = document.getElementById("pw2").value;
- if(password1.value == password2.value){
- return true;
- } else {
- alert("Samain Passwordnya gan");
- returnToPreviousPage();
- return false;
- }
- }
- </script>
- <form method="POST" action="" onsubmit="return konfirpass();">
- <input type="text" name="user">
- <input type="email" name="email">
- <input type="password" name="password" id="pw1">
- <input type="password" name="password2" id="pw2">
- <input type="submit">
- </form>P
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement