-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminkpumstialanbandung.php
164 lines (142 loc) · 5.28 KB
/
adminkpumstialanbandung.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
<?php
include "inc/koneksi.php";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>E VOTING | Log in</title>
<link rel="icon" href="dist/img/votinglogo.png">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
<!-- Ionicons -->
<!--<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">-->
<!-- icheck bootstrap -->
<!--<link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css">-->
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/adminlte.min.css">
<!-- Google Font: Source Sans Pro -->
<!--<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">-->
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo">
<img src="dist/img/votingbaru.png" width=170px />
<br>
<a href="login.php">
<b>E-Voting Politeknik STIA LAN Bandung</b>
</a>
</div>
<!-- /.login-logo -->
<div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">Login System</p>
<form action="" method="post">
<div class="input-group mb-3">
<input type="number" class="form-control" name="npm" placeholder="NPM" required>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-user"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" name="password" placeholder="Password" required>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-12 mb-3">
<button type="submit" class="btn btn-warning btn-block btn-flat" id="masuk" name="btnLogin" title="Masuk Sistem">
<b>Masuk</b>
</button>
</div>
<!-- <div class="col-12">
<a href="daftar_pemilih.php" class="btn btn-info btn-block btn-flat">
<i class=""></i> Daftar</a>
</button>
</div> -->
</form>
</div>
</div>
</div>
<!-- /.login-box -->
<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- Alert -->
<script src="plugins/alert.js"></script>
</body>
</html>
<script>
function myFunction() {
var x = document.getElementById("masuk");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Select2 -->
<script src="plugins/select2/js/select2.full.min.js"></script>
<!-- DataTables -->
<!--<script src="plugins/datatables/jquery.dataTables.js"></script>-->
<script src="plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<!-- page script -->
<script src="plugins/jquery-datatable/extensions/export/dataTables.buttons.min.js"></script>
<script src="plugins/jquery-datatable/extensions/export/buttons.flash.min.js"></script>
<script src="plugins/jquery-datatable/extensions/export/jszip.min.js"></script>
<!--<script src="plugins/jquery-datatable/extensions/export/pdfmake.min.js"></script>-->
<script src="plugins/jquery-datatable/extensions/export/vfs_fonts.js"></script>
<script src="plugins/jquery-datatable/extensions/export/buttons.html5.min.js"></script>
<script src="plugins/jquery-datatable/extensions/export/buttons.print.min.js"></script>
<?php
if (isset($_POST['btnLogin'])) {
//anti inject sql
$npm=mysqli_real_escape_string($koneksi,$_POST['npm']);
$password=mysqli_real_escape_string($koneksi,$_POST['password']);
//query login
$sql_login = "SELECT * FROM tb_pengguna WHERE BINARY npm='$npm' AND password='$password'";
$query_login = mysqli_query($koneksi, $sql_login);
$data_login = mysqli_fetch_array($query_login,MYSQLI_BOTH);
$jumlah_login = mysqli_num_rows($query_login);
if ($jumlah_login == 1 ){
session_start();
$_SESSION["ses_id"]=$data_login["id_pengguna"];
$_SESSION["ses_nama"]=$data_login["nama_pengguna"];
$_SESSION["ses_password"]=$data_login["password"];
$_SESSION["ses_npm"]=$data_login["npm"];
$_SESSION["ses_level"]=$data_login["level"];
$_SESSION["ses_status"]=$data_login["status"];
$_SESSION["ses_jenis"]=$data_login["jenis"];
echo "<script>
Swal.fire({title: 'Login Berhasil',text: '',icon: 'success',confirmButtonText: 'OK'
}).then((result) => {if (result.value)
{window.location = 'index.php';}
})</script>";
}else{
echo "<script>
Swal.fire({title: 'Login Gagal',text: '',icon: 'error',confirmButtonText: 'OK'
}).then((result) => {if (result.value)
{window.location = 'login';}
})</script>";
}
}