This commit is contained in:
廖勇坤 2024-08-13 17:39:55 +08:00
commit 5fa58adfeb
32 changed files with 1030 additions and 15 deletions

17
ErrorFiles/400.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/401.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/403.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/404.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/429.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/500.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/502.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/503.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/504.html Normal file

File diff suppressed because one or more lines are too long

17
ErrorFiles/510.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -1716,7 +1716,7 @@ where
// 韶关小岛 判断订单转让 // 韶关小岛 判断订单转让
$ol->show_transfer = 0; // 转让按钮 $ol->show_transfer = 0; // 转让按钮
$ol->order_transfer_name = null; $ol->order_transfer_name = null;
if($this->user->company_id == 58 || $this->user->company_id == 17){ if($this->user->company_id == 58 || $this->user->company_id == 17 || $this->user->company_id == 55 ){
// 获取该订单是否已被转让 // 获取该订单是否已被转让
$order_transfer_info = $this->db->query("select * from tb_meal_transfer where oid='{$ol->id}' and status>='0'")->row_array(); $order_transfer_info = $this->db->query("select * from tb_meal_transfer where oid='{$ol->id}' and status>='0'")->row_array();
$order_rule = $this->Mealtransfer_model->get_order_rule_info($ol->date_id); $order_rule = $this->Mealtransfer_model->get_order_rule_info($ol->date_id);

View File

@ -73,6 +73,11 @@ class Loginout extends CI_Controller
$adminInfo = $this->admin_model->get_admin_by_login($loginname, $password); $adminInfo = $this->admin_model->get_admin_by_login($loginname, $password);
if ($adminInfo) { if ($adminInfo) {
$status = $this->admin_model->get_company_status_by_companyId($adminInfo['company_id']);
if ($status['enabled'] != 1){
echo $this->lw_load->jsonResult(false, array('msg' => '该管理员关联的公司,【' . $status['company_name'] . '】公司已被停用!请联系电信管理员'));
exit;
}
$ip = $_SERVER["REMOTE_ADDR"]; $ip = $_SERVER["REMOTE_ADDR"];
/*if($adminInfo['company_id'] == 58) { /*if($adminInfo['company_id'] == 58) {
if(!($ip >= '113.106.130.130' && $ip <= '113.106.130.134') && !strstr($ip, '61.142.240.')) { if(!($ip >= '113.106.130.130' && $ip <= '113.106.130.134') && !strstr($ip, '61.142.240.')) {

View File

@ -289,6 +289,8 @@ class Meal extends CI_Controller{
$s = array(); $s = array();
$s['text'] = $info['notes']; $s['text'] = $info['notes'];
$field['notes'] = json_encode($s); $field['notes'] = json_encode($s);
}else{
$field['notes'] = '';
} }
if($info['end_time_type'] == 2){ if($info['end_time_type'] == 2){
$arr = explode(':',$info['end_time']); $arr = explode(':',$info['end_time']);

View File

@ -34,7 +34,7 @@ class Supplier extends CI_Controller {
public function lists($page) public function lists($page)
{ {
$this->load->library('lw_db',array('tb_name'=>'tb_dining_hall'),'tb_dining_hall'); $this->load->library('lw_db',array('tb_name'=>'tb_dining_hall'),'tb_dining_hall');
$rowsSupplier = $this->tb_supplier->get_all('*',array('enabled'=>1)); $rowsSupplier = $this->tb_supplier->get_all('*',array('enabled'=>1,'company_id'=>$this->session->userdata("companyId")));
$supplierHalls = array(); $supplierHalls = array();
foreach($rowsSupplier as $supplier){ foreach($rowsSupplier as $supplier){
$rowsHall = $this->tb_dining_hall->get_all('*',array('supplier_id'=>$supplier['id'])); $rowsHall = $this->tb_dining_hall->get_all('*',array('supplier_id'=>$supplier['id']));

View File

@ -225,4 +225,12 @@ class Admin_model extends CI_Model {
return $this->session->userdata('topRole'); return $this->session->userdata('topRole');
} }
//获取公司状态
public function get_company_status_by_companyId($companyId)
{
$sql = "select * from tb_company where id = '{$companyId}'";
$row = $this->db->query($sql)->row_array();;
return $row? $row : null;
}
} }

View File

@ -3,6 +3,12 @@ $adminInfo = isset($adminInfo)? $adminInfo : array();
$hallList = isset($hallList)? $hallList : array(); $hallList = isset($hallList)? $hallList : array();
$roleList = isset($roleList)? $roleList : array(); $roleList = isset($roleList)? $roleList : array();
?> ?>
<style>
.select2{
width: 100%!important;
}
</style>
<div class="modal-dialog modal-primary modal-lg"> <div class="modal-dialog modal-primary modal-lg">
<div class="modal-content"> <div class="modal-content">
<form id="submitForm"> <form id="submitForm">
@ -126,7 +132,9 @@ $roleList = isset($roleList)? $roleList : array();
</div> </div>
<script> <script>
$(function () { $(function () {
var submitForm = $('#submitForm'); $(".select2").select2({dropdownParent: $('#modalView')});
var submitForm = $('#submitForm');
var adminId = $("#admin-id").val(); var adminId = $("#admin-id").val();
submitForm.validate({ submitForm.validate({
rules: { rules: {

View File

@ -1,6 +1,7 @@
<?php <?php
$url = (is_mobile() == true) ? "./m/" : "./p/"; $url = (is_mobile() == true) ? "./m/" : "./p/";
header("Location: {$url}"); header("Location: {$url}");
function is_mobile() { return true; function is_mobile() { return true;
$user_agent = $_SERVER['HTTP_USER_AGENT']; $user_agent = $_SERVER['HTTP_USER_AGENT'];
$mobile_agents = array("dalvik", "240x320", "acer", "acoon", "acs-", "abacho", "ahong", "airness", "alcatel", "amoi", $mobile_agents = array("dalvik", "240x320", "acer", "acoon", "acs-", "abacho", "ahong", "airness", "alcatel", "amoi",

View File

@ -10434,7 +10434,8 @@ $(function () {
'"><span class="icon icon-delete"></span>清空</a><a class="button button-link button-fill button-warning pull-right" href="' + '"><span class="icon icon-delete"></span>清空</a><a class="button button-link button-fill button-warning pull-right" href="' +
initTheme(user.theme) + initTheme(user.theme) +
'?did=' + '?did=' +
meal.date_id + // meal.date_id +
meal['data'][0]['dc_type'] +
'&pid=' + '&pid=' +
ft.dining_hall_id + ft.dining_hall_id +
'" data-no-cache="true"><span class="icon icon-add"></span>增加</a></div></div></li>'; '" data-no-cache="true"><span class="icon icon-add"></span>增加</a></div></div></li>';

View File

@ -128,6 +128,12 @@ if($act == 'remotelogin') {
$db->query("update tb_user set err_count=err_count+1 where id=".$uid); $db->query("update tb_user set err_count=err_count+1 where id=".$uid);
echoRs(0, '帐号或密码错误'); echoRs(0, '帐号或密码错误');
} }
if (!empty($user['company_id'])) {
$company_info = array();
$company_info = $db->get_one("select * from tb_company where id = ".$user['company_id']);
if ($company_info['enabled']!=1)echoRs(0, $company_info['company_name'].'已被停用,请联系电信管理员!');
}
$db->query("update tb_user set err_count=0 where id=".$uid); $db->query("update tb_user set err_count=0 where id=".$uid);
$token = md5(uniqid()); $token = md5(uniqid());

17
show/ErrorFiles/400.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/401.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/403.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/404.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/429.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/500.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/502.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/503.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/504.html Normal file

File diff suppressed because one or more lines are too long

17
show/ErrorFiles/510.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,10 @@
<? <?
// echo "1";
// exit;
require_once(dirname(__FILE__)."/common.php"); require_once(dirname(__FILE__)."/common.php");
// 接收查询参数即URL路径参数后的查询参数params // 接收查询参数即URL路径参数后的查询参数params
$qs = $_SERVER['QUERY_STRING']; $qs = $_SERVER['QUERY_STRING'];
echo $qs;
// 读取发送到脚本的数据 // 读取发送到脚本的数据
$json = file_get_contents("php://input"); $json = file_get_contents("php://input");
@ -15,7 +17,7 @@ if(!$serialno) exit;
$deviceInfo = $db->get_one("select * from tb_pos_device where serialno = '".addslashes($serialno)."'"); $deviceInfo = $db->get_one("select * from tb_pos_device where serialno = '".addslashes($serialno)."'");
$device_id = intval($deviceInfo['id']); $device_id = intval($deviceInfo['id']);
// 获取远程地址 // 获取远程地址即访问的客户端ip地址
$ip = $_SERVER["REMOTE_ADDR"]; $ip = $_SERVER["REMOTE_ADDR"];
$s1 = $json; $s1 = $json;
@ -23,8 +25,15 @@ if(strlen($s1) > 2000) {
$s1 = substr($s1, 0, 2000).'..'; $s1 = substr($s1, 0, 2000).'..';
} }
// 插入POS机日志记录 // 于请求中获取了serialno、remote_addr信息
// 通过serialno从数据库中获取了设备信息在顶层中获取了记录id、company_id、dining_hall_id和channel_id信息
// 并于请求的POST参数中获取了sign和其他详细信息
// 同时将记录插入到日志中
// 插入POS机日志记录
// device_id serialno ip path request response addtime
$db->query("insert into tb_pos_device_log set device_id = {$device_id}, serialno = '".addslashes($serialno)."', ip = '".addslashes($ip)."', path = '".addslashes($qs)."', request = '".addslashes($s1)."', response = '', addtime = now() "); $db->query("insert into tb_pos_device_log set device_id = {$device_id}, serialno = '".addslashes($serialno)."', ip = '".addslashes($ip)."', path = '".addslashes($qs)."', request = '".addslashes($s1)."', response = '', addtime = now() ");
// 获取最近一次成功插入的记录的自增id
$log_id = $db->insert_id(); $log_id = $db->insert_id();
if(!$deviceInfo) { if(!$deviceInfo) {
$db->query("update tb_pos_device_log set response='no_device' where id=".$log_id); $db->query("update tb_pos_device_log set response='no_device' where id=".$log_id);
@ -44,6 +53,7 @@ if($sign2 !== $post['sign']) { //签名错误
} }
// 将api和data数据处理编码后插入到tb_pos_device_log表并终止脚本运行 // 将api和data数据处理编码后插入到tb_pos_device_log表并终止脚本运行
// 回应时填充参数、返回的API接口数据、错误提示等。
function response_pos($api, $data) { function response_pos($api, $data) {
global $deviceInfo, $post, $log_id, $db; global $deviceInfo, $post, $log_id, $db;
$noncestr = md5(microtime().'_'.rand()); $noncestr = md5(microtime().'_'.rand());
@ -67,13 +77,15 @@ function self_query($path, $post) {
return gquery("http://127.0.0.1:".$_SERVER['SERVER_PORT'].$path, $post, array('Host: '.$_SERVER['SERVER_NAME'])); return gquery("http://127.0.0.1:".$_SERVER['SERVER_PORT'].$path, $post, array('Host: '.$_SERVER['SERVER_NAME']));
} }
// 从post参数中获取pay_mode等参数 // 从post参数中获取pay_mode等参数实时消费接口中使用包括infoquery takemeal takemealok posonline
function pos_check_user() { function pos_check_user() {
global $post, $db, $company_id; global $post, $db, $company_id;
$pay_mode = $post['params']['pay_mode']; $pay_mode = $post['params']['pay_mode'];
$pay_code = $post['params']['pay_code']; $pay_code = $post['params']['pay_code'];
// 如果是二维码则检查二维码的字符串是否符合规则并从中截取获得code和哈希
// 返回code值和type
if($pay_mode == '5') { //二维码 if($pay_mode == '5') { //二维码
$qr_code = trim($post['params']['qr_code']); $qr_code = trim($post['params']['qr_code']);
if(!$qr_code) exit; if(!$qr_code) exit;
@ -116,47 +128,63 @@ function pos_check_user() {
// 顶层代码判断qs中参数 // 顶层代码判断qs中参数
if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳 if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
// 新增人员 // 新增人员
// 设备收到服务器心跳包响应需要执行人员增加之后,向服务器发送设备增加名单完成应答接口
if($qs == 'addperson' && $post['whitelist']) { if($qs == 'addperson' && $post['whitelist']) {
// 循环遍历人员名单
foreach($post['whitelist'] as $item) { foreach($post['whitelist'] as $item) {
// 将account_id中的yzms_前缀去掉
$uid = intval(str_replace('yzms_', '', $item['account_id'])); $uid = intval(str_replace('yzms_', '', $item['account_id']));
// 获取记录
$rec_id = intval($item['rec_id']); $rec_id = intval($item['rec_id']);
// 更新用户设备表中对应记录rec_id和对应用户uid的状态status=2表示确认增加成功
$db->query("update tb_pos_device_user set status=2,rs='".$item['result_code']."' where id = '{$rec_id}' and uid = '{$uid}'"); $db->query("update tb_pos_device_user set status=2,rs='".$item['result_code']."' where id = '{$rec_id}' and uid = '{$uid}'");
} }
} }
// 删除人员 // 删除人员
if($qs == 'delperson' && $post['whitelist']) { if($qs == 'delperson' && $post['whitelist']) {
// 循环遍历人员名单
foreach($post['whitelist'] as $item) { foreach($post['whitelist'] as $item) {
// 从account_id中去掉yzms_前缀
$uid = intval(str_replace('yzms_', '', $item['account_id'])); $uid = intval(str_replace('yzms_', '', $item['account_id']));
// 获取记录id
$rec_id = intval($item['rec_id']); $rec_id = intval($item['rec_id']);
$db->query("delete from tb_pos_device_user where id = '{$rec_id}' and uid = '{$uid}'"); $db->query("delete from tb_pos_device_user where id = '{$rec_id}' and uid = '{$uid}'");
} }
} }
// 心跳 // 如果当前查询并非心跳或者当前时间和设备的synctime差超过1分钟则执行
if($qs != 'heartbeat' || (time() - strtotime($deviceInfo['synctime']) > 60)) { //1分钟检测一次用户同步 if($qs != 'heartbeat' || (time() - strtotime($deviceInfo['synctime']) > 60)) { //1分钟检测一次用户同步
// 更新posdevice表的同步时间
$db->query("update tb_pos_device set synctime=now() where id = ".$device_id); $db->query("update tb_pos_device set synctime=now() where id = ".$device_id);
// 从tb_user表中获取所有启用且属于公司公司的用户列表
$userList_s = $db->get_all("select id, username, cellphone, deptname from tb_user where enabled = '1' and company_id = '{$company_id}'"); $userList_s = $db->get_all("select id, username, cellphone, deptname from tb_user where enabled = '1' and company_id = '{$company_id}'");
// 从tb_pos_device_user表中获取对应用户设备信息
// 新版Android取餐机宇航用于下发人脸、用户信息到Android取餐机用的记录表方便知道每台机现在的同步情况
$userList_d = $db->get_all("select * from tb_pos_device_user where device_id = '{$device_id}'"); $userList_d = $db->get_all("select * from tb_pos_device_user where device_id = '{$device_id}'");
// tb_user_face和tb_user表关联获取对应信息
// user user_face
$data = $db->get_all("select a.* from tb_user_face a, tb_user b where a.user_id=b.id and b.company_id = '{$company_id}'"); $data = $db->get_all("select a.* from tb_user_face a, tb_user b where a.user_id=b.id and b.company_id = '{$company_id}'");
$faceInfo = array(); $faceInfo = array();
// 提取上一步得到的关联信息并添加到faceInfo数组中判断此文件是否存在于服务器后台目录存在则将item信息存进dict数据中key是user_idvalue是item
foreach($data as $item) { foreach($data as $item) {
if(is_file("../backstage/".$item['path'])) { if(is_file("../backstage/".$item['path'])) {
$faceInfo[$item['user_id']] = $item; $faceInfo[$item['user_id']] = $item;
} }
} }
// 关联用户表和用户id卡表获取信息
$data = $db->get_all("select a.* from tb_user_idcard a, tb_user b where a.user_id=b.id and b.company_id = '{$company_id}' and a.state=1 order by a.id"); $data = $db->get_all("select a.* from tb_user_idcard a, tb_user b where a.user_id=b.id and b.company_id = '{$company_id}' and a.state=1 order by a.id");
$cardInfo = array(); $cardInfo = array();
// 提取上一步获取的信息并将数据循环加入到卡信息数组中类似List[Dict]key是user_idvalue是item
foreach($data as $item) { foreach($data as $item) {
$cardInfo[$item['user_id']] = $item; $cardInfo[$item['user_id']] = $item;
} }
// 从获取的该公司user_list表信息中循环遍历获取对应用户id的facecode,path,cardno信息添加到userList_s数组中
// 最终facecode,path和cardno作为用户设备需要下发的信息添加到userList_s中
foreach($userList_s as $key => $item) { foreach($userList_s as $key => $item) {
$uid = $item['id']; $uid = $item['id'];
$info1 = $faceInfo[$uid]; $info1 = $faceInfo[$uid];
@ -168,28 +196,40 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
} }
$sUserInfo = array(); $sUserInfo = array();
// 遍历更新完成的userList_s中数据存入sUserInfo数组中key是用户idvalue是对应的item信息
// ["id1" => {xx}, "id2" => {xx}, "id3" => {xx}]
foreach($userList_s as $item) { foreach($userList_s as $item) {
$sUserInfo[$item['id']] = $item; $sUserInfo[$item['id']] = $item;
} }
$dUserInfo = array(); $dUserInfo = array();
// 遍历获取的tb_pos_device_user表即用户设备表将其数据通过循环变为uid => item数据的数组
// 最终得到uid => item信息的数组
foreach($userList_d as $item) { foreach($userList_d as $item) {
$dUserInfo[$item['uid']] = $item; $dUserInfo[$item['uid']] = $item;
} }
// 从全局配置表中获取域名需要注意新版表中将class字段更改成了name字段
$row = $db->get_one("select * from tb_config where class = 'HOST'"); $row = $db->get_one("select * from tb_config where class = 'HOST'");
// 设置域名
$host = $row['value']; $host = $row['value'];
$addList = array(); //增加列表 $addList = array(); //增加列表
$maxcount = 100; $maxcount = 100;
// 遍历用户表
foreach($userList_s as $item) { foreach($userList_s as $item) {
$uid = $item['id']; $uid = $item['id'];
// 设备用户表不存在对应用户的信息
if(!$dUserInfo[$uid]) { if(!$dUserInfo[$uid]) {
// 往数组末尾添加一个item
$addList[] = $item; $addList[] = $item;
if(count($addList) >= $maxcount) break; //限制一次20个 if(count($addList) >= $maxcount) break; //限制一次20个
continue; continue;
} }
// 设备表的用户信息
$item2 = $dUserInfo[$uid]; $item2 = $dUserInfo[$uid];
// 如果设备用户表的记录和用户表的记录不一致
if( if(
($item2['facecode'].'') !== ($item['facecode'].'') ($item2['facecode'].'') !== ($item['facecode'].'')
|| ($item2['cardno'].'') !== ($item['cardno'].'') || ($item2['cardno'].'') !== ($item['cardno'].'')
@ -197,38 +237,47 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
|| ($item2['cellphone'].'') !== ($item['cellphone'].'') || ($item2['cellphone'].'') !== ($item['cellphone'].'')
|| ($item2['deptname'].'') !== ($item['deptname'].'') || ($item2['deptname'].'') !== ($item['deptname'].'')
) { ) {
// 则将item加到addList末尾
$addList[] = $item; $addList[] = $item;
if(count($addList) >= $maxcount) break; if(count($addList) >= $maxcount) break;
continue; continue;
} }
// 设备用户表的status为1表示已下发增加但还未收到确认并且距上次下发5分钟后还没收到确认
if($item2['status'] == 1 && time()-strtotime($item2['sendtime']) > 300) { //距上次下发5分钟后还没收到确认 if($item2['status'] == 1 && time()-strtotime($item2['sendtime']) > 300) { //距上次下发5分钟后还没收到确认
// 增加item到addList
$addList[] = $item; $addList[] = $item;
if(count($addList) >= $maxcount) break; if(count($addList) >= $maxcount) break;
continue; continue;
} }
} }
// 增加列表
if($addList) { if($addList) {
$whitelist = array(); $whitelist = array();
foreach($addList as $item) { foreach($addList as $item) {
$uid = $item['id']; $uid = $item['id'];
$face_url = ''; $face_url = '';
// 拼接人脸路径
if($item['facepath']) { if($item['facepath']) {
$face_url = 'https://'.$host.'/backstage/'.$item['facepath']; $face_url = 'https://'.$host.'/backstage/'.$item['facepath'];
} }
$row1 = $db->get_one("select * from tb_pos_device_user where device_id = '".addslashes($device_id)."' and uid = '".addslashes($uid)."'"); $row1 = $db->get_one("select * from tb_pos_device_user where device_id = '".addslashes($device_id)."' and uid = '".addslashes($uid)."'");
// sql拓展字符串
$sqlext = " name = '".addslashes($item['username'])."', cellphone = '".addslashes($item['cellphone'])."', deptname = '".addslashes($item['deptname'])."', cardno = '".addslashes($item['cardno'])."', facecode = '".addslashes($item['facecode'])."', sendtime = now(), status = 1, rs = '' "; $sqlext = " name = '".addslashes($item['username'])."', cellphone = '".addslashes($item['cellphone'])."', deptname = '".addslashes($item['deptname'])."', cardno = '".addslashes($item['cardno'])."', facecode = '".addslashes($item['facecode'])."', sendtime = now(), status = 1, rs = '' ";
// 如果用户设备表中没有对应设备id和用户id的数据
if(!$row1) { if(!$row1) {
// 插入记录
$db->query("insert into tb_pos_device_user set device_id = '".addslashes($device_id)."', uid = '".addslashes($uid)."', {$sqlext}, addtime = now() ", 'SILENT'); $db->query("insert into tb_pos_device_user set device_id = '".addslashes($device_id)."', uid = '".addslashes($uid)."', {$sqlext}, addtime = now() ", 'SILENT');
$log_id1 = $db->insert_id(); $log_id1 = $db->insert_id();
} else { } else {
// 有则更新
$db->query("update tb_pos_device_user set {$sqlext} where id=".$row1['id']); $db->query("update tb_pos_device_user set {$sqlext} where id=".$row1['id']);
$log_id1 = $row1['id']; $log_id1 = $row1['id'];
} }
// 人员名单
$whitelist[] = array ( $whitelist[] = array (
'rec_id' => $log_id1.'', //可为数据库中的唯一id可以是字符串可以是整数可为空字符 'rec_id' => $log_id1.'', //可为数据库中的唯一id可以是字符串可以是整数可为空字符
'account_id' => 'yzms_'.$uid, //帐号唯一50个字符必填 'account_id' => 'yzms_'.$uid, //帐号唯一50个字符必填
@ -260,6 +309,7 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
'whitelist' => $whitelist, 'whitelist' => $whitelist,
); );
// 响应增加人员的api向设备回送数据往设备增加人员信息
response_pos('addperson', $arr); response_pos('addperson', $arr);
exit; exit;
} }
@ -273,19 +323,25 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
foreach($userList_d as $item) { foreach($userList_d as $item) {
$uid = $item['uid']; $uid = $item['uid'];
// status为4表示已下发删除
if($item['status'] == 4) { if($item['status'] == 4) {
if(time()-strtotime($item['sendtime']) > 300) { //距上次下发删除5分钟后还没收到确认 if(time()-strtotime($item['sendtime']) > 300) { //距上次下发删除5分钟后还没收到确认
// 错误次数小于3
if($item['err_num'] < 3) { if($item['err_num'] < 3) {
// 更新用户设备表错误次数
$db->query("update tb_pos_device_user set sendtime = now(), status = 4, rs = '',err_num=err_num+1 where id=".$item['id']); $db->query("update tb_pos_device_user set sendtime = now(), status = 4, rs = '',err_num=err_num+1 where id=".$item['id']);
// 追加删除列表
$delList[] = $item; $delList[] = $item;
if(count($delList) >= $maxcount) break; //限制一次20个 if(count($delList) >= $maxcount) break; //限制一次20个
} else { } else {
// 错误次数大于等于3直接删除记录
$db->query("delete from tb_pos_device_user where id=".$item['id']); $db->query("delete from tb_pos_device_user where id=".$item['id']);
} }
} }
continue; continue;
} }
// 不在用户表中添加item到删除列表
if(!$sUserInfo[$uid]) { if(!$sUserInfo[$uid]) {
$delList[] = $item; $delList[] = $item;
if(count($delList) >= $maxcount) break; //限制一次20个 if(count($delList) >= $maxcount) break; //限制一次20个
@ -293,6 +349,7 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
} }
} }
// 数据更新完成,开始删除列表
if($delList) { if($delList) {
$whitelist = array(); $whitelist = array();
foreach($delList as $item) { foreach($delList as $item) {
@ -312,27 +369,34 @@ if($qs == 'heartbeat' || $qs == 'addperson' || $qs == 'delperson') { //心跳
'whitelist' => $whitelist, 'whitelist' => $whitelist,
); );
// 删除人员
response_pos('delperson', $arr); response_pos('delperson', $arr);
exit; exit;
} }
} }
// 记录
$records = $post['records']; $records = $post['records'];
$arr = array ( $arr = array (
'setmname' => '', 'setmname' => '',
); );
// 如果有记录
if($records) { if($records) {
$records2 = array(); $records2 = array();
// 遍历记录并将record的记录变成"id" => realid加入到record2中
// like: [[id => 1], [id => 2], [id => 3]...]
foreach($records as $item) { foreach($records as $item) {
$records2[] = array('id' => $item['id']); $records2[] = array('id' => $item['id']);
} }
$arr['records'] = $records2; $arr['records'] = $records2;
} }
// 服务器向设备回送心跳包,包括记录
response_pos('heartbeat', $arr); response_pos('heartbeat', $arr);
} }
// 在线消费,无消费确认,无查询,直接消费
else if($qs == 'real') { else if($qs == 'real') {
$api = $post['api']; $api = $post['api'];
if($api == 'takemeal' || $api == 'takemealok') { //取餐 if($api == 'takemeal' || $api == 'takemealok') { //取餐
@ -500,7 +564,6 @@ else if($qs == 'real') {
'sign' => '', 'sign' => '',
'Corrections' => '', 'Corrections' => '',
) )
), ),
'title' => '云中美食', 'title' => '云中美食',
'emp_fname' => $uInfo['username'], 'emp_fname' => $uInfo['username'],
@ -539,6 +602,7 @@ else if($qs == 'real') {
exit; exit;
} }
// 服务器向本机/api/usr/qrpay接口发送数据
$s = self_query("/api/user/qrpay", $post); $s = self_query("/api/user/qrpay", $post);
$rs = json_decode($s, true); $rs = json_decode($s, true);
if($rs['status'] != 1) { if($rs['status'] != 1) {

290
show/u.php Normal file
View File

@ -0,0 +1,290 @@
<?php
/* http://www.upupw.net */
/* webmaster@upupw.net */
$version = "20.5.18SF";
date_default_timezone_set('Asia/Shanghai') && error_reporting(0);
function _GET($n) { return isset($_GET[$n]) ? $_GET[$n] : NULL; }
function _SERVER($n) { return isset($_SERVER[$n]) ? $_SERVER[$n] : '[undefine]'; }
function memory_usage() { $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; return $memory;}
function micro_time_float() { $mtime = microtime(); $mtime = explode(' ', $mtime); return $mtime[1] + $mtime[0];}
function get_hash() {
return sha1(uniqid());
}
@session_start();
$currentTime = time();
$changeTime = 86400;
$rand = '';
if(isset($_SESSION['time']) and ($currentTime - $_SESSION['time']) < $changeTime) {
$rand = $_SESSION['rand'];
}else{
$_SESSION['time'] = $currentTime;
$_SESSION['rand'] = $rand = get_hash();
}
@header("content-Type: text/html; charset=utf-8");
define('YES', '<span style="color:#008000;font-weight:bold;">已开启</span>');
define('NO', '<span style="color:#999999;font-weight:bold;">未开启</span>');
if ($_POST['mysqlPort']=="") {
$host = "127.0.0.1";
} else {
$host = "127.0.0.1:".$_POST['mysqlPort'];
}
if ($_POST['mysqlUser']=="") {
$link = "";
} else {
$link = @mysqli_connect($host, $_POST['mysqlUser'], $_POST['mysqlPassword']);
}
$Info = array();
$Info['php_ini_file'] = function_exists('php_ini_loaded_file') ? php_ini_loaded_file() : '[undefine]';
$mcrypt = get_extension_funcs('mcrypt') ? YES : NO;
$xmlrpc = get_extension_funcs('xmlrpc') ? YES : NO;
$fileinfo = get_extension_funcs('fileinfo') ? YES : NO;
$ftp = get_extension_funcs('ftp') ? YES : NO;
$errno = mysqli_connect_errno();
$pinfo = $rand;
$up_start = micro_time_float();
if (_GET($pinfo) == 'phpinfo') {
if (function_exists('phpinfo')) phpinfo();
else echo "PHPINFO函数已被禁用无法正常显示详细信息!";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UPUPW PHP探针安全版</title>
<meta name="keywords" content="php探针,upupw探针,PHP探针安全版,php7探针,phpinfo,php扩展,数据库连接测试" />
<meta name="description" content="upupw php探针安全版兼容最新php7,需成功测试连接本地数据库后才显示phpinfo动态链接页面和网站路径,更安全的php探针." />
<meta name="author" content="UPUPW" />
<meta name="reply-to" content="webmaster@upupw.net" />
<meta name="copyright" content="UPUPW Team" />
<style type="text/css">
<!--
*{margin:0px;padding:0px;}
body {background-color:#FFFFFF;color:#000000;margin:0px;font-family:"\5fae\8f6f\96c5\9ed1",tahoma,arial,sans-serif;}
input {text-align:center;width:200px;height:20px;padding:5px;}
a:link {color:green; text-decoration:none;}
a:visited {color:green;text-decoration:none;}
a:active {color:green;text-decoration:none;}
a:hover {color:#ed776b;text-decoration:none;}
table {border-collapse:collapse;margin:10px 0px;clear:both;}
.inp tr th, td {padding:2px 5px 2px 5px;vertical-align:center;text-align:center;height:30px; border:1px #FFFFFF solid;}
.head1 {background-color:#2c3e50;width:100%;font-size:36px;color:#ffffff; padding-top: 10px; text-align: center; font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; }
.head2 {background-color:#1abc9c;width:100%;font-size:18px;height:18px;color:#ffffff;}
.el {text-align: center; background-color: #d3e1e5; }
.er {text-align: right; background-color: #d3e1e5; }
.ec {text-align: center; background-color: #1abc9c; font-weight: bold; color: #FFFFFF;}
.fl {text-align: left; background-color: #ecf0f1; color: #505050; }
.fr {text-align:right;background-color:#eeeeee;color:#505050;}
.fc {text-align: center; background-color: #ecf0f1; color: #505050; }
.ft {text-align:center;background-color: #D9F9DE;color:#060;}
a.arrow {font-family:webdings,sans-serif;font-size:10px;}
a.arrow:hover {color:#ff0000;text-decoration:none;}
-->
</style>
</head>
<body>
<div class="head1"><a href="http://www.upupw.net/tanzhen/n126.html" style="color:#ffffff" >{ UPUPW PHP 探针 }</a></div>
<div class="head2"></div>
<div style="margin:0 auto;width:1140px;overflow:hidden;">
<table width="100%" class="inp">
<tr>
<th colspan="2" class="ec" width="50%">服务器信息</th>
<th colspan="2" class="ec" width="50%">PHP功能组件开启状态</th>
</tr>
<tr>
<td class="er" width="12%">服务器域名</td>
<td class="fl" width="38%"><?=_SERVER('SERVER_NAME')?></td>
<td class="er" width="20%">MySQLi Client组件</td>
<td class="fc" width="30%"><?=get_extension_funcs('mysqli') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">服务器端口</td>
<td class="fl">
<?php if(isset($_POST['act'])) {?>
<?=($link)?_SERVER('SERVER_ADDR').':'._SERVER('SERVER_PORT'):"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<td class="er">cURL组件</td>
<td class="fc"><?=get_extension_funcs('curl') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">服务器环境</td>
<td class="fl"><?=stripos(_SERVER('SERVER_SOFTWARE'), 'PHP')?_SERVER('SERVER_SOFTWARE'):_SERVER('SERVER_SOFTWARE')?></td>
<td class="er">GD library组件</td>
<td class="fc"><?=get_extension_funcs('gd') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">PHP运行环境</td>
<td class="fl"><?=PHP_SAPI .' PHP/'.PHP_VERSION?></td>
<td class="er">EXIF信息查看组件</td>
<td class="fc"><?=get_extension_funcs('exif') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">PHP配置文件</td>
<td class="fl" style="word-break:break-all;word-wrap:break-word"><?php if(isset($_POST['act'])) {?>
<?=($link)?htmlentities($Info['php_ini_file']):"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<td class="er">OpenSSL协议组件</td>
<td class="fc"><?=get_extension_funcs('openssl') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">当前网站目录</td>
<td class="fl" style="word-break:break-all;word-wrap:break-word"><?php if(isset($_POST['act'])) {?>
<?=($link)?htmlentities(_SERVER('DOCUMENT_ROOT')):"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<?php
if(version_compare(PHP_VERSION,'7.0.0', '<')){
echo "<td class='er'>Mcrypt加密处理组件</td><td class='fc'>".$mcrypt."</td>";
}else{
echo "<td class='er'>FTP组件</td><td class='fc'>".$ftp."</td>";
}?>
</tr>
<tr>
<td class="er">服务器标准时</td>
<td class="fl">
<?=gmdate('Y-m-d H:i:s', time() + 3600 * 8)?>
</td>
<?php
if(version_compare(PHP_VERSION,'5.3.0', '<')){
echo "<td class='er'>XML-RPC组件</td><td class='fc'>".$xmlrpc."</td>";
}else{
echo "<td class='er'>FileInfo组件</td><td class='fc'>".$fileinfo."</td>";
}?>
</tr>
<tr>
<td class="er">便捷管理入口</td>
<td class="fl"><?php if(isset($_POST['act'])) {?>
<?=($link)?"<a target='_blank' href='?$pinfo=phpinfo'>PHPINFO详细信息</a>":"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<td class="er">Mbstring组件</td>
<td class="fc"><?=get_extension_funcs('mbstring') ? YES : NO ?></td>
</tr>
</table>
<table width="100%" class="inp">
<tr>
<td colspan="4" class="ec" width="50%">PHP Zend解密组件</td>
<td colspan="4" class="ec" width="50%">PHP 缓存优化组件</td>
</tr>
<tr>
<td class="el">Zend Optimizer</td>
<td class="el">Zend GuardLoader</td>
<td class="el">ionCubeLoader</td>
<td class="el">SourceGuardian</td>
<td class="el">WinCache</td>
<td class="el">Zend OPcache</td>
<td class="el">Redis</td>
<td class="el">Memcache</td>
</tr>
<tr>
<td class="fc"><?=get_extension_funcs('Zend Optimizer') ? YES.' / '.OPTIMIZER_VERSION : NO ?></td>
<td class="fc"><?=get_extension_funcs('Zend Guard Loader') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('ionCube Loader') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('SourceGuardian') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('WinCache') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('Zend OPcache') ? YES : NO ?></td>
<td class="fc"><?=phpversion('redis') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('memcache') ? YES : NO ?></td>
</tr>
<tr>
<td colspan="8" class="ft"><?=PHP_SAPI .' PHP/'.PHP_VERSION?>不完全包括以上组件,不同PHP版本能适配的外部扩展不同,为了性能以上组件除网站特别要求外没必要全开启!</td>
</tr>
</table>
<table width="100%" class="inp">
<tr>
<td colspan="6" class="ec" width="100%">PHP重要参数检测</td>
</tr>
<tr>
<td class="el">Memory限制</td>
<td class="el">Upload限制</td>
<td class="el">POST限制</td>
<td class="el">Execution超时</td>
<td class="el">Input超时</td>
<td class="el">Socket超时</td>
</tr>
<tr>
<td class="fc"><?=ini_get('memory_limit')?></td>
<td class="fc"><?=ini_get('upload_max_filesize')?></td>
<td class="fc"><?=ini_get('post_max_size')?></td>
<td class="fc"><?=ini_get('max_execution_time').'s'?></td>
<td class="fc"><?=ini_get('max_input_time').'s'?></td>
<td class="fc"><?=ini_get('default_socket_timeout').'s'?></td>
</tr>
</table>
<table width="100%" class="inp">
<tr>
<th class="ec">PHP已编译模块检测</th>
</tr>
<tr>
<td class="fl" style="text-align:center;">
<?php
$able=get_loaded_extensions();
foreach ($able as $key=>$value) {
if ($key!=0 && $key%13==0) {
echo '<br />';
}
echo "$value&nbsp;&nbsp;&nbsp;&nbsp;";
}
?>
</td>
</tr>
</table>
<form method="post" action="<?=htmlentities($_SERVER['PHP_SELF'])?>">
<table width="100%" id="data" class="inp">
<tr>
<th colspan="4" class="ec">数据库连接测试</th>
</tr>
<tr>
<td colspan="4" class="ft">请及时登录phpMyAdmin修改数据库默认用户名和密码</td>
</tr>
<tr>
<td width="25%" class="er">数据库服务器</td>
<td width="25%" class="fl"><input type="text" name="mysqlHost" value="127.0.0.1" disabled="true"/></td>
<td width="25%" class="er">数据库端口</td>
<td width="25%" class="fl"><input type="text" name="mysqlPort" value="" /></td>
</tr>
<tr>
<td class="er">数据库用户名</td>
<td class="fl"><input type="text" name="mysqlUser" value="" /></td>
<td class="er">数据库用户密码</td>
<td class="fl"><input type="password" name="mysqlPassword" /></td>
</tr>
<tr>
<td colspan="4" align="center" style="padding-top:15px"><input type="submit" value=" 连 接 " name="act" style="height:30px;" /></td>
</tr>
</table>
</form>
<?php if(isset($_POST['act'])) {?>
<table width="100%" class="inp">
<tr>
<th colspan="4" class="ec">数据库测试结果</th>
</tr>
<?php
if ($link) $str1 = '<span style="color: #008000; font-weight: bold;">连接正常 </span> ('.mysqli_get_server_info($link).')';
else $str1 = '<span style="color: #ff0000; font-weight: bold;">连接错误</span><br />'.iconv('gbk', 'utf-8', mysqli_connect_error());
?>
<tr>
<td colspan="2" class="er" width="50%"><?=$host?></td>
<td colspan="2" class="fl" width="50%"><?=$str1?></td>
</tr>
</table>
<?php }?>
<p style="color:#33384e;font-size:14px;text-align:center; margin-bottom:2px;">
<?php $up_time = sprintf('%0.6f', micro_time_float() - $up_start);?>UPUPW探针版本:<?php echo $version?>&nbsp;&nbsp;&nbsp;页面执行时间 <?php echo $up_time?> 秒&nbsp;&nbsp;&nbsp;消耗内存 <?php echo memory_usage();?>
</p>
<hr style="width:100%; color:#cdcdcd" noshade="noshade" size="1" />
<p style="color:#505050; font-size:14px; text-align:center;">&copy; <?php echo date("Y")?> <a href="http://www.upupw.net" target="_blank">UPUPW PHP探针安全版</a>,站点内容与本程序无关。</p>
</div>
</body>
</html>

290
u.php Normal file
View File

@ -0,0 +1,290 @@
<?php
/* http://www.upupw.net */
/* webmaster@upupw.net */
$version = "20.5.18SF";
date_default_timezone_set('Asia/Shanghai') && error_reporting(0);
function _GET($n) { return isset($_GET[$n]) ? $_GET[$n] : NULL; }
function _SERVER($n) { return isset($_SERVER[$n]) ? $_SERVER[$n] : '[undefine]'; }
function memory_usage() { $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; return $memory;}
function micro_time_float() { $mtime = microtime(); $mtime = explode(' ', $mtime); return $mtime[1] + $mtime[0];}
function get_hash() {
return sha1(uniqid());
}
@session_start();
$currentTime = time();
$changeTime = 86400;
$rand = '';
if(isset($_SESSION['time']) and ($currentTime - $_SESSION['time']) < $changeTime) {
$rand = $_SESSION['rand'];
}else{
$_SESSION['time'] = $currentTime;
$_SESSION['rand'] = $rand = get_hash();
}
@header("content-Type: text/html; charset=utf-8");
define('YES', '<span style="color:#008000;font-weight:bold;">已开启</span>');
define('NO', '<span style="color:#999999;font-weight:bold;">未开启</span>');
if ($_POST['mysqlPort']=="") {
$host = "127.0.0.1";
} else {
$host = "127.0.0.1:".$_POST['mysqlPort'];
}
if ($_POST['mysqlUser']=="") {
$link = "";
} else {
$link = @mysqli_connect($host, $_POST['mysqlUser'], $_POST['mysqlPassword']);
}
$Info = array();
$Info['php_ini_file'] = function_exists('php_ini_loaded_file') ? php_ini_loaded_file() : '[undefine]';
$mcrypt = get_extension_funcs('mcrypt') ? YES : NO;
$xmlrpc = get_extension_funcs('xmlrpc') ? YES : NO;
$fileinfo = get_extension_funcs('fileinfo') ? YES : NO;
$ftp = get_extension_funcs('ftp') ? YES : NO;
$errno = mysqli_connect_errno();
$pinfo = $rand;
$up_start = micro_time_float();
if (_GET($pinfo) == 'phpinfo') {
if (function_exists('phpinfo')) phpinfo();
else echo "PHPINFO函数已被禁用无法正常显示详细信息!";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UPUPW PHP探针安全版</title>
<meta name="keywords" content="php探针,upupw探针,PHP探针安全版,php7探针,phpinfo,php扩展,数据库连接测试" />
<meta name="description" content="upupw php探针安全版兼容最新php7,需成功测试连接本地数据库后才显示phpinfo动态链接页面和网站路径,更安全的php探针." />
<meta name="author" content="UPUPW" />
<meta name="reply-to" content="webmaster@upupw.net" />
<meta name="copyright" content="UPUPW Team" />
<style type="text/css">
<!--
*{margin:0px;padding:0px;}
body {background-color:#FFFFFF;color:#000000;margin:0px;font-family:"\5fae\8f6f\96c5\9ed1",tahoma,arial,sans-serif;}
input {text-align:center;width:200px;height:20px;padding:5px;}
a:link {color:green; text-decoration:none;}
a:visited {color:green;text-decoration:none;}
a:active {color:green;text-decoration:none;}
a:hover {color:#ed776b;text-decoration:none;}
table {border-collapse:collapse;margin:10px 0px;clear:both;}
.inp tr th, td {padding:2px 5px 2px 5px;vertical-align:center;text-align:center;height:30px; border:1px #FFFFFF solid;}
.head1 {background-color:#2c3e50;width:100%;font-size:36px;color:#ffffff; padding-top: 10px; text-align: center; font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; }
.head2 {background-color:#1abc9c;width:100%;font-size:18px;height:18px;color:#ffffff;}
.el {text-align: center; background-color: #d3e1e5; }
.er {text-align: right; background-color: #d3e1e5; }
.ec {text-align: center; background-color: #1abc9c; font-weight: bold; color: #FFFFFF;}
.fl {text-align: left; background-color: #ecf0f1; color: #505050; }
.fr {text-align:right;background-color:#eeeeee;color:#505050;}
.fc {text-align: center; background-color: #ecf0f1; color: #505050; }
.ft {text-align:center;background-color: #D9F9DE;color:#060;}
a.arrow {font-family:webdings,sans-serif;font-size:10px;}
a.arrow:hover {color:#ff0000;text-decoration:none;}
-->
</style>
</head>
<body>
<div class="head1"><a href="http://www.upupw.net/tanzhen/n126.html" style="color:#ffffff" >{ UPUPW PHP 探针 }</a></div>
<div class="head2"></div>
<div style="margin:0 auto;width:1140px;overflow:hidden;">
<table width="100%" class="inp">
<tr>
<th colspan="2" class="ec" width="50%">服务器信息</th>
<th colspan="2" class="ec" width="50%">PHP功能组件开启状态</th>
</tr>
<tr>
<td class="er" width="12%">服务器域名</td>
<td class="fl" width="38%"><?=_SERVER('SERVER_NAME')?></td>
<td class="er" width="20%">MySQLi Client组件</td>
<td class="fc" width="30%"><?=get_extension_funcs('mysqli') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">服务器端口</td>
<td class="fl">
<?php if(isset($_POST['act'])) {?>
<?=($link)?_SERVER('SERVER_ADDR').':'._SERVER('SERVER_PORT'):"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<td class="er">cURL组件</td>
<td class="fc"><?=get_extension_funcs('curl') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">服务器环境</td>
<td class="fl"><?=stripos(_SERVER('SERVER_SOFTWARE'), 'PHP')?_SERVER('SERVER_SOFTWARE'):_SERVER('SERVER_SOFTWARE')?></td>
<td class="er">GD library组件</td>
<td class="fc"><?=get_extension_funcs('gd') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">PHP运行环境</td>
<td class="fl"><?=PHP_SAPI .' PHP/'.PHP_VERSION?></td>
<td class="er">EXIF信息查看组件</td>
<td class="fc"><?=get_extension_funcs('exif') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">PHP配置文件</td>
<td class="fl" style="word-break:break-all;word-wrap:break-word"><?php if(isset($_POST['act'])) {?>
<?=($link)?htmlentities($Info['php_ini_file']):"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<td class="er">OpenSSL协议组件</td>
<td class="fc"><?=get_extension_funcs('openssl') ? YES : NO ?></td>
</tr>
<tr>
<td class="er">当前网站目录</td>
<td class="fl" style="word-break:break-all;word-wrap:break-word"><?php if(isset($_POST['act'])) {?>
<?=($link)?htmlentities(_SERVER('DOCUMENT_ROOT')):"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<?php
if(version_compare(PHP_VERSION,'7.0.0', '<')){
echo "<td class='er'>Mcrypt加密处理组件</td><td class='fc'>".$mcrypt."</td>";
}else{
echo "<td class='er'>FTP组件</td><td class='fc'>".$ftp."</td>";
}?>
</tr>
<tr>
<td class="er">服务器标准时</td>
<td class="fl">
<?=gmdate('Y-m-d H:i:s', time() + 3600 * 8)?>
</td>
<?php
if(version_compare(PHP_VERSION,'5.3.0', '<')){
echo "<td class='er'>XML-RPC组件</td><td class='fc'>".$xmlrpc."</td>";
}else{
echo "<td class='er'>FileInfo组件</td><td class='fc'>".$fileinfo."</td>";
}?>
</tr>
<tr>
<td class="er">便捷管理入口</td>
<td class="fl"><?php if(isset($_POST['act'])) {?>
<?=($link)?"<a target='_blank' href='?$pinfo=phpinfo'>PHPINFO详细信息</a>":"<span style='color:red'>数据库连接测试错误拒绝显示</span>"?>
<?php }
else echo "<a href='#data'><span style='color:green'>数据库连接测试成功后显示</span></a>";
?>
</td>
<td class="er">Mbstring组件</td>
<td class="fc"><?=get_extension_funcs('mbstring') ? YES : NO ?></td>
</tr>
</table>
<table width="100%" class="inp">
<tr>
<td colspan="4" class="ec" width="50%">PHP Zend解密组件</td>
<td colspan="4" class="ec" width="50%">PHP 缓存优化组件</td>
</tr>
<tr>
<td class="el">Zend Optimizer</td>
<td class="el">Zend GuardLoader</td>
<td class="el">ionCubeLoader</td>
<td class="el">SourceGuardian</td>
<td class="el">WinCache</td>
<td class="el">Zend OPcache</td>
<td class="el">Redis</td>
<td class="el">Memcache</td>
</tr>
<tr>
<td class="fc"><?=get_extension_funcs('Zend Optimizer') ? YES.' / '.OPTIMIZER_VERSION : NO ?></td>
<td class="fc"><?=get_extension_funcs('Zend Guard Loader') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('ionCube Loader') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('SourceGuardian') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('WinCache') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('Zend OPcache') ? YES : NO ?></td>
<td class="fc"><?=phpversion('redis') ? YES : NO ?></td>
<td class="fc"><?=get_extension_funcs('memcache') ? YES : NO ?></td>
</tr>
<tr>
<td colspan="8" class="ft"><?=PHP_SAPI .' PHP/'.PHP_VERSION?>不完全包括以上组件,不同PHP版本能适配的外部扩展不同,为了性能以上组件除网站特别要求外没必要全开启!</td>
</tr>
</table>
<table width="100%" class="inp">
<tr>
<td colspan="6" class="ec" width="100%">PHP重要参数检测</td>
</tr>
<tr>
<td class="el">Memory限制</td>
<td class="el">Upload限制</td>
<td class="el">POST限制</td>
<td class="el">Execution超时</td>
<td class="el">Input超时</td>
<td class="el">Socket超时</td>
</tr>
<tr>
<td class="fc"><?=ini_get('memory_limit')?></td>
<td class="fc"><?=ini_get('upload_max_filesize')?></td>
<td class="fc"><?=ini_get('post_max_size')?></td>
<td class="fc"><?=ini_get('max_execution_time').'s'?></td>
<td class="fc"><?=ini_get('max_input_time').'s'?></td>
<td class="fc"><?=ini_get('default_socket_timeout').'s'?></td>
</tr>
</table>
<table width="100%" class="inp">
<tr>
<th class="ec">PHP已编译模块检测</th>
</tr>
<tr>
<td class="fl" style="text-align:center;">
<?php
$able=get_loaded_extensions();
foreach ($able as $key=>$value) {
if ($key!=0 && $key%13==0) {
echo '<br />';
}
echo "$value&nbsp;&nbsp;&nbsp;&nbsp;";
}
?>
</td>
</tr>
</table>
<form method="post" action="<?=htmlentities($_SERVER['PHP_SELF'])?>">
<table width="100%" id="data" class="inp">
<tr>
<th colspan="4" class="ec">数据库连接测试</th>
</tr>
<tr>
<td colspan="4" class="ft">请及时登录phpMyAdmin修改数据库默认用户名和密码</td>
</tr>
<tr>
<td width="25%" class="er">数据库服务器</td>
<td width="25%" class="fl"><input type="text" name="mysqlHost" value="127.0.0.1" disabled="true"/></td>
<td width="25%" class="er">数据库端口</td>
<td width="25%" class="fl"><input type="text" name="mysqlPort" value="" /></td>
</tr>
<tr>
<td class="er">数据库用户名</td>
<td class="fl"><input type="text" name="mysqlUser" value="" /></td>
<td class="er">数据库用户密码</td>
<td class="fl"><input type="password" name="mysqlPassword" /></td>
</tr>
<tr>
<td colspan="4" align="center" style="padding-top:15px"><input type="submit" value=" 连 接 " name="act" style="height:30px;" /></td>
</tr>
</table>
</form>
<?php if(isset($_POST['act'])) {?>
<table width="100%" class="inp">
<tr>
<th colspan="4" class="ec">数据库测试结果</th>
</tr>
<?php
if ($link) $str1 = '<span style="color: #008000; font-weight: bold;">连接正常 </span> ('.mysqli_get_server_info($link).')';
else $str1 = '<span style="color: #ff0000; font-weight: bold;">连接错误</span><br />'.iconv('gbk', 'utf-8', mysqli_connect_error());
?>
<tr>
<td colspan="2" class="er" width="50%"><?=$host?></td>
<td colspan="2" class="fl" width="50%"><?=$str1?></td>
</tr>
</table>
<?php }?>
<p style="color:#33384e;font-size:14px;text-align:center; margin-bottom:2px;">
<?php $up_time = sprintf('%0.6f', micro_time_float() - $up_start);?>UPUPW探针版本:<?php echo $version?>&nbsp;&nbsp;&nbsp;页面执行时间 <?php echo $up_time?> 秒&nbsp;&nbsp;&nbsp;消耗内存 <?php echo memory_usage();?>
</p>
<hr style="width:100%; color:#cdcdcd" noshade="noshade" size="1" />
<p style="color:#505050; font-size:14px; text-align:center;">&copy; <?php echo date("Y")?> <a href="http://www.upupw.net" target="_blank">UPUPW PHP探针安全版</a>,站点内容与本程序无关。</p>
</div>
</body>
</html>