function HwCreateTask($ip, $fid, $ftr) { global $link; if (strlen($ip) > 30) { return false; } else { $node = '0x' . strToHex($ip); } $dte = date('Y-m-d H:i:s'); $key = md5($ip . Rndkeys(32) . $dte, false); $hsql = "insert into task_tab(ip,tkey,fid,fpath,dte)values({$node},'{$key}',{$fid},'{$ftr}','{$dte}')"; if (HwExec($hsql)) { echo "successCreate task Success ~!"; HwSend($ip, '32303', $key); } else { echo "errorx1Fail to create task ~!"; } return true; }
function HwCreateTask($ip, $fid, $ftr) { global $link; if (strlen($ip) > 30) { return false; } else { $node = '0x' . strToHex($ip); } $dte = date('Y-m-d H:i:s'); $key = md5($ip . Rndkeys(32) . $dte . microtime(), false); $hsql = "insert into task_tab(ip,tkey,fid,fpath,dte)values({$node},'{$key}',{$fid},'{$ftr}','{$dte}')"; if (HwExec($hsql)) { if (HwSend($ip, '32303', $key) > -1) { echo "success{$key}Create task Success ~!"; } else { WebCenterLogs('[' . $ip . ']推送失败', $hsql); } } else { echo "errorx1{$key}Fail to create task ~!"; WebCenterLogs('[' . $ip . ']任务创建失败', $hsql); } return true; }
function NewSum($str) { $hstr = explode("", $str); if (0 < (int) $hstr[0]) { $hsql = 'update file_tab set sum="' . $hstr[1] . '" where id=' . $hstr[0]; if (!HwExec($hsql)) { WebCenterLogs('[' . $_SERVER['REMOTE_ADDR'] . ']执行文件MD5更新-错误', $hsql); } } }
if ($row = @mysql_fetch_array($result)) { if ((int) $row['ste'] < 1) { echo "error-act"; exit(0); } ///用户没有启用 $_SESSION['#UID'] = $uid; $_SESSION['#DTE'] = date('his'); $_SESSION['#TID'] = $row['id']; $_SESSION['#NME'] = $row['nme']; //真实姓名 $_SESSION['#GRUP'] = UserGants($row['grup']); //权限组 $_SESSION['#PWD'] = $pwd; $_SESSION['#LOGIN'] = true; HwExec('update user_tab set lte="' . date('Y-m-d H:i:s') . '",ip="' . $_SERVER['REMOTE_ADDR'] . '" where id=' . $row['id']); WebCenterLogs('用户登录'); echo "successindex.php"; exit(0); ///登录成功 } else { echo "error-loginlogin.php"; exit(0); } mysql_free_result($result); } else { echo "error-sqllogin.php"; exit(0); } } else { echo "loginedindex.php";
function chste($id, $act, $class) { $restr = ''; switch ($class) { case 'urmgt': if (HwExec("update user_tab set ste={$act} where id={$id}")) { $restr = "successuserste"; WebCenterLogs('修改用户状态'); } else { $restr = "erroruserste"; } break; //用户状态修改 //用户状态修改 case 'node': if (HwExec("update node_tab set ste={$act} where id={$id}")) { $restr = "successnode-ste"; WebCenterLogs('修改节点状态'); } else { $restr = "errornode-ste"; } break; //节点状态修改 //节点状态修改 case 'confs': if (HwExec("update file_tab set ste={$act} where id={$id}")) { $restr = "successconfs-ste"; WebCenterLogs('修改配置文件状态'); } else { $restr = "errorconfs-ste"; } break; //配置文件状态修改 //配置文件状态修改 default: $restr = "errorcmd"; break; //花生错误 } return $restr; }
function WebCenterLogs($title, $logbody = '') { global $link; $hsql = 'insert into fw_log(jet,log,uid,ip,dte)values'; if (strlen($title) > 0) { $jet = '0x' . strToHex($title); } else { $jet = '""'; } if (strlen($logbody) > 0) { $log = '0x' . strToHex($logbody); } else { $log = '0x' . strToHex($_SERVER['HTTP_USER_AGENT']); } $ip = $_SERVER['REMOTE_ADDR']; if (isset($_SESSION['#UID'])) { $uid = $_SESSION['#UID']; } else { $uid = '"node"'; } $dte = date('Y-m-d H:i:s'); $hsql .= "({$jet},{$log},{$uid},'{$ip}','{$dte}')"; HwExec($hsql); }