01.
<?
02.
session_start();
03.
$ref
=
$_SERVER
[
'HTTP_REFERER'
];
04.
?>
05.
<!DOCTYPE HTML>
06.
<html>
07.
<head>
08.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
09.
<title>KingdomofGolf - Login Check testpage</title>
10.
<link href=
"../css/bootstrap.css"
rel=
"stylesheet"
type=
"text/css"
>
11.
<?
?>
12.
<meta http-equiv=
'REFRESH'
content=
'1;url=<? echo "$ref"; ?>'
>
13.
</head>
14.
<body>
15.
<?
16.
17.
18.
19.
require
(
"../function/pass_encode.php"
);
20.
21.
$username
=
addslashes
(
$_POST
[
'username'
]);
22.
$password
=
addslashes
(
$_POST
[
'password'
]);
23.
$password
=hashPassword(
$password
);
24.
$alwayslogin
=
addslashes
(
$_POST
[
'alwayslogin'
]);
25.
if
(checkPassword(
$_POST
[username],
$_POST
[password]))
26.
{
27.
?>
28.
<table align=
'center'
width=
'80%'
cellpadding=
'10'
><tr><td align=
'center'
>
29.
<div
class
=
"container text-center"
>
30.
<div
class
=
"alert alert-success"
>
31.
<strong>เข้าสู่ระบบแล้ว</strong><br>
32.
<?
33.
if
(
$_POST
[username]!=
''
){
34.
echo
"สวัสดีครับคุณ $username<br>"
;
35.
}
36.
$_SESSION
[
'logon'
]=
"1"
;
37.
$_SESSION
[
'mainusername'
]=
$username
;
38.
$_SESSION
[
'mainpassword'
]=
$password
;
39.
$_SESSION
[
'otp'
]=createotp(
$username
);
40.
if
(
$alwayslogin
==
"alwayslogin"
)
41.
{
42.
setcookie(
"mainusername"
,
$username
,time()+3600*24*356);
43.
setcookie(
"mainpassword"
,
$password
,time()+3600*24*356);
44.
setcookie(
"otp"
,
$otp
,time()+3600*24*356);
45.
}
46.
?>
47.
<span
class
=
"label label-warning"
>ระบบนี้เป็นแค่การทดสอบ</span>
48.
</div>
49.
</div>
50.
</td></tr></table>
51.
<?
52.
}
53.
else
54.
{
55.
?>
56.
<table align=
'center'
width=
'80%'
cellpadding=
'10'
><tr><td align=
'center'
>
57.
<div
class
=
"container text-center"
>
58.
<div
class
=
"alert alert-error"
>
59.
ชื่อผู้ใช้หรือรหัสผ่านผิด
60.
</div>
61.
</div>
62.
</td></tr></table>
63.
<?
64.
}
65.
?>
66.
</body>
67.
</html>