-
Notifications
You must be signed in to change notification settings - Fork 5
/
login.php
executable file
·230 lines (188 loc) · 5.79 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
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
<?php
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
//// SISFO-TOKO v2.1 ////
/////////////////////////////////////////////////////////
//// Dibuat Oleh : ////
//// Agus Muhajir, S.Kom ////
/////////////////////////////////////////////////////////
//// URL : http://hajirodeon.wordpress.com/ ////
//// E-Mail : hajirodeon@yahoo.com ////
//// HP/SMS : 081-829-88-54 ////
/////////////////////////////////////////////////////////
//// Milist : ////
//// http://yahoogroup.com/groups/linuxbiasawae/ ////
//// http://yahoogroup.com/groups/sisfokol/ ////
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
//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;
$diload = "document.formx.tipe.focus();";
$x_enter = 'onkeydown="return handleEnter(this, event)"';
$x_enter2 = 'onkeydown="if (keyCode == 13)
{
document.formx.btnOK.focus();
document.formx.btnOK.submit();
}"';
//PROSES ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($_POST['btnOK'])
{
//ambil nilai
$tipe = nosql($_POST["tipe"]);
$username = nosql($_POST["usernamex"]);
$password = md5(nosql($_POST["passwordx"]));
//cek
if ((empty($tipe)) OR (empty($username)) OR (empty($password)))
{
//re-direct
$pesan = "Input Tidak Lengkap. Harap Diulangi...!!";
pekem($pesan,$filenya);
exit();
}
else
{
//jika kasir/pembuat nota /////////////////////////////////////////////////////////////////////
if ($tipe == "tp01")
{
$q = mysqli_query($koneksi, "SELECT * FROM admks ".
"WHERE username = '$username' ".
"AND password = '$password'");
$row = mysqli_fetch_assoc($q);
$total = mysqli_num_rows($q);
//cek login
if ($total != 0)
{
session_start();
$_SESSION['kd2_session'] = nosql($row['kd']);
$_SESSION['username2_session'] = $username;
$_SESSION['pass2_session'] = $password;
$_SESSION['time2_session'] = $today;
$_SESSION['kasir_session'] = "PEMBUAT NOTA";
$_SESSION['hajirobe2_session'] = $hajirobe;
//time login
mysqli_query($koneksi, "UPDATE admks SET time_login = '$today' ".
"WHERE username = '$username' ".
"AND password = '$password'");
//null-kan
xclose($koneksi);
//re-direct
$ke = "admks/index.php";
xloc($ke);
exit();
}
else
{
//null-kan
xclose($koneksi);
//re-direct
pekem($pesan, $filenya);
exit();
}
}
//jika admin/pengelola ////////////////////////////////////////////////////////////////////////
else if ($tipe == "tp02")
{
//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'");
//null-kan
xfree($q);
xclose($koneksi);
//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();
//js
require("inc/js/down_enter.js");
//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>
<br>
<br>
Tipe :
<select name="tipe">
<option value="" selected></option>
<option value="tp01">Kasir</option>
<option value="tp02">Pengelola</option>
</select>,
Username :
<input name="usernamex" type="text" size="10" maxlength="15" '.$x_enter.'>,
Password :
<input name="passwordx" type="password" size="10" maxlength="15" '.$x_enter2.'>
<br>
<input name="btnBTL" type="reset" value="BATAL">
<input name="btnOK" type="submit" value="OK >>>">
</td>
<td width="300" valign="top">
<img src="'.$sumber.'/img/linux.gif" width="300" height="130" title="Bravo Freedom Software based Open Source...!!">
</td>
</tr>
</table>
<table width="990" bgcolor="'.$warna02.'" border="0" cellspacing="5" cellpadding="0">
<tr valign="top">
<td>
©2021. <strong>{versi}</strong>
</td>
</tr>
</table>
</form>';
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//isi
$isi = ob_get_contents();
ob_end_clean();
require("inc/niltpl.php");
//diskonek
xclose($koneksi);
exit();
?>