<!--#include file="conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim action,id,t
action=Trim(Request.QueryString("action"))
id=Trim(Request.QueryString("id"))
t=Trim(Request.QueryString("t"))
opendb
if action="1" then
   call saveadd()
else
   call main()
end if
closedb

sub saveadd()
   dim uid,report,retype
   report=Trim(Request.Form("report"))
   uid=Trim(Request.QueryString("uid"))
   retype=Trim(Request.Form("retype"))
   conn.execute("insert into "&predb&"report (touser,retime,toid,retype,QorA,ReUser,report) values("&uid&",'"&now()&"',"&id&","&retype&","&t&","&Request.Cookies("Muser")&",'"&report&"')")
   Response.Write("感谢，举报成功！")
%>
<input type="button" name="button2" id="button2" value="  确 定  " onClick="new parent.dialog().reset();"/>
<%
end sub


sub main()
Dim AskD
Set AskD = Server.CreateObject("KwAsk.FunAsk")
	set AskD.myConn =conn
	AskD.myPredb =predb
	AskD.Getsetting()
	AskD.GetUserRole()
	siteinfo=AskD.siteinfo
	setting=AskD.setting
	UserRole=AskD.UserRole
	set AskD.myConn =Nothing
Set AskD = Nothing
dim rs,uid,username
if t=1 then
   set rs=conn.execute("select id,userid from "&predb&"user a inner join "&predb&"ask b on a.id=b.askuser where b.askid="&id)
else
   set rs=conn.execute("select id,userid from "&predb&"user a inner join "&predb&"ans b on a.id=b.ansuser where b.ansid="&id)
end if
   uid=rs(0)
   username=rs(1)
set rs=nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>提问补充</title>
<link href="Template/<%= siteInfo(11) %>/css/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="JS/MyErr.js"></script>
<script language="javascript">
 function ChkAsk()
{
var rID='<%= Request.Cookies("Muser") %>';
  if (rID=="")
   {
    //openWindow('user/login.asp', '470', '350', '登录');
	var a = new xWin("1",240,200,"<%= siteInfo(4) %>","请先登录再行发布提问！");
	return false;
   }
}

function ChkPut(put,text,num)
{
	if(put.value.length >num)
	{
		put.value = put.value.substring(0,num);
	}
	else
	{
		text.innerText = num - put.value.length;
	}
}
</script>
</head>
<body>
<div class="shortbox">
<form action="?id=<%= id %>&t=<%= t %>&uid=<%= uid %>&action=1" method="post" onSubmit="return ChkAsk();">
		<fieldset class="a_f">
			<legend class="a_l">快问知道提示</legend>
		    <div class="a_d">如果您发现违背本问答系统原则的内容和用户，请即刻告诉我们！</div>
		</fieldset>
		<fieldset class="a_p">
			<legend class="a_l">我要举报</legend>
			<div class="a_rp"><strong>举报对象：</strong><%= username %>（UID:<%= uid %>）</div>
            <div class="a_rp"><strong>举报类型：</strong>
            <select name="retype">
                  <option value="0">==请选择举报类型==</option>
                  <%
                  set rs=conn.execute("select * from "&predb&"Incentive where FenZ<0")
                  do while not rs.eof
                  %>
                  <option value="<%= rs("id") %>"><%=rs("Incentive") %></option>
                  <%
                  rs.movenext
                  loop
                  set rs=nothing
                  %>
            </select>
            </div>
            <div class="a_rp"><strong>举报理由：</strong></div>
	    <div class="a_c"><textarea name="report" rows="5" style="width:390px;overflow: hidden;" onKeyDown="ChkPut(this,nr,150)" onKeyUp="ChkPut(this,nr,150)"></textarea></div>
		    <div class="a_i">可输入 <b><span id="nr">150</span></b> 字</div>
        </fieldset>
            <div class="a_s">
              <input type="submit" name="button" id="button" value=" 提交内容 " /> 
               <input type="button" name="button2" id="button2" value="  取 消  " onClick="new parent.dialog().reset();"/>
            </div>
</form>
</div>
</body>
</html>
<% end sub %>