-
Notifications
You must be signed in to change notification settings - Fork 6
/
login.php
executable file
·144 lines (111 loc) · 2.86 KB
/
login.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
<?php
//ambil nilai
require("inc/config.php");
require("inc/fungsi.php");
require("inc/koneksi.php");
$tpl = LoadTpl("template/login_adm.html");
nocache;
//nilai
$filenya = "login.php";
$judul = $nama_toko;
//PROSES ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($_POST['btnOK'])
{
//ambil nilai
$username = nosql($_POST["usernamex"]);
$password = md5(nosql($_POST["passwordx"]));
//cek
if ((empty($username)) OR (empty($password)))
{
//re-direct
$pesan = "Input Tidak Lengkap. Harap Diulangi...!!";
pekem($pesan,$filenya);
exit();
}
else
{
//admin
$q = mysqli_query($koneksi, "SELECT * FROM admin ".
"WHERE username = '$username' ".
"AND password = '$password'");
$row = mysqli_fetch_assoc($q);
$total = mysqli_num_rows($q);
//cek login
if ($total != 0)
{
session_start();
//nilai - nilai
$_SESSION['kd1_session'] = nosql($row['kd']);
$_SESSION['username1_session'] = $username;
$_SESSION['pass1_session'] = $password;
$_SESSION['time1_session'] = $today;
$_SESSION['admin_session'] = "PENGELOLA";
$_SESSION['hajirobe1_session'] = $hajirobe;
//time login
mysqli_query($koneksi, "UPDATE admin SET time_login = '$today' ".
"WHERE username = '$username' ".
"AND password = '$password'");
//re-direct
$ke = "adm/index.php";
xloc($ke);
exit();
}
else
{
//null-kan
xfree($q);
xclose($koneksi);
//re-direct
$pesan = "PASSWORD SALAH. HARAP DIULANGI...!!!";
pekem($pesan, $filenya);
exit();
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//isi *START
ob_start();
//view //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo '<form action="'.$filenya.'" method="post" name="formx">
<table width="990" bgcolor="'.$warnaover.'" border="0" cellspacing="5" cellpadding="0">
<tr valign="top">
<td valign="top">
<h1>
'.$nama_toko.'
</h1>
<em>
'.$alamat_toko.', '.$nama_kota.'
</em>
<p>
Username :
<br>
<input name="usernamex" type="text" size="20" class="btn btn-info">
</p>
<p>
Password :
<br>
<input name="passwordx" type="password" size="20" class="btn btn-info">
</p>
<p>
<input name="btnOK" type="submit" value="LANJUT >>" class="btn btn-danger">
</p>
</td>
</tr>
</table>
<table width="990" bgcolor="'.$warna02.'" border="0" cellspacing="5" cellpadding="0">
<tr valign="top">
<td>
©2018. <strong>{versi}</strong>
</td>
</tr>
</table>
</form>';
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//isi
$isi = ob_get_contents();
ob_end_clean();
require("inc/niltpl.php");
//diskonek
xclose($koneksi);
exit();
?>