<%
'========================================================================================
' 文 件 名: ip_purview.asp
' 版    本: 岭峰网行业专用留言系统3.10.0 (LFMessS 2020 - 3.10.0.F Build 200604)
' 说    明: IP权限验证文件 | 请勿自行修改该处文件，以确保程序正确的执行
' 文件日期: 2020-06-04
' 设 计 者: 疾风之狼
'========================================================================================
' 郑州文达岭峰网络科技有限公司.
'========================================================================================
' Copyright (C) 2001-2020 岭峰网. All rights reserved.
' 网    站: http://www.lfmesss.com
' 电子邮件: support@lfmesss.com
' 联系ＱＱ: 85112407
'========================================================================================
allhttp = LCase(Request.ServerVariables("ALL_HTTP"))

IF man <> "add" Then
	'userip = Request.ServerVariables("REMOTE_ADDR")
	userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	IF userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")  
	IF userIp = "::1" Then userip = "127.0.0.1"
	
	iplf = Split(userip,".",-1)
	
	ipk1 = iplf(0)&".*.*.*"
	ipk2 = iplf(0)&"."&iplf(1)&".*.*"
	ipk3 = iplf(0)&"."&iplf(1)&"."&iplf(2)&".*"
	ipk4 = iplf(0)&"."&iplf(1)&"."&iplf(2)&"."&iplf(3)&""
		
	IF LingFengNet_MS_ynallow = 0 or LingFengNet_MS_ynallow = 3  Then
		IF Instr(LingFengNet_MS_noallowip, ipk1) <> 0 or Instr(LingFengNet_MS_noallowip, ipk2) <> 0 or Instr(LingFengNet_MS_noallowip, ipk3) <> 0 or Instr(LingFengNet_MS_noallowip, ipk4) <> 0 Then
			Server.Transfer("noallow"& Get_Suffix())
		End IF	
	End IF
	
	IF LingFengNet_MS_ynallow = 1 or LingFengNet_MS_ynallow = 3 Then		
		IF Instr(LingFengNet_MS_allowip, ipk1) = 0 and Instr(LingFengNet_MS_allowip, ipk2) = 0 and Instr(LingFengNet_MS_allowip, ipk3) = 0 and Instr(LingFengNet_MS_allowip, ipk4) = 0 Then
			Server.Transfer("noallow"& Get_Suffix())
		End IF		
	End IF	
	
	IF LingFengNet_MS_ipadmin = 0 and Session("LingFengNet_MS_admin") <> "ok" Then	
		Chkproxy()
		IF Instr(LingFengNet_MS_user_admin_ip, ipk1) <> 0 or Instr(LingFengNet_MS_user_admin_ip, ipk2) <> 0 or Instr(LingFengNet_MS_user_admin_ip, ipk3) <> 0 or Instr(LingFengNet_MS_user_admin_ip, ipk4) <> 0 Then	
			IF LingFengNet_MS_user_ippur = 1 and Session("LingFengNet_MS_admin") <> "ok" Then			
				IF Session("LingFengNet_MS_admin") <> "ok" and Session("LingFengNet_MS_admin_flg") <> "1" Then 
					Response.Write "<meta http-equiv=Content-Type content=text/html;charset="& LingFengNet_MS_language_meta_mes_1 &"><script>alert('"& LingFengNet_MS_language_Warning_ip_purview_1 &"')</script>"
					Session("LingFengNet_MS_admin_flg") = "1"
					Session("LingFengNet_MS_admin") = "ok"
					adminname = userip
					Session("LingFengNet_MS_admin_flg_login") = LingFengNet_MS_language_messdef_mesok_re_admin_3 & admin_ip(adminname)
					Call logok() 
				End IF			
			ElseIF LingFengNet_MS_user_ippur = 2 and Session("LingFengNet_MS_admin") <> "ok"  Then 			
				IF Session("LingFengNet_MS_admin") <> "ok" and Session("LingFengNet_MS_admin_flg") <> "2" Then 
					Response.Write "<meta http-equiv=Content-Type content=text/html;charset="& LingFengNet_MS_language_meta_mes_1 &"><script>alert('"& LingFengNet_MS_language_Warning_ip_purview_2 &"')</script>"
					Session("LingFengNet_MS_admin") = "ok"
					Session("LingFengNet_MS_admin_flg") = "2"
					adminname = userip
					Session("LingFengNet_MS_admin_flg_login") = LingFengNet_MS_language_messdef_mesok_re_admin_3 & admin_ip(adminname)
					Call logok() 	
				End IF			
			ElseIF LingFengNet_MS_user_ippur = 3 and Session("LingFengNet_MS_admin") <> "ok" Then 			
				IF Session("LingFengNet_MS_admin") <> "ok" and Session("LingFengNet_MS_admin_flg") <> "3" Then 
					Response.Write "<meta http-equiv=Content-Type content=text/html;charset="& LingFengNet_MS_language_meta_mes_1 &"><script>alert('"& LingFengNet_MS_language_Warning_ip_purview_3 &"。')</script>"
					Session("LingFengNet_MS_admin") = "ok"
					Session("LingFengNet_MS_admin_flg") = "3"
					adminname = userip
					Session("LingFengNet_MS_admin_flg_login") = LingFengNet_MS_language_messdef_mesok_re_admin_3 & admin_ip(adminname)
					Call logok() 	
				End IF	
			Else						
				Response.Write "<meta http-equiv=Content-Type content=text/html;charset="& LingFengNet_MS_language_meta_mes_1 &"><script>alert('"& LingFengNet_MS_language_Warning_ip_purview_4 &"');window.close();</script>"
				Response.End
			End IF		
		Else
			Session("LingFengNet_MS_admin") = "no"
		End IF		  
	End IF
	
	IF (LingFengNet_MS_ipadminlead = 0 or LingFengNet_MS_ipadminlead = 3) and flg = "manok" Then
		IF Instr(LingFengNet_MS_noadminiplead, ipk1) <> 0 or Instr(LingFengNet_MS_noadminiplead, ipk2) <> 0 or Instr(LingFengNet_MS_noadminiplead, ipk3) <> 0 or Instr(LingFengNet_MS_noadminiplead, ipk4) <> 0 Then
			Server.Transfer("noallow"& Get_Suffix())
		End IF
	End IF
	
	IF (LingFengNet_MS_ipadminlead = 1 or LingFengNet_MS_ipadminlead = 3) and flg = "manok" Then
		IF Instr(LingFengNet_MS_adminiplead, ipk1) = 0 and Instr(LingFengNet_MS_adminiplead, ipk2) = 0 and Instr(LingFengNet_MS_adminiplead, ipk3) = 0 and Instr(LingFengNet_MS_adminiplead, ipk4) = 0 Then
			Server.Transfer("noallow"& Get_Suffix())
		End IF
	End IF

End IF

''''''''''''''''''以下可修改后整合入您正在使用的系统''''''''''''''''''''

'IF Session("test")="test" Then  '此句请修改为您当前使用的系统管理系统的管理员认证
	'Session("LingFengNet_MS_admin")="ok"
	'Session("LingFengNet_MS_admin_flg")="3"
'end IF 

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>