<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="pinfo.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/money.asp"-->
<!--#include file="../inc/personinfo.asp"-->
<!--#include file="../inc/ptime.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	end if
	type1=Trim(Request.QueryString("type"))
	if type1="add" then
		if changepay=0 then
			set rs_read=server.createobject("adodb.recordset")
			read_sql="select * from psend where name ='"&Request.Cookies("admin_person_name")&"' and readid=" &int(Trim(Request.Form("reid")))& ""
			rs_read.open read_sql,conn,2,3
			if rs_read.eof then
				if dian<pspay or dian<0 then
					response.write"<SCRIPT language=JavaScript>alert('对不起，您的M币不够，请充值！');"
					response.write"this.location.href='../pay.asp';</SCRIPT>"
					response.end
				else
					conn.execute("update person set dian=dian-" & pspay & " , fen=fen+" & pspay1 & " where uname='" &Request.Cookies("admin_person_name")&"'")
					rs_read.addnew
					rs_read("name")=Request.Cookies("admin_person_name")
					rs_read("readid")=Trim(Request.Form("reid"))
					rs_read.update
					rs_read.close
					set rs_read = nothing
					Call mail()
				end if
			else
				rs_read.close
				set rs_read = nothing
				Call mail()
			end if
			

		else
			if action="ture" then
				Call mail()
			else
				response.write"<SCRIPT language=JavaScript>alert('对不起，您尚未处于会员期内，您暂时无法发送信息，请充值！');"
				response.write"this.location.href='../pay.asp';</SCRIPT>"
				response.end
			end if
		end if
	end if

	Sub mail()
			mailtext=Trim(Request.Form("content"))
			title=Trim(Request.Form("title"))
			cname=Trim(Request.Form("cname"))
			sendname=Trim(Request.Form("sendname"))
			senduid=Trim(Request.Form("senduid"))
			email=Trim(Request.Form("email"))
			reid=Trim(Request.Form("reid"))
			Set rs = Server.CreateObject("ADODB.Recordset")
			sql="select * from cmailbox"
			rs.open sql,conn,3,3
			rs.addnew
			rs("reid")=reid
			rs("senduid")=senduid
			rs("sendname")=sendname
			rs("title")=title
			rs("mailtext")=mailtext
			rs("sdate")=date()
			rs.update
			rs.close
			set rs=nothing
			
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql="select * from sendmail"
		rs.open sql,conn,1,1
		if rs("open1")=0 then
			mailaddress=rs("mailaddress")
			mailusername=rs("mailusername")
			mailuserpass=rs("mailuserpass")
			mailsend=rs("mailsend")
		rs.close
		set rs=nothing
		
			'发送邮件
			On Error Resume Next
			'发送推荐邮件
			topic="["&homename&"]信息：恭喜您，"&Request.Cookies("person_name")&"给您发送了一条站内短信!!!"
			
			mailbody="<html>"
			mailbody=mailbody & "<title>站内短信</title>"
			mailbody=mailbody & "<body>"
			mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
			mailbody=mailbody & "<TD valign=middle align=top>"
			mailbody=mailbody & "恭喜您，'"&Request.Cookies("person_name")&"'给您发送了一条站内短信,很可能是人才求职信息哦!请您尽快登陆我们的网站阅读，不要错过这个良好的招聘机会，["&homename&"]祝您招聘愉快！详情请登陆<a href='"&homeurl&"' target='_blank'>"&homeurl&"</a>"
			mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
			mailbody=mailbody & "</body>"
			mailbody=mailbody & "</html>"
			
			Set JMail=Server.CreateObject("JMail.Message")
			JMail.Charset="gb2312"
			JMail.ContentType = "text/html"
			jmail.from = mailsend
			jmail.silent = true
			jmail.Logging = true
			jmail.FromName = topic
			jmail.mailserverusername = mailusername
			jmail.mailserverpassword = mailuserpass
			jmail.AddRecipient email
			jmail.body=mailbody
			JMail.Subject=topic
			if not jmail.Send ( mailaddress ) then
			SendMail=""
			else
			SendMail="OK"
			end if
			if SendMail="OK" then
			sendmsg="<p>· 您的注册信息已经发往您的邮箱，请注意查收!</p>"
			else
			sendmsg="<p>· 系统出错，注册信息资料未能发送到您的邮箱!</p>"
			end if
			'response.write mailbody
			'end if
		end if
			
			response.write"<SCRIPT language=JavaScript>alert('信件发送成功！');"
			response.write"javascript:window.close();</script>"
			response.end
	End Sub

	uname=Request.Cookies("admin_person_name")
	reid=int(Trim(Request.QueryString("senduid")))
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select * from company where id="&reid&""
	rs.open sql,conn,1,1
	if rs.eof then
		response.write"<SCRIPT language=JavaScript>alert('对不起，该企业不存在');"
		response.write"javascript:window.close();</script>"
		response.end
	else
		cname=rs("cname")
		email=rs("email")
	end if
	rs.close
	set rs=nothing
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select * from person where uname='"&uname&"' and  job<>'""' "
	rs.open sql,conn,1,1 
	senduid=rs("id")
	sendname=rs("iname")
	rs.close
	set rs=nothing	
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%= homename %>----个人会员专区</title>
<link href="../company/images/css.css" rel="stylesheet" type="text/css">
</head>
<style>
<!--
body {
	background-color: #FFFFFF;
}
-->
</style>
<body topmargin="5">
	<table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%">
		<tr>
			<td valign="top">
			<form method="POST" action="?type=add">
			<input name="email" type="hidden" value="<%= email %>">
				<table border="0" width="400" cellspacing="0" cellpadding="0" id="table2" height="271">
					<tr>
						<td height="30" background="images/jobbg1.gif" style="border: 1px solid #C0C0C0" width="398" colspan="2">
						<p align="center"><b><font color="#0A5DF6">系统信息发送</font></b></td>
					</tr>
					<tr>
						<td height="28" width="69" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-top-width: 1px; border-bottom: 1px solid #C0C0C0" bgcolor="#EEFFF2">
						<p align="center"><b>收件人：</b></td>
						<td height="28" width="331" style="border-left-width: 1px; border-right: 1px solid #C0C0C0; border-top-width: 1px; border-bottom: 1px solid #C0C0C0" bgcolor="#EEFFF2">&nbsp;<%= cname %></td>
					</tr>
					<tr>
						<td width="69" height="40" bgcolor="#EEFFF2" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-top-width: 1px; border-bottom: 1px solid #C0C0C0">
					  <p align="center"><b>主&nbsp; 题：</b></td>
						<td width="331" style="border-left-width: 1px; border-right: 1px solid #C0C0C0; border-top-width: 1px; border-bottom: 1px solid #C0C0C0" bgcolor="#EEFFF2">
						&nbsp;<input type="text" name="title" size="44" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px" value=""></td>
					</tr>
					<tr>
						<td width="69" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-top-width: 1px; border-bottom: 1px solid #C0C0C0" bgcolor="#EEFFF2" height="138">
					  <p align="center"><b>内&nbsp; 容：</b>
					  <p align="center"></td>
						<td width="331" style="border-left-width: 1px; border-right: 1px solid #C0C0C0; border-top-width: 1px; border-bottom: 1px solid #C0C0C0" valign="top" height="138" align="center" bgcolor="#EEFFF2">
					  <textarea rows="10" name="content" cols="43" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px"></textarea></td>
					</tr>
					<tr>
						<td height="34" width="400" colspan="2" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-top-width: 1px; border-bottom: 1px solid #C0C0C0" bgcolor="#EEFFF2">
						<p align="center">
						<input type="submit" value="发送" name="B1">&nbsp;&nbsp;&nbsp;
						<input type="reset" value="清空" name="B2"></td>
					</tr>
			  </table>
	<input type="hidden" name="cname" value="<%= cname %>">
	<input type="hidden" name="sendname" value="<%= sendname %>">
	<input type="hidden" name="senduid" value="<%= senduid %>">
	<input type="hidden" name="reid" value="<%= reid %>">
			</form>
			</td>
		</tr>
</table>
</body>
</html>