<!--#include file="../conn/conn.asp"-->
<!--#include file="../conn/nosql.asp"-->
<%
if request("action")="add" then
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"window.close()</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"window.close()</SCRIPT>"
response.end
end if

xcname=nosql(request("xcname"))
xcnr=nosql(request("xcnr"))
dw=nosql(request("dw"))
jg=dw*50
ts=dw*10
if isChkInteger(request("userid")) then
userid=request("userid")
else
Response.Redirect ("../../index.asp")
end if
if xcname="" or xcnr="" then
response.write "<script language='javascript'>"
response.write "alert('对不起，宣传主题和内容不能为空！');"
response.write"window.close()</SCRIPT>"
response.end
end if

sql="select * from snsn_user where uflag=3 and id="&userid
Set rs1= Server.CreateObject("ADODB.Recordset") 
rs1.open sql,conn,1,3
if rs1.eof or rs1.bof then
response.write "<script language='javascript'>"
response.write "alert('没有此用户，请确认后或联系管理员再访问本页！');"
response.write"window.close()</SCRIPT>"
response.end
else
if rs1("h_face")="" then
response.write "<script language='javascript'>"
response.write "alert('对不起，你还没有上传形象照不能进行宣传！');"
response.write"window.close()</SCRIPT>"
response.end
else
if rs1("jifen")<jg then
response.write "<script language='javascript'>"
response.write "alert('对不起，你的积分不够！');"
response.write"window.close()</SCRIPT>"
response.end
end if
rs1("jifen")=rs1("jifen")-jg
rs1.update
session("jifen")=rs1("jifen")

Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open "select * from mini_pr where userid="&userid,conn,1,1
if rs.eof or rs.bof then
conn.execute("insert into mini_pr (xcname,xcnr,userid,ts)VALUES('"&xcname&"','"&xcnr&"',"&userid&","&ts&")")  
response.write "<script language=javascript>alert('欢迎你加入宣传队伍！');window.close();window.opener.location.reload();</script>"
response.end
else
response.write "<script language='javascript'>"
response.write "alert('你已经参加过了！');"
response.write"window.close()</SCRIPT>"
response.end
end if
end if
end if

else
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"window.close()</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"window.close()</SCRIPT>"
response.end
end if
%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="../css.css" REL="stylesheet" TYPE="text/css">
<style type="text/css">
<!--
body {
	margin-left: 8px;
	margin-top: 8px;
	margin-right: 8px;
	margin-bottom: 8px;
}
.style1 {color: #999999}
-->
</style></head>
<script language="JavaScript" type="text/JavaScript">
	function Integer(){
		if(document.myform.yjg.value.length<1)
		return false;
		if(isNaN(document.myform.yjg.value))
		return false;
		if(document.myform.yjg.value<1)
		return false;
		if(document.myform.yjg.value.indexOf(".")!=-1)
		return false;
		if(document.myform.yjg.value.substr(0,1)=="0")
		return false;
		
		return true;
	}
	function ChangeNum(){
		var TotalFare;
		
		TotalFare = document.myform.yjg.value * document.myform.dw.value
		Totalts = document.myform.ts.value * document.myform.dw.value
		document.myform.fare.value = TotalFare
		document.myform.fare1.value = Totalts
		pay_money.innerHTML = "<font color=red>所需费用：" + TotalFare + "两（" + Totalts + "天）</font>";
		
	}
	
		</script>
<body><form name="myform" method="post" action="?action=add">
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td height="10" bgcolor="efefef"><strong>我要加入宣传广场：</strong></td>
  </tr>
  <tr>
    <td height="11" bgcolor="#FFFFFF">宣传主题：
      <input name="xcname" type="text" id="showname3" size="50" maxlength="50" class="wenbenkuang"></td>
  </tr>
  <tr>
    <td height="22" bgcolor="#FFFFFF">宣传说明：
      <textarea name="xcnr" cols="48" rows="6" class="wenbenkuang" id="xcnr"></textarea></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><input name="yjg" id="yjg" type="hidden" value="50" />
            <input name="ts" id="ts" type="hidden" value="10" /><input type="submit" name="Submit" value="提交" class="go-wenbenkuang"> 
    <input type="reset" name="Submit2" value="重设" class="go-wenbenkuang">
      <input name="userid" type="hidden" value="<%=session("id")%>">
 <select name="dw" class="wenbenkuang" id="dw" onchange="javascript:return ChangeNum();">
                <option value="1">十天</option>
                <option value="2">二十天</option>
                <option value="3">一个月</option>
                <option value="6">二个月</option>
                <option value="9">三个月</option>
        </select> 宣传:每十天需要五十两银子
              <input name="fare" id="fare" type="hidden" value="3600" />
              <input name="fare1" id="fare1" type="hidden" value="3600" /> <div id="pay_money"><font color="red"> 所需费用：50两</font>(<font color="ff9900">十天</font>)</div>   </td>
  </tr>
  <tr>
    <td height="22" bgcolor="#FFFFFF"><span class="style1">注：加入宣传广场条件如下：<br>
    一：形象照片完整，不可为社区头像，否则无法加入。</span></td>
  </tr>
</table>
</form>
</body>
</html>
<%end if%>