<!--#include file="Conn.asp" -->
<!--#include file="Comm/Site_Class.asp" -->
<!--#include file="Comm/md5.asp" -->
<%
Dim strMenu,Rs,PageTitle,j
strMenu = ""

Set Qsite = New Site_Class

Qsite.SiteConfig()
Qsite.GotoErrPage()

PageTitle = Qsite.SiteName & " - 用户登录页面"

If Not instr(1,Request.ServerVariables("http_Referer"),Request.ServerVariables ("SERVER_NAME"),1)=8 Then
	Qsite.ShowMsg "请不要非法提交数据" , "Index.asp"
End If

Set Rs = server.createobject("ADODB.Recordset")

If Request.Form <> "" Then

	Dim UserName,PassWord,UserType
	Dim FromIp,TodayDate
	Dim strFromPage
	
	TodayDate = Qsite.FormatDate(Date())
	
	FromIp = Request.ServerVariables("REMOTE_ADDR")
	
	UserName = LCase(Qsite.chgStr(Trim(Request.Form("UserName"))))
	PassWord = LCase(Qsite.chgStr(Trim(Request.Form("PassWord"))))
	UserType = Qsite.chgStr(Trim(Request.Form("UserType")))
	strFromPage = Qsite.chgStr(Trim(Request.Form("strFromPage")))
	
	If UserName = "" Or IsNull(UserName) Or PassWord = "" Or IsNull(PassWord) Then
		Response.Redirect("Login.asp?msg=用户名或密码错误！")
		Response.End()
	End If
	If UserType <> "Company" And UserType <> "Person" Then
		Qsite.ShowMsg "请选择用户类型" , ""
	End If
	
	PassWord = MD5(PassWord)
	
	If UserType = "Person" Then	'个人登录
		Rs.Open "select * from PersonTbl where UserName = '"& UserName &"'" , Conn , 3 , 2
		If Rs.Eof Or Rs.Bof Then
			Session("PerId") = ""
			Session("UserName") = ""
			Session("PassWord") = ""
			Session("RealName") = ""
			Session("LoginQuantity") = ""
			Session("IsLock") = ""
			Session("UserType") = ""
			Session("MemberType") = 0
			Qsite.ShowMsg "用户名或密码错误，请返回重新输入" , ""
		Else
			If Rs("PassWord") <> PassWord Then
				Session("PerId") = ""
				Session("UserName") = ""
				Session("PassWord") = ""
				Session("RealName") = ""
				Session("LoginQuantity") = ""
				Session("IsLock") = ""
				Session("UserType") = ""
				Session("MemberType") = 0
				Qsite.ShowMsg "用户名或密码错误，请返回重新输入" , ""
			Else
				If Rs("IsSh") = "1" Then
					Session("PerId") = ""
					Session("UserName") = ""
					Session("PassWord") = ""
					Session("RealName") = ""
					Session("LoginQuantity") = ""
					Session("IsLock") = ""
					Session("UserType") = ""
					Session("MemberType") = 0
					Qsite.ShowMsg "您的帐号还处在审核期，请等待管理员审核" , "Login.asp"
				Else
					Session("PerId") = Rs("PerId")
					Session("UserName") = Rs("UserName")
					Session("PassWord") = Rs("PassWord")
					Session("RealName") = Rs("RealName")
					Session("IsLock") = Rs("IsLock")
					Session("UserType") = "Person"
					Session("MemberType") = 0
					Rs("EditDate") = Qsite.FormatDate(Now())
					Rs("LastLoginIp") = Rs("ThisLoginIp")
					Rs("LastLoginDate") = Rs("ThisLoginDate")
					Rs("ThisLoginIp") = FromIp
					Rs("ThisLoginDate") = Qsite.FormatDate(Now())
					Rs("LoginQuantity") = Rs("LoginQuantity") + 1
					Session("LoginQuantity") = Rs("LoginQuantity")
					Rs.Update
				End If
				If InStr(strFromPage , "Person_View.asp") > 0 Or InStr(strFromPage , "Company_View.asp") > 0 Or InStr(strFromPage , "Company_Job.asp") > 0 Then
					Response.Redirect(strFromPage)
				Else
					Response.Redirect("Login_Check.asp")
				End If
			End If
		End If
		Rs.Close
	ElseIf UserType = "Company" Then	'企业登录
		Rs.Open "select * from CompanyTbl where UserName = '"& UserName &"'" , Conn , 3 , 2
		If Rs.Eof Or Rs.Bof Then
			Session("ComId") = ""
			Session("UserName") = ""
			Session("PassWord") = ""
			Session("RealName") = ""
			Session("LoginQuantity") = ""
			Session("IsLock") = ""
			Session("UserType") = ""
			Session("MemberType") = ""
			Qsite.ShowMsg "用户名或密码错误，请返回重新输入" , ""
		Else
			If Rs("PassWord") <> PassWord Then
				Session("ComId") = ""
				Session("UserName") = ""
				Session("PassWord") = ""
				Session("RealName") = ""
				Session("LoginQuantity") = ""
				Session("IsLock") = ""
				Session("UserType") = ""
				Session("MemberType") = ""
				Qsite.ShowMsg "用户名或密码错误，请返回重新输入" , ""
			Else
				If Rs("IsSh") = "1" Then
					Session("ComId") = ""
					Session("UserName") = ""
					Session("PassWord") = ""
					Session("RealName") = ""
					Session("LoginQuantity") = ""
					Session("IsLock") = ""
					Session("UserType") = ""
					Session("MemberType") = ""
					Qsite.ShowMsg "您的帐号还处在审核期，请等待管理员审核" , "Login.asp"
				Else
					Session("ComId") = Rs("ComId")
					Session("UserName") = Rs("UserName")
					Session("PassWord") = Rs("PassWord")
					Session("RealName") = Rs("CompanyName")
					Session("IsLock") = Rs("IsLock")
					Session("UserType") = "Company"
					Session("thisMemberType") = Rs("MemberType")
					
					If Rs("MemberBeginDate") > TodayDate Then
						Session("MemberType") = 0
						Session("MemberZt") = "(<font color=""#FF0000"">未开通</font>)"
					ElseIf Rs("MemberEndDate") < TodayDate Then
						Session("MemberType") = 0
						Session("MemberZt") = "(<font color=""#FF0000"">已过期</font>)"
					Else
						Session("MemberType") = Rs("MemberType")
					End If
					
					Session("MemberZt") = ""		'暂时屏蔽会员状态
					
					Rs("LastLoginIp") = Rs("ThisLoginIp")
					Rs("LastLoginDate") = Rs("ThisLoginDate")
					Rs("ThisLoginIp") = FromIp
					Rs("ThisLoginDate") = Qsite.FormatDate(Now())
					Rs("LoginQuantity") = Rs("LoginQuantity") + 1
					Session("LoginQuantity") = Rs("LoginQuantity")
					Rs.Update
				End If
				If InStr(strFromPage , "Person_View.asp") > 0 Or InStr(strFromPage , "Company_View.asp") > 0 Or InStr(strFromPage , "Company_Job.asp") > 0 Then
					Response.Redirect(strFromPage)
				Else
					Response.Redirect("Login_Check.asp")
				End If
			End If
		End If
		Rs.Close
	
	Else
		Qsite.ShowMsg "用户类型不正确" , ""
	End If
	
