forked from william1099/BasicEcommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSignup.php
103 lines (82 loc) · 2 KB
/
Signup.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
<?php
if (isset($_POST["Signup"])) {
$username = htmlentities(strip_tags(trim($_POST["username"])));
$password = htmlentities(strip_tags(trim($_POST["password"])));
include ("connect.php");
$username = mysqli_real_escape_string($connectdb, $username);
$password = mysqli_real_escape_string($connectdb, $password);
$query = "INSERT INTO akun (username,password) VALUES('$username', '$password')";
$result = mysqli_query($connectdb, $query);
if ($result) {
header("Location: login.php");
}
else {
echo mysqli_error($connectdb);
}
}
else {
$username="";
$password ="";
}
?>
<html>
<style>
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
.cancelbtn {
padding: 14px 20px;
background-color: #f44336;
}
.cancelbtn,.signupbtn {
float: left;
width: 50%;
}
.container {
padding: 16px;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
@media screen and (max-width: 300px) {
.cancelbtn, .signupbtn {
width: 100%;
}
}
</style>
<body>
<h2 style="text-align:center">Register</h2>
<center>
<div style="width:500px">
<form action="Signup.php" method="post" style="border:1px solid #ccc">
<div class="container">
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="username" value="<?php echo $username; ?>" required>
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="password" value="<?php echo $password; ?>" required>
<div class="clearfix">
<button type="button" class="cancelbtn">Cancel</button>
<button type="submit" class="signupbtn" name="Signup" value="Signup">Singup</button>
</div>
</div>
</form>
</div>
</center>
</body>
</html>