-
Notifications
You must be signed in to change notification settings - Fork 25
/
daftar.input.php
45 lines (34 loc) · 1.75 KB
/
daftar.input.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
<?php
error_reporting(0);
include "config/koneksi.php";
$username = $_POST['username'];
$password = $_POST['password2'];
$email = $_POST['email'];
$enkrip_pass= md5($password);
$nohp = $_POST['nohp'];
$cek_username=mysqli_num_rows(mysqli_query
($mysqli,"SELECT username FROM tbl_user
WHERE username='$username'"));
$cek_email=mysqli_num_rows(mysqli_query
($mysqli,"SELECT email FROM tbl_user
WHERE email='$email'"));
if ($cek_username > 0) {
echo "<div id='gagal' class='alert alert-danger'>Maaf Username sudah terdaftar<button type='button' class='close' data-dismiss='alert'><i class='fa fa-times'></i></button></div>";
}
else if ($cek_email > 0){
echo "<div id='gagal' class='alert alert-danger'>Mohon maaf Email anda sudah terdaftar<button type='button' class='close' data-dismiss='alert'><i class='fa fa-times'></i></button></div>";
}else {
$input = mysqli_query($mysqli, "INSERT INTO tbl_user(id_user,username,
pass,
email,
level_user,photo,nohp)
VALUES('','$username',
'$enkrip_pass',
'$email',
'1','assets/img/logosaga.png','$nohp')");
if ($input > 0) {
echo "<div class='alert alert-success'><button type='button' class='close' data-dismiss='alert'><i class='fa fa-times'></i></button><strong><i class='fa fa-check'></i> BERHASIL </strong>Silahkan <a href='index.php'>Login</a><br/></div>";
} else {
echo "<div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert'><i class='fa fa-times'></i></button><strong><i class='fa fa-times'></i> MAAF! </strong>" . mysqli_error($mysqli) . "<br/></div>";
}
}