-
Notifications
You must be signed in to change notification settings - Fork 4
/
peserta-register.php
245 lines (221 loc) · 12.8 KB
/
peserta-register.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?php
echo '<script type="text/javascript" src="files/bower_components/sweetalert1/sweetalert.min.js"></script>';
session_start();
require_once 'auth/config.php';
if (isset($_POST['btnSubmit']) === true) {
$kode_pendaftar = "SMK-".rand(10000, 100000);
$username = htmlspecialchars($_POST['username']);
$email = htmlspecialchars($_POST['email']);
$password = htmlspecialchars($_POST['password']);
$confirm_password = htmlspecialchars($_POST['confirm_password']);
$role = 'peserta';
if ($confirm_password !== $password) {
echo "<script type='text/javascript'>
setTimeout(function () {
swal({
icon: 'error',
closeOnClickOutside: false,
closeOnEsc: false,
dangerMode: true,
className: 'red-bg',
buttons: false,
title: 'Ooopss, error',
text: 'Password yang anda masukkan tidak sesuai',
type: 'error',
timer: 2500,
showConfirmButton: false
});
},10);
window.setTimeout(function(){
window.location.replace('peserta-register');
} ,2500);
</script>";
return false;
}
$hashPassword = password_hash($password, PASSWORD_DEFAULT);
$saveData = mysqli_query($link, "INSERT INTO users_admin (id_admin, username, email, password, role) VALUES ('', '$username', '$email', '$hashPassword', '$role')");
if (mysqli_affected_rows($link) > 0) {
$sesKodePendaftar = $_SESSION['kode_pendaftar'] = $kode_pendaftar;
$_SESSION['username'] = $username;
$_SESSION['email'] = $email;
$_SESSION['role'] = $role;
$success = true;
}else{
$error = true;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PPDB - Peserta Daftar</title>
<!-- HTML5 Shim and Respond.js IE10 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 10]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="#">
<meta name="keywords" content="PPDB Online, PPDB SMKN5 Kota Bekasi, PPDB SMK">
<meta name="author" content="Zamzam Saputra">
<!-- Favicon icon -->
<link rel="icon" href="https://files.itszami.my.id/files/5e9de3ec54a74.jpg" type="image/x-icon">
<!-- Google font--><link href="http://fonts.googleapis.com/css?family=Quicksand:400,700%7CPT+Serif:400,700" rel="stylesheet">
<!-- Required Fremwork -->
<link rel="stylesheet" type="text/css" href="files\bower_components\bootstrap\css\bootstrap.min.css">
<!-- themify-icons line icon -->
<link rel="stylesheet" type="text/css" href="files\assets\icon\themify-icons\themify-icons.css">
<!-- ico font -->
<link rel="stylesheet" type="text/css" href="files\assets\icon\icofont\css\icofont.css">
<!-- Toastr -->
<link rel="stylesheet" type="text/css" href="files\bower_components\toastr\toastr.css">
<!-- Style.css -->
<link rel="stylesheet" type="text/css" href="files\assets\css\style.css">
<style>
*{
font-family: quicksand;
}
</style>
</head>
<body class="fix-menu">
<!-- Pre-loader start -->
<div class="theme-loader">
<div class="ball-scale">
<div class='contain'>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
<div class="ring"><div class="frame"></div></div>
</div>
</div>
</div>
<!-- Pre-loader end -->
<section class="login-block">
<!-- Container-fluid starts -->
<div class="container">
<div class="row">
<div class="col-sm-12">
<!-- Authentication card start -->
<form class="md-float-material form-material" method="post" action="">
<div class="text-center">
<!-- <img src="" alt="logo.png"> -->
</div>
<div class="auth-box card">
<div class="card-block">
<div class="row m-b-20">
<div class="col-md-12">
<h3 class="text-center">Peserta Daftar</h3>
</div>
</div>
<div class="form-group">
<?php if (isset($success)): ?>
<div class="alert alert-success background-success">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled text-white"></i>
</button>
<strong>Berhasil, copy dan simpan kode pendaftaran ini baik-baik <?= $kode_pendaftar; ?></strong>
</div>
<?php endif ?>
<?php if (isset($error)): ?>
<div class="alert alert-danger background-danger">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled text-white"></i>
</button>
<strong>Gagal, Periksa kembali data-data yang anda masukkan</strong>
</div>
<?php endif ?>
<?php if (isset($errorConfirmPassword)): ?>
<div class="alert alert-danger background-danger">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled text-white"></i>
</button>
<strong>Gagal, Confirm Password yang anda masukkan tidak sesuai.. </strong>
</div>
<?php endif ?>
</div>
<div class="form-group">
<input type="text" name="username" class="form-control" id="username" required="" autocomplete="off" autofocus placeholder="Username" minlength="4">
<span class="form-bar"></span>
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" id="email" required="" autocomplete="off" autofocus placeholder="Your Email Address">
<span class="form-bar"></span>
</div>
<div class="form-group">
<input type="password" name="password" minlength="6" class="form-control" id="password" required="" minlength="6" autocomplete="off" placeholder="Password">
<span class="form-bar"></span>
</div>
<div class="form-group">
<input type="password" name="confirm_password" minlength="6" class="form-control" id="confirm_password" required="" minlength="6" autocomplete="off" placeholder="Confirm Password">
<span class="form-bar"></span>
</div>
<div class="row m-t-25 text-left">
<div class="col-12">
<a href="dashboard/peserta/login">Sudah memiliki akun?</a>
</div>
</div>
<div class="row m-t-30">
<div class="col-md-12">
<button type="submit" name="btnSubmit" class="btn btn-primary btn-md btn-block waves-effect waves-light text-center m-b-20">Sign in</button>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-10">
<p class="text-inverse text-left m-b-0">Terima kasih</p>
<p class="text-inverse text-left"><a href="index"><b class="f-w-600">Back to website</b></a></p>
</div>
<div class="col-md-2">
<img src="smkn5.jpg" alt="small-logo.png" style="height: 45px;">
</div>
</div>
</div>
</div>
</form>
<!-- end of form -->
</div>
<!-- end of col-sm-12 -->
</div>
<!-- end of row -->
</div>
<!-- end of container-fluid -->
</section>
<!-- Warning Section Ends -->
<!-- Required Jquery -->
<script type="text/javascript" src="files\bower_components\jquery\js\jquery.min.js"></script>
<script type="text/javascript" src="files\bower_components\jquery-ui\js\jquery-ui.min.js"></script>
<script type="text/javascript" src="files\bower_components\popper.js\js\popper.min.js"></script>
<script type="text/javascript" src="files\bower_components\bootstrap\js\bootstrap.min.js"></script>
<!-- Toastr -->
<script type="text/javascript" src="files\bower_components\toastr\toastr.min.js"></script>
<!-- jquery slimscroll js -->
<script type="text/javascript" src="files\bower_components\jquery-slimscroll\js\jquery.slimscroll.js"></script>
<!-- modernizr js -->
<script type="text/javascript" src="files\bower_components\modernizr\js\modernizr.js"></script>
<script type="text/javascript" src="files\bower_components\modernizr\js\css-scrollbars.js"></script>
<!-- i18next.min.js -->
<script type="text/javascript" src="files\bower_components\i18next\js\i18next.min.js"></script>
<script type="text/javascript" src="files\bower_components\i18next-xhr-backend\js\i18nextXHRBackend.min.js"></script>
<script type="text/javascript" src="files\bower_components\i18next-browser-languagedetector\js\i18nextBrowserLanguageDetector.min.js"></script>
<script type="text/javascript" src="files\bower_components\jquery-i18next\js\jquery-i18next.min.js"></script>
<script type="text/javascript" src="files\assets\js\common-pages.js"></script>
<!-- Bootstrap Validate -->
<script type="text/javascript" src="files/bower_components/bootstrap-validate/bootstrap-validate.js"></script>
<script>
bootstrapValidate('#username', 'min: 4: Masukkan minimal 4 karakter');
bootstrapValidate('#email', 'email: Masukkan email yang valid');
bootstrapValidate('#password', 'min:6: Masukkan minimal 6 karakter');
bootstrapValidate('#confirm_password', 'matches:#password:Password yang anda masukkan tidak sesuai');
</script>
</body>
</html>