-
Notifications
You must be signed in to change notification settings - Fork 0
/
registrasi.php
103 lines (91 loc) · 3.03 KB
/
registrasi.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
include "config.php";
error_reporting(0);
session_start();
if (isset($_SESSION['username'])) {
header("Location: login.php");
}
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$email = $_POST['email'];
$password = md5($_POST['password']);
$cpass = md5($_POST['confirmpass']);
if ($password == $cpass) {
$sql = "SELECT * FROM user WHERE email='$email'";
$result = mysqli_query($koneksi, $sql);
if (!$result->num_rows > 0) {
$sql = "INSERT INTO user (username, email, password)
VALUES ('$username', '$email', '$password')";
$result = mysqli_query($koneksi, $sql);
if ($result) {
echo "<script>alert('Berhasil Registrasi!')
document.location='login.php';</script>";
$username = "";
$email = "";
$_POST['password'] = "";
$_POST['confirmpass'] = "";
} else {
echo "<script>alert('Error!')</script>";
}
} else {
echo "<script>alert('Email Sudah Digunakan')</script>";
}
} else {
echo "<script>alert('Password Tidak Cocok')</script>";
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Registrasi</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="anm">
<p>SMK</p>
<b>
<div class="titleanm">
Bina Informatika <br />
Yang paling Keren <br />
Yang Paling Nyaman <br />
Yang Paling Pintar <br />
Yang Paling Canggih
</div>
</b>
</div>
<div class="img">
<img src="school.png" alt="">
</div>
<div class="wrapper">
<div class="title">
Register
</div>
<form method="post" action="">
<div class="field">
<input type="text" name="username" value="<?php echo $username; ?>" required>
<label>Username</label>
</div>
<div class="field">
<input type="email" name="email" value="<?php echo $email; ?>" required>
<label>Email</label>
</div>
<div class="field">
<input type="password" name="password" value="<?php echo $_POST['password']; ?>" required>
<label>Password</label>
</div>
<div class="field">
<input type="password" name="confirmpass" value="<?php echo $_POST['confirmpass']; ?>" required>
<label>Confirm Password</label>
</div>
<div class="signup-link">
Sudah Punya Akun? <a href="login.php">Login</a>
</div>
<div class="field">
<input type="submit" name="submit" value="Registrasi">
</div>
</form>
</div>
</body>
</html>