标签:query bsp zabbix http get div date time login
1.请求端
def home(request): """ 首页 """ # return render(request, ‘home_application/index_home.html‘) bk_time = str(int(time.time())) bk_data = md5((bk_time+‘swain‘).encode(‘utf8‘)).hexdigest() return redirect("http://192.168.22.210/zabbix/index.php?"+bk_time+"="+bk_data)
2.响应端
#bk-zabbix-login $bk_data= explode("=",$_SERVER["QUERY_STRING"]); $z_time = $_SERVER[‘REQUEST_TIME‘]; $z_md5 = md5($bk_data[0].‘swain‘); if ($bk_data[0]&&$z_time-$bk_data[0]<500&&$z_md5==$bk_data[1]){ $bk_login=true; }else{ $bk_login=false; } // var_dump($bk_login); #login via form if (hasRequest(‘enter‘)||$bk_login){ if (CWebUser::login(getRequest(‘name‘, ‘Admin‘), getRequest(‘password‘, ‘zabbix‘))) { if (CWebUser::$data[‘autologin‘] != $autologin) { API::User()->update([ ‘userid‘ => CWebUser::$data[‘userid‘], ‘autologin‘ => $autologin ]); } $redirect = array_filter([CWebUser::isGuest() ? ‘‘ : $request, CWebUser::$data[‘url‘], ZBX_DEFAULT_URL]); redirect(reset($redirect)); exit; } } if (CWebUser::isLoggedIn() && !CWebUser::isGuest()) { redirect(CWebUser::$data[‘url‘] ? CWebUser::$data[‘url‘] : ZBX_DEFAULT_URL); } $messages = clear_messages();
标签:query bsp zabbix http get div date time login
原文地址:https://www.cnblogs.com/CGCong/p/13030325.html