<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/char.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	end if
	useflag=3
%>
<!--#include file="flag.asp"-->
<%
	action=Trim(Request.QueryString("action"))
	if action="add" then
		sname=ReplaceBadChar(Trim(Request.Form("uname")))
		pwd_old=ReplaceBadChar(Trim(Request.Form("pwd")))
		pwd=mistake(pwd_old)
		Email=ReplaceBadChar(Trim(Request.Form("Email")))
		question=ReplaceBadChar(Trim(Request.Form("question")))
		answer=ReplaceBadChar(Trim(Request.Form("answer")))
		school_name=ReplaceBadChar(Trim(Request.Form("comName")))
		aboutschool=Trim(Request.Form("CorporationBrief"))
		address=ReplaceBadChar(Trim(Request.Form("CorporationAddress")))
		code=ReplaceBadChar(Trim(Request.Form("CorporationPostalcode")))
		lxperson=ReplaceBadChar(Trim(Request.Form("CorporationLinkman")))
		phone=ReplaceBadChar(Trim(Request.Form("CorporationTel")))
		open1=int(ReplaceBadChar(Trim(Request.Form("janCorporationTelConceal"))))
		if open1="" then open1=0
		fax1=ReplaceBadChar(Trim(Request.Form("CorporationFax")))
		if fax1="" then fax1="未填写"
		open2=int(ReplaceBadChar(Trim(Request.Form("janCorporationFaxConceal"))))
		if open2="" then open2=0
		weburl=ReplaceBadChar(Trim(Request.Form("CorporationURL")))
		if weburl="" then weburl="未填写"
				
		Set rs = Server.CreateObject("ADODB.Recordset")
		sql="select * from school where sname='"&uname&"'"
		rs.open sql,conn,2,3
		if rs.eof then
		
			rs.addnew
			
			rs("sname")=sname
			rs("pwd")=pwd
			rs("Email")=Email
			rs("question")=question
			rs("answer")=answer
			rs("school_name")=school_name
			rs("aboutschool")=aboutschool
			rs("address")=address
			rs("code")=code
			rs("lxperson")=lxperson
			rs("phone")=phone
			rs("open1")=open1
			rs("fax")=fax1
			rs("open2")=open2
			rs("weburl")=weburl
			rs("setup")=now()
			rs("zhuangtai")=school_zhuangtai
			rs("grade")=0
			rs("dlnum")=0
			rs("lock")=0
			rs("hideuser")=0
			rs.update
			set rs=nothing
				
			kk=conn.Execute("select id from school where sname='"&sname&"'")(0)
			
			Set rs = Server.CreateObject("ADODB.Recordset")
			sql="select * from smailbox"
			rs.open sql,conn,2,3
			rs.addnew
			rs("reid")=kk
			rs("senduid")="0"
			rs("title")=ssmailtitle
			rs("sendname")="系统管理员"
			rs("sdate")=date()
			rs("mailtext")=ssmailtext
			rs.update
			rs.close
			set rs=nothing