End If
response.write "<script>location.replace('"&Session("UserType")&"/Index.asp');</script>"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>销售类招聘信息 - 胶州人才网</title>
 <meta name="keywords" content="胶州人才网站,胶州招聘网站,胶州人力资源,胶州人才市场,胶州找工作,胶州兼职,胶州培训,胶州职业顾问,胶州职业规划,胶州人事代理">
 <meta name="description" content="胶州人才网是胶州地区内最具影响力的人才网站之一，为企业提供一站式的人才招聘服务，帮助个人求职者与企业搭建最佳互动平台，打造胶州地区权威求职招聘网站!！">
<!--#include file="top.asp" -->
 <%
Rs.Open "select top 5 * from NewsTbl where NewsTypeId = 12 order by AddDate desc" , Conn , 1 , 1
If Not Rs.Eof Then
%>
            <tr>
              <td bgcolor="#FFE8E8" style="padding: 5px;">
			  <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
				<tr>
					<td height="5" colspan="2" bgcolor="#FFFFFF"></td>
				</tr>
<%
			j = 0 
			Do While Not Rs.Eof
%>
				<tr>
					<td width="76%" height="25" bgcolor="#FFFFFF" style="padding-left:5px; padding-right:5px;">·<a href="News_View.asp?NewsId=<%=Rs("NewsId")%>" target="_blank"><%
					If Len(Rs("NewsTitle")) > 24 Then
						Response.Write(Left(Rs("NewsTitle") , 23) & "…")
					Else
						Response.Write(Rs("NewsTitle"))
					End If
					%></a></td>
					<td width="24%" align="right" bgcolor="#FFFFFF" style="padding-left:5px; padding-right:5px;"><font color="#999999">[<%=Qsite.FormatDate(FormatDateTime(Rs("AddDate") , 2))%>]</font></td>
				</tr>
<%
			j = j + 1
			If j >= 5 Then Exit Do
			Rs.MoveNext
			Loop
%>
				<tr>
					<td height="5" colspan="2" bgcolor="#FFFFFF"></td>
				</tr>
			</table>			  </td>
            </tr>
<%
End If
Rs.Close
%>
            <tr>
              <td height="10"></td>
            </tr>
          </table></td>
		<td width="5" background="Images/Ind_News_04.jpg"></td>
	</tr>
	<tr>
		<td width="5" height="5"><img src="Images/Ind_News_07.jpg" width="5" height="5" /></td>
		<td height="5" background="Images/Ind_News_06.jpg"></td>
		<td width="5" height="5"><img src="Images/Ind_News_05.jpg" width="5" height="5" /></td>
	</tr>
</table>
<%
Qsite.Bottom()
%>
