-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaftar.php
More file actions
72 lines (72 loc) · 2.14 KB
/
daftar.php
File metadata and controls
72 lines (72 loc) · 2.14 KB
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
<?php
session_start();
include 'koneksi.php';
?>
<?php include 'header.php'; ?>
<div class="kontainer">
<div class="row mb-3 mt-5 pb-3">
<div class="kolom-md-12 judulsection animasikontainer">
<h3 class="mb-4 text-tengah">Daftar</h3>
</div>
</div>
</div>
<div class="kontainer">
<div class="row">
<div class="kolom-md-12">
<div class="kartu">
<div class="jarakkartu">
<form method="post" class="form-horizontal">
<div class="form-grup">
<label class="label-gaya">Nama</label>
<input type="text" name="nama" class="bentukform" required>
</div>
<div class="form-grup">
<label class="label-gaya">Email</label>
<input type="email" name="email" class="bentukform" required>
</div>
<div class="form-grup">
<label class="label-gaya">Password</label>
<input type="text" name="password" class="bentukform" required>
</div>
<div class="form-grup">
<label class="label-gaya">Alamat</label>
<textarea class="bentukform" name="alamat" required></textarea>
</div>
<div class="form-grup">
<label class="label-gaya">Telepon</label>
<input type="text" name="telepon" class="bentukform">
</div>
<div class="form-grup ">
<br>
<button class="tombol" name="daftar">Daftar</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
if (isset($_POST["daftar"])) {
$nama = $_POST['nama'];
$email = $_POST['email'];
$password = $_POST['password'];
$alamat = $_POST['alamat'];
$telepon = $_POST['telepon'];
$ambil = $koneksi->query("SELECT*FROM pengguna
WHERE email='$email'");
$yangcocok = $ambil->num_rows;
if ($yangcocok == 1) {
echo "<script>alert('Pendaftaran Gagal, email sudah ada')</script>";
echo "<script>location='daftar.php';</script>";
} else {
$koneksi->query("INSERT INTO pengguna (nama, email, password, alamat, telepon, fotoprofil, level)
VALUES('$nama','$email','$password','$alamat','$telepon','Untitled.png','Pelanggan')");
echo "<script>alert('Pendaftaran Berhasil')</script>";
echo "<script>location='login.php';</script>";
}
}
?>
<?php
include 'footer.php';
?>