<!--#include file=conn.asp-->
<!--#include file="config.asp"-->
<%
if gx=1 then
if session("person")="" then
	response.write"<script>alert('对不起,您未登录!');window.navigate('login.asp');</script>"
end if
dim count
rs3.open"select * from assort order by id asc",conn,1,1
%>
<SCRIPT language="JavaScript">
var onecount;
onecount=0;
subcat = new Array();
        <%
        count = 0
        do while not rs3.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs3("topic"))%>","<%= trim(rs3("shuxing"))%>","<%= trim(rs3("id"))%>");
        <%
        count = count + 1
        rs3.movenext
        loop
        rs3.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.ftiwen.BoardClass.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.ftiwen.BoardClass.options[document.ftiwen.BoardClass.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }   
</SCRIPT>

<html>
<head>
<title><%=webname%>--我要提供资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="iknow.css" rel="stylesheet" type="text/css">
</head>
<body class="bgbdy" topmargin="0">
<center>

<script language=javascript>
 function checkform(obj)
{
gcv();
 if(obj.BoardNlass.value=="" || obj.BoardClass.value==0)
  {
    alert("请选择资料分类");return false;
	}
 if(obj.title.value =="" || obj.title.value.length ==0)
 {
  	alert("请输入资料标题");obj.title.focus();return false;
 }
   var leftChars = getLeftChars(obj.title,50);
   
    if ( leftChars < 0) 
	{   
	  ls_str = "资料标题字数限定在50个汉字以内，请缩短提问字数";
      alert(ls_str);
      obj.title.focus();
      return false;    
    }
   if(leftChars>92)
   {
	 ls_str = "资料标题不详细，请重新输入";
      alert(ls_str);
      obj.title.focus();
      return false;    
   }
   var content_length = obj.content.value.length;
	 if ( content_length >3000) 
	{   
	  ls_str = "资料说明字数限定在3000字节以内，请缩短字数";
      alert(ls_str);
      obj.content.focus();
      return false;    
    }
}
function getLeftChars(varField,limit_len) {
    var i = 0;
    var counter = 0;
    var cap = limit_len*2;    
    var j=0;
   var runtime = (varField.value.length>cap)?(cap+1):varField.value.length;
    for (i = 0; i< runtime; i++) {     
     if (varField.value.charCodeAt(i) > 127 || varField.value.charCodeAt(i) == 94) {
        j=j+2;  
        } 
     else {
        j=j+1
     }   
    }  //结束FOR循环
    //var leftchars = cap - varField.value.length;    
    var leftchars = cap - j;    
    return (leftchars);
}
function  gcv()  
{  
   var  aa  =  document.getElementsByName("ra");  
   for  (var  i=0;  i<aa.length;  i++)  
   {  
         if(aa[i].checked)
         document.ftiwen.cid.value = aa[i].value;
   }  
}  
</script>
<!--#include file=top.asp-->
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="25" nowrap><a href="<%=weburl%>"><%=webname%></a> &gt; 我要提供资料</td>                                                                                        
  </tr>
</table>
<div id="cDiv"> 
<table border="0" align="right" cellpadding="0" cellspacing="0">
  <tr><td width="220" valign="top" class="padL12">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" >
        <tr> 
          <td nowrap class="bgtle">热门资料</td>
        </tr>
        <tr><td class="bgcntLn"><table width="203" border="0" cellspacing="0" cellpadding="0" class=zhtable>
<%
rs.open"select top 10 * from Share order by xia desc",conn,1,1
if rs.eof then
else
while not rs.eof
%>
</center>
<tr>
<td width="150" align=center class="ln28pl4"><a href="showquestion.asp?id=<%=rs("id")%>" target=_blank>
  <p align="left"><%=rs("ftitle")%></a></td>
<center>

<td class="ln28pl4" width="39"><%=rs("xia")%></td></tr>
<%
rs.movenext
	  wend
end if
rs.close
%>
</table></td>
        </tr></table>
</td>  </tr></table>
<%if request("Submit")="提交资料" then
        if session("person")="" then
        response.write"<script>alert('用户超时,请重新登录!');history.back();</script>"
        end if
	if request("fen")="" then
	fen=0
	else
	fen=cINT(request("fen"))
	end if
	if request("BoardNlass")="" then
	response.write"<script>alert('一级分类不能为空!');history.back();</script>"
	response.end
	elseif request("BoardClass")="" then
	response.write"<script>alert('二级分类不能为空!');history.back();</script>"
	response.end
	elseif request("title")="" then
	response.write"<script>alert('标题不能为空!');history.back();</script>"
	response.end
	elseif request("content")="" then
	response.write"<script>alert('补充说明不能为空!');history.back();</script>"
	response.end
	else
	rs3.open"select * from Share where fname='"&request("fname")&"'",conn,1,1
	if not rs3.eof then
	response.write"<script>alert('您不能重复提交!');history.back();</script>"
	response.end
	end if
	rs3.close
	if right(request("fname"),3)<>"rar" and right(request("fname"),3)<>"zip" and right(request("fname"),3)<>"txt" and right(request("fname"),3)<>"doc" and right(request("fname"),3)<>"xls" then
