-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaftar.php
125 lines (111 loc) · 4.02 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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include 'koneksi.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>MarketPlace</title>
<link rel="stylesheet" type="text/css" href="admin/assets/css/bootstrap.css">
</head>
<body>
<div class="container" style="margin-top:3%">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<p>
<center>
<h2>MarketPlace : Daftar</h2>
</center>
</p>
<br>
<div class="login-panel panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Daftar akun baru sekarang</h3>
</div>
<div class="panel-body">
<form class="form-horizontal" method="post">
<div class="box-body">
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: left">Nama</label>
<div class="col-sm-9">
<input type="text" name="nama" class="form-control" placeholder="Nama" required oninvalid="this.setCustomValidity('nama tidak boleh kosong')" oninput="setCustomValidity('')">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: left">Email</label>
<div class="col-sm-9">
<input type="email" name="email" class="form-control" placeholder="@ Email" required oninvalid="this.setCustomValidity('email tidak boleh kosong')" oninput="setCustomValidity('')">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: left">No. HP</label>
<div class="col-sm-9">
<input type="number" name="hp" class="form-control" placeholder="+62345678910" required oninvalid="this.setCustomValidity('no. hp tidak boleh kosong')" oninput="setCustomValidity('')">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: left">Username</label>
<div class="col-sm-9">
<input type="text" name="username" class="form-control" placeholder="Username" required oninvalid="this.setCustomValidity('username tidak boleh kosong')" oninput="setCustomValidity('')">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" style="text-align: left">Password</label>
<div class="col-sm-9">
<input type="password" name="password" class="form-control" placeholder="Password" required oninvalid="this.setCustomValidity('password tidak boleh kosong')" oninput="setCustomValidity('')">
</div>
</div>
</div>
<button type="submit" class="btn btn-lg btn-success btn-block" name="daftar">Daftar</button>
<div class="form-group">
<div class="col-sm-offset-0 col-sm-12">
<div class="checkbox">
<label>Sudah punya akun? <a href="login.php">Login</a></label>
</div>
</div>
</div>
</form>
<?php
if (isset($_POST["daftar"]))
{
$nama = $_POST['nama'];
$email = $_POST['email'];
$hp = $_POST['hp'];
$username = $_POST['username'];
$password = $_POST['password'];
$ambil = $koneksi->query("SELECT * FROM pelanggan WHERE email_pelanggan='$email'");
$yangcocok = $ambil->num_rows;
if ($yangcocok == 1)
{
echo "<script>alert('Pendaftaran gagal, email sudah digunakan.')</script>";
echo "<script>location='daftar.php'</script>";
}
else
{
$koneksi->query("INSERT INTO pelanggan (nama_pelanggan,
email_pelanggan,
hp_pelanggan,
username,
password)
VALUES
('$nama',
'$email',
'$hp',
'$username',
'$password')");
echo "<script>alert('Pendaftaran berhasil, silakan login.')</script>";
echo "<script>location='login.php'</script>";
}
}
?>
</div>
</div>
</div>
</div>
<center>Copyright @ 2019 by : <a href="index.php" target="_blank">MarketPlace</a> All rights reserved.</center>
</div>
<script type="text/javascript" src="style/jquery.js"></script>
<script type="text/javascript" src="style/bootstrap.js"></script>
<script type="text/javascript" src="script.js"></script>
</body>
</html>