<!--#include file="head.asp"-->
<style>body{background-color: #fff;}</style>


<%
call gaojiquanxian("dlshouquan")

set rs2=server.CreateObject("adodb.recordset")
act=SafeRequest("act")



if SafeRequestform("act")="isyidiip" then
isyidiip=SafeRequestform("isyidiip")
sql="select * from ayname where aynameid="&request.Cookies("aynameid")&"" 
rs.open sql,conn,1,3
rs("isyidiip")=isyidiip
rs.update
rs.close

call logadd(request.Cookies("aynameid"),"异地登录设置成功",4,0)
call PopErr2("异地登录设置成功","dlshouquan")

end if




if SafeRequest("act")="on" then
id=SafeRequest("id")
if id="" then call PopErr("缺少参数")

sql="select * from "&request.Cookies("rzku")&" where aylogid="&id&" and ayloguserid="&request.Cookies("aynameid")&"" 
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then

	sql2="select * from aykexinip where aykxuid="&request.Cookies("aynameid")&" and aykxipd='"&trim(rs("ayipd"))&"'" 
	rs2.open sql2,conn,1,3
	if not(rs2.bof and rs2.eof) then
	call PopErr2("该IP位置已在授信列表","dlshouquan")
	else
	rs2.addnew
	rs2("aykxuid")=request.Cookies("aynameid")
	rs2("aykxip")=trim(rs("aylogip"))
	rs2("aykxipd")=trim(rs("ayipd"))
	rs2("aykxdate")=now()
	rs2.update
	end if
	rs2.close
	
else
call PopErr2("未找到该IP位置信息","dlshouquan")
end if
rs.close


call logadd(request.Cookies("aynameid"),"授权IP位置添加成功",4,0)
call PopErr2("添加成功","dlshouquan")

end if


if SafeRequest("act")="off" then
id=SafeRequest("id")
if id="" then call PopErr("缺少参数")

sql="select * from "&request.Cookies("rzku")&" where aylogid="&id&" and ayloguserid="&request.Cookies("aynameid")&"" 
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then

	sql2="select * from aykexinip where aykxuid="&request.Cookies("aynameid")&" and aykxipd='"&trim(rs("ayipd"))&"'" 
	rs2.open sql2,conn,1,3
	if not(rs2.bof and rs2.eof) then
	rs2.delete
	else
	call PopErr2("未找到该授信IP位置信息","dlshouquan")
	end if
	rs2.close
	
else
call PopErr2("未找到该IP位置信息","dlshouquan")
end if
rs.close


call logadd(request.Cookies("aynameid"),"授权IP位置删除成功",4,0)
call PopErr2("删除成功","dlshouquan")

end if


if SafeRequest("act")="del" then
id=SafeRequest("id")
if id="" then call PopErr("缺少参数")


sql="select * from aykexinip where aykxuid="&request.Cookies("aynameid")&" and aykxid="&id&"" 
rs.open sql,conn,1,3
if not(rs.bof and rs.eof) then
rs.delete
else
call PopErr2("未找到该授信IP位置信息","dlshouquan")
end if
rs.close
	

call logadd(request.Cookies("aynameid"),"授权IP位置删除成功",4,0)
call PopErr2("删除成功","dlshouquan")

end if
%>


<main>
<div  class="container">
<div class="ui-lrctnei">
<%call userleft()%>
<div class="r"> 
<div class="ui-content">
                        
					
                            
<div class="neiye">


            <!-------------------------------------- 开始 -------------------------------------->									
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">异地登录验证</div>
            <div class="gexian20"></div>
                	<div class="neitable">
					<table>
                        <%
						rs.open "select aynameid,isyidiip from ayname where aynameid="&request.Cookies("aynameid")&"",conn,1,1
						%>
                  		<tr>
                            <td>
                			 <form action="" method="post" name="form1" id="form1">
                             目前异地登录验证状态：
                              <select name="isyidiip" id="isyidiip">
                                <option value="0" <%if cint(rs("isyidiip"))=0 then response.Write("selected")%>>关闭</option>
                                <option value="1" <%if cint(rs("isyidiip"))=1 then response.Write("selected")%>>开启</option>
                              </select>
                              &nbsp;&nbsp;&nbsp;&nbsp;
                              <input name="act" type="hidden" id="act" value="isyidiip">
                              <input type="submit" name="Submit" value="    确 定 修 改    " class="logindlregedit">
                			 </form>
                            </td>
                        </tr>
						<%
                        rs.close
						%>
               		  </table>
            		</div>
            <!-------------------------------------- 结束 -------------------------------------->

			<br><br>
                   
                                                     
            <!-------------------------------------- 开始 -------------------------------------->									
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">信任登录位置列表</div>
            <div class="gexian20"></div>
                	<div class="neitable">
					<table>
                        <tr class="hd">
                            <td width="25%">授信IP</td>
                            <td width="25%">授信位置</td>
                            <td width="25%">添加时间</td>
                            <td width="25%">相关操作</td>
                        </tr>
						<%
						sql="select * from aykexinip where aykxuid="&request.Cookies("aynameid")&" order by aykxid desc" 
						rs.open sql,conn,1,1
						if not(rs.bof and rs.eof) then
						do while not(rs.eof) 
			

						
						%>
                  		<tr onmouseover=this.bgColor='#FAFAFA' onmouseout=this.bgColor='#ffffff'>
                            <td><%=trim(rs("aykxip"))%></td>
                            <td><%=trim(rs("aykxipd"))%></td>
                            <td><%=rs("aykxdate")%></td>
                            <td><a style="color:#F30" href="?act=del&id=<%=rs("aykxid")%>">取消信任位置</a></td>
                        </tr>
						<%
						rs.movenext
						loop
						end if
                        rs.close%>
                        
               		  </table>
            		</div>
            <!-------------------------------------- 结束 -------------------------------------->

			<br><br>
            <!-------------------------------------- 开始 -------------------------------------->									
            <div class="neibiaoti"></div>
            <div class="neibiaoti2">历史登录列表</div>
            <div class="gexian20"></div>
                	<div class="neitable">
					<table>
                        <tr class="hd">
                            <td width="25%">相关IP</td>
                            <td width="25%">相关位置</td>
                            <td width="25%">相关时间</td>
                            <td width="25%">相关操作</td>
                        </tr>
						<%
						sql="select * from "&request.Cookies("rzku")&" where ayloguserid="&request.Cookies("aynameid")&" and datediff(day,aylogdate,'"&now()&"')<=60 and aylogid in (select max(aylogid) from "&request.Cookies("rzku")&" where ayloguserid="&request.Cookies("aynameid")&" and datediff(day,aylogdate,'"&now()&"')<=60 group by ayipd) order by aylogid desc" 
						rs.open sql,conn,1,1
						if not(rs.bof and rs.eof) then
						do while not(rs.eof) 

						%>
                  		<tr onmouseover=this.bgColor='#FAFAFA' onmouseout=this.bgColor='#ffffff'>
                            <td><%=trim(rs("aylogip"))%></td>
                            <td><%=trim(rs("ayipd"))%></td>
                          <td><%=rs("aylogdate")%></td>
                          <td>
                          <%
						  sql2="select * from aykexinip where aykxuid="&request.Cookies("aynameid")&" and aykxipd='"&trim(rs("ayipd"))&"'" 
						  rs2.open sql2,conn,1,1
						  if not(rs2.bof and rs2.eof) then
						  %>
                          <a style="color:#F30" href="?act=off&id=<%=rs("aylogid")%>">取消信任位置</a>
                          <%
						  else
						  %>
                          <a style="color:#30F" href="?act=on&id=<%=rs("aylogid")%>">添加信任位置</a>
                          <%
						  end if
						  rs2.close
						  %>
                          </td>
                        </tr>
						<%
					
						rs.movenext
						loop
						end if
                        rs.close%>
                        
               		  </table>
            		</div>
            <!-------------------------------------- 结束 -------------------------------------->



        <div class="clearfix"></div>
        


</div>








</div>
</div>
</div>
</div>
</main>


<footer>
<div class="container">
</div>
</footer>

</body>
</html>