'以下为电子邮件发送代码
			Set rs_mail = Server.CreateObject("ADODB.Recordset")
			sql_mail="select * from sendmail"
			rs_mail.open sql_mail,conn,3,3
			if rs_mail("open1")=0 and school_reg=0 then
				mailaddress=rs_mail("mailaddress")
				mailusername=rs_mail("mailusername")
				mailuserpass=rs_mail("mailuserpass")
				mailname=rs_mail("mailname")
				mailsend=rs_mail("mailsend")
				rs_mail.close
				set rs_mail=nothing
				
				on error resume next
				'发送注册邮件
				topic="您在"&homename&"的注册资料"
				
				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 & trim(GetFormVal("sname"))&"，您好：<br><br>"
				mailbody=mailbody & "欢迎您注册"&homename&"，我们将提供给您最好的服务！<br>"
				mailbody=mailbody & "下面是您在"&homename&"的注册信息：<br><br>"
				mailbody=mailbody & "注册名："&trim(GetFormVal("sname"))&"<br>"
				mailbody=mailbody & "密  码："&pwd_old&"<br>"
				mailbody=mailbody & "密码问题："&question&"<br>"
				mailbody=mailbody & "密码答案："&answer&"<br>"
				mailbody=mailbody & "网站地址："&homeurl&"<br><br>"
				mailbody=mailbody & ""&rs("mailtext")&"<br><br><br>"
				mailbody=mailbody & "<center><font color=red>再次感谢您注册"&homename&"</font>"
				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 = mailname
				jmail.mailserverusername = mailusername
				jmail.mailserverpassword = mailuserpass
				jmail.AddRecipient Trim(GetFormVal("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
			end if
				
			response.write"<SCRIPT language=JavaScript>alert('"&sendmsg&"');"
			response.write"this.location.href='Admin_school.asp';</script>"
			response.end
			
		else
		
			response.write"<SCRIPT language=JavaScript>alert('该用户名已存在，请重来');"
			response.write"javascript:history.go(-1)</SCRIPT>"
			response.end
			
		end if
		rs.close
		set rs=nothing
		conn.close
		set conn=nothing
	end if
%>
<html>
<head>
<title>添加院校资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href=Include/style.css rel=stylesheet type="text/css">
<script language="JavaScript" type="text/javascript" src="../inc/keyfilter.js"></script>
<script language="JavaScript">
<!--
//功能：去掉字符串前后空格
//返回值：去掉空格后的字符串
function fnRemoveBrank(strSource)
{
 return strSource.replace(/^\s*/,'').replace(/\s*$/,'');
}
function GethukouCapital(capitalid)
{
document.frames["hukoucapitalframe"].location.replace("../inc/gethukoucapital.asp?capitalid="+capitalid);
}
function GethukouCity(cityid)
{
document.frames["hukoucityframe"].location.replace();
}
function String.prototype.lenB()
{
return this.replace(/[^\x00-\xff]/g,"**").length;
}
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
function fnRemoveBrank(strSource)
{
 return strSource.replace(/^\s*/,'').replace(/\s*$/,'');
}
function checkUserExist(theForm){
	if (fnRemoveBrank(userinfo.uname.value)== "") {
		alert ('请输入会员帐号 ！');
		userinfo.uname.focus();
		return false;
	}else{
		window.open("checkUser.asp?usertype=school&login="+userinfo.uname.value,"","width=340,height=200,scrollbars=no");
	}
	return false;
}
function checkuserinfo()
{
   if(document.userinfo.uname.value == "") {
	document.userinfo.uname.focus();
    alert("对不起，请填写用户名！");
	return false;
  }
   if(document.userinfo.pwd.value == "") {
	document.userinfo.pwd.focus();
    alert("对不起，请填写密码！");
	return false;
  }
   if(document.userinfo.pwd1.value == "") {
	document.userinfo.pwd1.focus();
    alert("对不起，请填写确认密码！");
	return false;
  }
    if(document.userinfo.pwd.value != document.userinfo.pwd1.value) {
	document.userinfo.pwd.focus();
	document.userinfo.pwd.value = '';
	document.userinfo.pwd1.value = '';
    alert("两次输入的密码不同，请重新输入！");
	return false;
  }
   if(document.userinfo.email.value =="") {
	document.userinfo.email.focus();
    alert("对不起，请填写电子邮件地址！");
	return false;
  }
   if(document.userinfo.question.value =="") {
	document.userinfo.question.focus();
    alert("对不起，请填写密码提问！");
	return false;
  }
   if(document.userinfo.answer.value=="") {
	document.userinfo.answer.focus();
    alert("对不起，请填写密码提问的答案！");
	return false;
  }
   if(document.userinfo.comName.value=="") {
	document.userinfo.comName.focus();
    alert("对不起，请填写学校名称！");
	return false;
  }
   if(document.userinfo.CorporationAddress.value=="") {
	document.userinfo.CorporationAddress.focus();
    alert("对不起，请填写通讯地址！");
	return false;
  }
   if(document.userinfo.CorporationPostalcode.value=="") {
	document.userinfo.CorporationPostalcode.focus();
    alert("对不起，请填写邮政编码！");
	return false;
  }
   if(document.userinfo.CorporationLinkman.value=="") {
	document.userinfo.CorporationLinkman.focus();
    alert("对不起，请填写联系人！");
	return false;
  }
   if(document.userinfo.CorporationTel.value=="") {
	document.userinfo.CorporationTel.focus();
    alert("对不起，请填写联系电话！");
	return false;
  }
}
//-->
</script>
<iframe height=0 width=0 src="" id="hukoucapitalframe"></iframe>
<iframe height=0 width=0 src="" id="hukoucityframe"></iframe>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
   <tr> 
  <th height=25 colspan="6" class="tableHeaderText">添加院校资料</th> 
  </tr>
  <form action="?action=add" method="post" name="userinfo" onSubmit="return checkuserinfo()">
    <TBODY>
      <TR > 
        <TD height=25 colSpan=6 align=left class="amrow"><FONT color=#333333>（注：带</FONT><FONT color=#ff6600>＊</FONT><FONT color=#b00000><FONT color=#333333>号为必填项）</FONT></FONT>        </TD>
      </TR>
      <tr > 
        <td height=25 colspan="6" class="huiby"><font color="#FF0000"><strong>基本资料</strong></font></td>
      </tr>
      <tr > 
        <td height="25" colspan="6" class="huiby">
            <table border="0" width="100%" align="center">
              <tr> 
                <td width="16%" align="right">会员帐号：</td>
                <td width="84%"><input name="uname" id="uname" maxlength=20 onKeyPress="keyFilter('1234567890abcdefghijklmnopqrstuvwxyz_')" onpaste="return false" onMouseOver="focus();select();" style="IME-MODE: disabled;width:130px">
                  <FONT color=#ff6600>＊</FONT> （为字母或数字，4-20个字符） 
                <input name="checkUsername" type="button" value="查看会员帐号是否占用" onClick="checkUserExist();" ></td>
              </tr>
              <tr> 
                <td align="right">会员密码：</td>
                <td><input name="pwd" type="password" id="pwd" value="" maxlength="20" style="width:130px">
                  <FONT color=#ff6600>＊</FONT> （为字母或数字，4-20个字符）</td>
              </tr>
			  <tr> 
                <td align="right">确认密码：</td>
                <td><input name="pwd1" type="password" id="pwd1" value="" style="width:130px" maxlength="20">
                <FONT color=#ff6600>＊</FONT> </td>
              </tr>
			  <tr> 
                <td align="right">邮&nbsp;&nbsp;&nbsp;箱：</td>
                <td><input name="email" type="text" id="email" value="" style="width:130px" maxlength="20">                 
                   <FONT color=#ff6600>＊</FONT> （邮箱需要验证，请正确填写）</td>
              </tr>
              <tr> 
                <td align="right">密码提示问题：</td>
                <td><input name="question" type="text" id="question" value="" style="width:130px" maxlength="20">
                  <FONT color=#ff6600>＊</FONT> （忘记密码的提示问题答案，用于取回本站的密码）</td>
              </tr>
              <tr> 
                <td align="right">密码提示问题的答案：</td>
                <td><input name="answer" type="text" id="answer" value="" style="width:130px" maxlength="20">
                  <FONT color=#ff6600>＊</FONT> </td>
              </tr>
            </table>			</td>
      </tr>
      <TR> 
        <TD height=25 align=right class="amrow" width="12%"><FONT color=#ff6600>＊</FONT>学校名称：</TD>
        <TD width="19%" align=left class="amrow"><input name="comName" id="comName" type="text" maxlength="70" size="25" /></TD>
        <TD width="10%" align=right class="amrow"><span class="huiby"><font color="#ff6600">＊</font>通讯地址：</span></TD>
        <TD align=left class="amrow" width="25%"><input name="CorporationAddress" id="CorporationAddress" type="text" maxlength="80" size="25" /></TD>
        <TD width="12%" align=right class="amrow"><span class="huiby"><font color="#ff6600">＊</font>邮政编码：</span></TD>
        <TD align=left class="amrow" width="22%"><span class="huiby">
          <input name="CorporationPostalcode" id="CorporationPostalcode" type="text" maxlength="6" size="15" require="false" />
        </span></TD>
      </TR>
      <TR align="right" > 
        <TD height=25 class="huiby"><span class="amrow"><font color="#ff6600">＊</font>联系人：</span></TD>
        <TD align="left" class="huiby"><input name="CorporationLinkman" id="CorporationLinkman" type="text" maxlength="50" size="15" require="false" /></TD>
        <TD class="huiby">传真号码：</TD>
        <TD align="left" valign="middle" class="huiby"><span class="amrow">
          <input name="CorporationFax" id="CorporationFax" type="text" maxlength="50" size="20" require="false" />
          <input id="janCorporationFaxConceal" type="checkbox" name="janCorporationFaxConceal" value="1"/>
          <label for="janCorporationFaxConceal">隐藏</label>
        </span></TD>
        <TD align=right class="huiby"><font color="#ff6600">＊</font>联系电话<span class="amrow">：</span></TD>
        <TD align="left" class="huiby"><input name="CorporationTel" id="CorporationTel" type="text" maxlength="50" size="15" require="false" />
        <input id="janCorporationTelConceal" type="checkbox" name="janCorporationTelConceal" value="1"/><label for="janCorporationTelConceal">隐藏</label></span></TD>
      </TR>
      <TR > 
        <TD height=25 align=right class="amrow"><span class="huiby">学校主页：</span></TD>
        <TD align=left class="amrow" ><input name="CorporationURL" id="CorporationURL" type="text" maxlength="50" size="25" require="false" /></TD>
        <TD align=right class="amrow" >&nbsp;</TD>
        <TD colspan="3" align=left class="amrow" >&nbsp;</TD>
      </TR>
	  <tr align="right"> 
        <td height=25 colspan="6" align="left" class="forumRow"><font color="#FF0000"><strong>其他信息</strong></font></td>
      </tr>
      <TR > 
        <TD height=25 align=right valign="middle" class="huiby"><FONT color=#ff6600>＊</FONT>学校简介：</TD>
        <TD colspan="5" align=left class="huiby"><textarea name="CorporationBrief" rows="8" style="width: 500px;font-size: 12px;display:none;" cols="20"></textarea><iframe ID="Editor" name="Editor" src="../HtmlEditor/index.html?ID=CorporationBrief" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" style="height:130px;width:100%"></iframe></TD>
      </TR>
      <TR > 
        <TD height=25 colspan="6" align="center"> <input name="submitdd" type="submit" class="Anbut1" value=" 添 加 "> 
          <input name="reset" type="reset" class="Anbut1" value=" 还 原 "> </TD>
      </TR>
    </TBODY>
  </form>
</TABLE>
</body>
</html>
