-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaftarAkunNext.php
101 lines (89 loc) · 2.94 KB
/
daftarAkunNext.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
include "config.php";
if(isset($_POST['kirim'])) {
$depan = $_POST['depan'];
$belakang = $_POST['belakang'];
$userBiasa = $_POST['username'];
$email = $_POST['email'];
$namaKost = $_POST['namaKost'];
$pass1 = $_POST['password1'];
$pass2 = $_POST['password2'];
$dfbg = mysql_query("SELECT *, COUNT(*) AS jumlah FROM userBiasa WHERE userBiasa = '$userBiasa'");
$bgd = mysql_fetch_array($dfbg);
$tidak = 1;
if($depan == "" || $belakang == "") { ?>
<script type="text/javascript">
var depan = document.getElementById('depan');
var belakang = document.getElementById('belakang');
depan.focus();
document.getElementById('pesanNama').innerHTML = "Nama tidak boleh kosong";
</script>
<?php
$tidak = 0;
}
if($userBiasa == "") { ?>
<script type="text/javascript">
var userBiasa = document.getElementById('username');
userBiasa.focus();
document.getElementById('pesanUser').innerHTML = "Username tidak boleh kosong";
</script>
<?php
$tidak = 0;
}
if($email == "") { ?>
<script type="text/javascript">
var email = document.getElementById('email');
email.focus();
document.getElementById('pesanEmail').innerHTML = "Email tidak boleh kosong";
</script>
<?php
$tidak = 0;
}
if($pass1 == null) { ?>
<script type="text/javascript">
var pass1 = document.getElementById('password1');
pass1.focus();
document.getElementById('pesanPass').innerHTML = "Password tidak boleh kosong";
</script>
<?php
$tidak = 0;
}
if($pass2 == null) { ?>
<script type="text/javascript">
var pass2 = document.getElementById('password2');
pass2.focus();
document.getElementById('pesanKonfir').innerHTML = "Konfirmasi password tidak boleh kosong";
</script>
<?php
$tidak = 0;
}
if($bgd['jumlah'] >= 1 && $tidak == 1) {
echo " <script>
alert('Username sudah digunakan!!!');
username.focus();
</script>";
} elseif(($pass1 != $pass2) && $tidak == 1) {
echo " <script>
var pass1 = document.getElementById('password1');
document.getElementById('pesanKonfir').innerHTML = 'Password dan Konfirmasi tidak sama';
pass1.focus();
</script>";
} elseif(($pass1 == $pass2) && $tidak == 1) {
$ghfgf = mysql_fetch_array(mysql_query("SELECT * FROM dataKost WHERE nama = '$namaKost'"));
$ffdgg = mysql_fetch_array(mysql_query("SELECT * FROM kapasitasKost WHERE id_kost = $ghfgf[id]"));
if($ffdgg['kapasitas'] > 0) {
mysql_query("INSERT INTO userBiasa VALUES('', '$depan', '$belakang', '$userBiasa', '$email', '$namaKost', '$pass1', '0')");
mysql_query("UPDATE kapasitasKost SET kapasitas = kapasitas - 1 WHERE id_kost = $ghfgf[id]");
echo "<script>alert('Pendaftaran sukses, silahkan tunggu di verifikasi Admin');</script>";
unset($_POST);
} else {
echo "
<script>
alert('Kost sudah penuh!');
var password1 = document.getElementById('depan');
password1.focus();
</script>";
}
}
}
?>