-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
102 lines (83 loc) · 2.37 KB
/
index.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
<?php
/**
*
*@file index.php
*@author xieyoujiang
*@Data 2016年1月25日
*@language PHP
*@E-mail xie_youjiang@163.com
*@copyright(c) 扬州格佳科技有限公司
*
*/
require_once './init.php';
require_once './classpackage/DataDetails.php';
require_once './classpackage/User.class.php';
require_once './classpackage/Box.class.php';
if(isset($_SESSION['userId']) && isset($_SESSION['rank']))
{
if($_SESSION['rank']=="1")//系统管理员
{
$smarty->display('welcome.html');
}
else if($_SESSION['rank']=="2")//操作员
{
header("location:worker.php");
}
else
{
header("location:select.php");//管理员
}
exit;
}
if(isset($_POST['login']))
{
require_once(dirname(dirname(__FILE__)).'/lib/cls_captcha.php');
/* $validator = new captcha();
if (!$validator->check_word($_POST['captcha']))
{
echo "<script>alert('captcha error!');history.back();</script>";
exit;
}*/
//
$bRet = User::checkLogin($_POST['userId'], $_POST['pwd']);
$rank = User::getByName($_POST['userId']);
if( $bRet == true )
{
if($rank['F_RANK'] == 1 || $rank['F_RANK'] == 3)
{
$arrayList = array(date('Y-m-d H:i:s',time()),date('Y-m-d H:i:s',time()),$_SERVER['REMOTE_ADDR'], $_POST['userId']);
$bRet = User::updataStatus($arrayList);
if($bRet == true)
{
//获取待处理的箱门
$waitDeal = DataDetails::getNeedData();
//获取处理完成的箱门
$dealed = DataDetails::getDealed();
//获取处理的历时记录
$hisDeal = DataDetails::getHistoryDeal();
$_SESSION['userId']=$_POST['userId'];
$smarty->assign("waitDeal",$waitDeal);
$smarty->assign("dealed",$dealed);
$smarty->assign("hisDeal",array_slice($hisDeal,0,25));
$smarty->display('monitor.html');
}
}
else if($rank['F_RANK'] == 2)
{
$record = Box::getBoxbyName($rank['F_FULLNAME']);
// print_r($record);
$smarty->assign("boxBean",$record);
$smarty->display('operator.html');
}
}
else
{
echo "<script lanugage='javascript'>alert('用户名密码错误');history.back();</script>";
$smarty->display('login.html');
}
}
else
{
$smarty->display('login.html');
}
?>