response.write"<script>alert('对不起,您发表的文件类型不允许!');history.back();</script>"
response.end
end if
	title=request("title")
	content=request("content")
	lei=right(request("fname"),3)
	rs.open"select * from Share",conn,1,3
	rs.addnew
	rs("ftitle")=title
	rs("text")=content
	rs("upuser")=session("person")
	rs("uptime")=now
	rs("flid")=request("BoardClass")
	rs("fen")=fen
	rs("fname")=request("fname")
	rs("ffname")=request("ffname")
	rs("lei")=lei
	rs("b")=request("zj")
	rs.update
	rs.close
	response.write"<script>alert('提供资料成功!');window.navigate('index.asp');</script>"
	end if
	end if
	%>
<table width="538" border="0" cellpadding="0" cellspacing="0">
   <form name="ftiwen" method="post" action="userupfile.asp" onSubmit="return checkform(this);">
 <tr> <td nowrap class="bgtle">提供共享资料</td></tr>
<tr><td class="bgcntLn">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" >
              <tr valign="top"> 
                <td width="22%" class="f14" nowrap>资料名称：</td>
                <td width="78%"> <input name="title" type="text" size="48" class=formfont>
                </td>
              </tr>
            </table>
            <br>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="zhtable" >
              <tr valign="top"> 
                <td width="22%" class="f14" nowrap>资料说明：</td>
                <td width="78%"><textarea name="content" cols="46" rows="8"></textarea> 
                  <br>
                  资料说明越详细，您的资料就越会被更多的人下载！ </td>
              </tr>
            </table>
            <br>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" >
              <tr valign="top"> 
                <td width="22%" nowrap class="f14" rowspan="2">资料分类：</td>
                <td width="18%" class="f14">
                <SELECT class=input1 style="WIDTH: 125px" name="BoardNlass" onChange="changelocation(document.ftiwen.BoardNlass.options[document.ftiwen.BoardNlass.selectedIndex].value)" size="8">
<%     
rs3.open"select * from class",conn,1,1
if rs3.eof and rs3.bof then
response.write "..."
response.end
else
%>
<OPTION selected value>==请选择大类==</OPTION>
<%do while not rs3.eof%>
<OPTION value="<%=trim(rs3("id"))%>"><%=trim(rs3("topic"))%></OPTION>
<%
rs3.movenext
loop
end if
rs3.close
set rs3=nothing
%></SELECT>

</td>
                <td width="2%" class="f14" valign="middle">
<div align="center">
                  <b>→</b>
                </div>
</td>
                <td width="13%" class="f14">
<SELECT name="BoardClass" size="8" style="WIDTH: 90px"><OPTION selected value>==请选择小类==</OPTION></SELECT>
</td>
                <td width="45%" class="f14">
</td>
              </tr>
              <tr>
                <td width="23%" class="f14">
                <font color="#ff0000">一级分类</font>
</td>
                <td width="2%" class="f14">
</td>
                <td width="17%" class="f14">
<font color="#ff0000">二级分类</font>
</td>
                <td width="36%" class="f14">
</td>
              </tr>
            </table>
            <table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="22%">&nbsp;</td>
                <td><span class="f14"><img src="img/tips.gif" width="16" height="16"></span>请您选择正确的分类，以使您的问题尽快得到解答。</td>
              </tr>
            </table>
            <br>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" >
              <tr> 
                <td width="22%" valign="top" nowrap class="f14">别人下载时需付给<br>您的积分：</td>
                <td width="78%"><div style="height:28px;" class="f14"><select name="fen">
<option value=0>0</option><option value=5>5</option><option value=10>10</option><option value=15>15</option><option value=20>20</option><option value=30>30</option><option value=50>50</option><option value=80>80</option><option value=100>100</option>
                        </select></div><div><img src="img/tips.gif" width="16" height="16">如果您将资料无偿共享给别人，资料每被下载一次，系统将奖励给你积分<%=xzjl%>分。</div></td>     
                </tr>
             </table>
            <br>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" >
              <tr> 
                <td width="22%" valign="top" nowrap class="f14">选择文件：</td>
                <td width="78%" valign="top" class="f14"> <iframe name=yasurup frameborder=0 width=400 height=23 scrolling=no  src=upfile.htm></iframe><br><img src="img/tips.gif" width="16" height="16">只允许上传word excel txt zip rar格式的文件,上传后请不要更改下面地址。件最大允许为500K,请在提交前先上传资料文件,如果您的资料文件超过500K，建议您分拆成几个文件，按多个资料上传。</td>     
              </tr>
              <tr>
                <td width="22%" valign="top" nowrap class="f14">外部文件链接地址：</td>
                <td width="78%" valign="top" class="f14"> <input name="fname" is fname type="text" size="48" class=formfont><div><img src="img/tips.gif" width="16" height="16">以http://开头   
                    ，以.doc .xls .txt .zip .rar结尾。</div>  
                </td> 
              </tr>
            </table>
            <br><input type="hidden" name="zj" value=""><input type="hidden" name="ffname" value="">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" >
              <tr> 
                <td width="22%" class="f14">&nbsp;</td>
                <td width="78%" valign="top"><input type="submit" name="Submit" value="提交资料"  class="bnsrh">

<input type=hidden name="cid" value=0>  
</td>
              </tr>
            </table></td>
        </tr></form>
      </table>

</div>

<br>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" style="clear:both;">  <tr>    <td height="30" align=center><!--#include file=end.asp--></td> 
  </tr>
</table>
</body>
</html>
<%
else
Response.Write ("<script>alert('对不起,共享资料功能未启用!');history.back();</script>")
		Response.end
	end if
%>