<!-- #include file="../conn.asp" -->
<!-- #include file="../cls_main.asp" -->
<!-- #include file="../cls_md5.asp" -->
<% MyDbPath = "../"
dim obj
set obj = New admin_Reg
	obj.AspInit()
set obj = nothing

Class admin_Reg
	
	Private arrRegType, ishion
	Private Sub Class_Initialize()
		Set ishion = New Cls_Main
		arrRegType = "系统主程序注册,会员系统模块注册,采集系统模块注册,Serv-U模块注册"
	End Sub
	Private Sub Class_Terminate()
		Set ishion = Nothing
	End Sub
	Public Sub AspInit()
	Server.ScriptTimeout = 9999999
		Response.Write "<HTML><HEAD><TITLE>系统注册</TITLE>" & vbCrLf
		Response.Write "<META http-equiv=Content-Type content=""text/html; charset=gb2312"">" & vbCrLf
		Response.Write "<LINK href=""admin.css"" type=text/css rel=stylesheet>" & vbCrLf
		Response.Write "</HEAD>" & vbCrLf
		Response.Write "<BODY leftmargin=""1"" topmargin=""1"">" & vbCrLf
		
		If ishion.adminName = "" Then
			ishion.strMsg = "<li>非法操作：登录超时或你没有以管理员身份登录系统，<a href=""../admin_login.asp"" target=_top>点此进入管理员登录界面</a>。"
			Call ishion.SystemMsg
		ElseIf ishion.checkPermission(ishion.adminName, "54") = False Then
			ishion.strMsg = "<li>非法操作：你没有权限进行此项操作，请联系管理员！"
			Call ishion.SystemMsg
		Else
			Call Main
		End If
		Response.Write "</BODY></HTML>" & vbCrLf
	
	End Sub
	Private Sub Main()
	Select Case Request("action")
		Case "saveReg"
			Call saveReg
		Case Else
			Call RegMain
		End Select
	End Sub
	Private Sub saveReg()
		Dim tempStr, Rs, RegDate, RegDateMD5, RegType, RegCode, RegKey
		
		tempStr = Request.ServerVariables("SERVER_NAME") & "C0559f8d32"
		
		RegDate = Date
		RegDateMD5 = MD5(RegDate, 32)
		
		RegType = CLng(Request.Form("RegType"))
		RegKey = MD5(MD5(tempStr, 16) & Request.Form("RegType") & "F469e80d32", 32)
	
		If Trim(Request.Form("RegKey")) <> RegKey Then
			ishion.strMsg = "<li>Sorry！注册失败，注册码无效。"
			Call ishion.SystemMsg
		Else
			RegCode = MD5(tempStr, 16)
			RegKey = MD5(MD5(tempStr, 16) & Request.Form("RegType") & "F469e80d32", 32)
			Set Rs = ishion.Execute("select * from ishion_Key where RegType = " & RegType)
			If Rs.EOF And Rs.BOF Then
				ishion.Execute ("INSERT INTO ishion_Key ( RegType, RegCode, RegKey, RegDate, RegDateMD5 ) VALUES (" & RegType & ",'" & RegCode & "','" & RegKey & "'," & RegDate & ",'" & RegDateMD5 & "')")
			Else
				ishion.Execute ("Update ishion_Key Set RegCode = '" & RegCode & "',RegKey = '" & RegKey & "', RegDate = " & RegDate & ", RegDateMD5 = '" & RegDateMD5 & "' where RegType = " & RegType)
			End If
			ishion.strMsg = "<li>注册成功！"
			Call ishion.SystemMsg
			Set Rs = Nothing
		End If
		
	End Sub
	
	Private Sub RegMain()
		Dim i, tempStr
		tempStr = Request.ServerVariables("SERVER_NAME") & "C0559f8d32"
		
		arrRegType = Split(arrRegType, ",")
		Response.Write "<table width=""100%""  border=""0"" cellpadding=""3"" cellspacing=""1"">" & vbCrLf
		Response.Write "  <tr align=""center"" class=""tdbg2"">" & vbCrLf
		Response.Write "    <td colspan=""2"">ishionDMS V3 注册状况</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		For i = 0 To UBound(arrRegType)
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">" & arrRegType(i) & "：</td>" & vbCrLf
		If ishion.F469e80d32(i + 1) = "1" Then
			Response.Write "    <td>已注册，注册码：" & ishion.Execute("select top 1 RegKey From ishion_Key Where RegType = " & i + 1)(0) & "</td>" & vbCrLf
		Else
			Response.Write "    <td><font color=red>未注册，</font> 程序购买注册联系QQ：342874266  手机：139_ （张老师）</td>" & vbCrLf
		End If
		Response.Write "  </tr>" & vbCrLf
		Next
		Response.Write "</table>" & vbCrLf
	
		Response.Write "<table width=""100%""  border=""0"" cellpadding=""3"" cellspacing=""1"">" & vbCrLf
		Response.Write "<form action=""admin_Reg.asp"" name=""Database"" method=""post"">" & vbCrLf
		Response.Write "<input name=""action"" type=""hidden"" value=""saveReg"">" & vbCrLf
		Response.Write "  <tr align=""center"" class=""tdbg2"">" & vbCrLf
		Response.Write "    <td colspan=""2"">系统注册</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td align=""right"">注册项目：</td>" & vbCrLf
		Response.Write "    <td><select name=""RegType""> " & vbCrLf
		For i = 0 To UBound(arrRegType)
			Response.Write "<option value=""" & i + 1 & """>" & arrRegType(i) & "</option>"
		Next
		Response.Write "</select></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">标识码：</td>" & vbCrLf
		Response.Write "    <td><input name=""RegCode"" type=""text"" size=""65"" maxlength=""150"" value=""" & MD5(tempStr, 16) & """></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg2"">" & vbCrLf
		Response.Write "    <td align=""right"">注册码：</td>" & vbCrLf
		Response.Write "    <td><input name=""RegKey"" type=""text"" size=""65"" maxlength=""150"" value=""""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr class=""tdbg3"">" & vbCrLf
		Response.Write "    <td>&nbsp;</td>" & vbCrLf
		Response.Write "    <td><input type=""submit"" name=""Submit"" value=""确认注册""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</form>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		
	End Sub
	
	Public Sub OnEndPage()
		Response.Write ishion.CopyRight
	End Sub ' OnEndPage

End Class %>

