-
Notifications
You must be signed in to change notification settings - Fork 0
/
Daftar.php
51 lines (43 loc) · 1.47 KB
/
Daftar.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
<?php
include 'Database.php';
if (!empty($_POST['Username']) && !empty($_POST['Password']) && !empty($_POST['Nama']) && !empty($_POST['NoH']) && !empty($_POST['Email'])) {
$nama =$_POST['Nama'];
$noH =$_POST['NoH'];
$email =$_POST['Email'];
$username =$_POST['Username'];
$password =$_POST['Password'];
}
$resultq=mysqli_query($db, "select Username from akun where Username='$username'");
$result = mysqli_fetch_assoc($resultq);
if (empty($result)){
if ($nama != '' && $username != ''&& $noH != '' && $email != '' && $password != ''){
$dataq=mysqli_query($db, "select Email from akun where Email='$email'");
$data = mysqli_fetch_assoc($dataq);
echo $data;
if(empty($data)){
mysqli_query($db, "insert into akun (Nama, Username, Email, Password, NoH) values ('$nama', '$username', '$email', '$password', '$noH')");
echo '<script>
alert("Berhasil Didaftar");
window.location.href = "index.html";
</script>';
}
else {
echo '<script>
alert("Email Telah Terdaftar");
</script>';
}
}
else{
echo '<script>
alert("Harap tidak terdapat kotak yang kosong");
window.location.href = "Daftar.html";
</script>';
}
}
else {
echo '<script>
alert("Username Telah Terdaftar");
window.location.href = "Daftar.html";
</script>';
}
?>