<!--#include file="conn.asp"-->
<!--#include file="top.asp"-->
<%
if session("username")="" then
  call mb("对不起，您还没有登陆！","login.asp",1)
end if

if request("action")="save" then
 dim flashname,bigclassid,smallclassid,url,url2,picurl,remark
 flashname=checkstr(trim(request.form("flashname")))
 url=checkstr(trim(request.form("url")))
 url2=checkstr(trim(request.form("url2")))
 picurl=checkstr(trim(request.form("picurl")))
 remark=checkstr(trim(request.form("remark")))

 bigclassid=request.form("bigclassid")
 smallclassid=request.form("smallclassid")

 if not isinteger(bigclassid) then
  call mb("请选择大类ID","",0)
 end if
 if not isinteger(smallclassid) then
  call mb("请选择小类ID","",0)
 end if

 if flashname="" or strlength(flashname)>25 then
  call mb("Flash名称不能为空，或大于25个字符！","",0)
 end if

 if url="" then
  call mb("Flash文件地址不能为空！","",0)
 end if

 if remark="" then
  call mb("Flash说明不能为空！","",0)
 end if

 set rs=server.createobject("adodb.recordset")
 sql="select * from flash where id is null"
 rs.open sql,conn,1,3

 rs.addnew
 rs("bigclassid")=bigclassid
 rs("smallclassid")=smallclassid
 rs("flashname")=flashname
 rs("url")=url
 rs("url2")=url2
 rs("picurl")=picurl
 rs("remark")=remark
 rs("username")=session("username")
 rs("ispassed")=true
 rs.update

 rs.close
 
 '更新Flash统计
 conn.execute("update bigclass set flashcount=flashcount+1 where bigclassid="&bigclassid)
 conn.execute("update smallclass set flashcount=flashcount+1 where smallclassid="&smallclassid)
 conn.execute("update author set flashnum=flashnum+1 where username='"&session("username")&"'")
 call mb("发布Flash作品成功！","user_flashput.asp",1)
else
 set rs=conn.execute("select * from smallclass")
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
        <%
		dim count:count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("smallclassname"))%>","<%= trim(rs("bigclassid"))%>","<%= trim(rs("smallclassid"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        set rs=nothing
        %>
onecount=<%=count%>;

function changelocation(bigclassid)
    {
    document.put.smallclassid.length = 0; 

    var bigclassid=bigclassid;
    var i;
    document.put.smallclassid.options[0] = new Option('请选择二级分类','');
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == bigclassid)
            { 
                document.put.smallclassid.options[document.put.smallclassid.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</script>
<table width="770" height="200" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="border">
  <tr> 
    <td width="190" valign="top" bgcolor="#F7F7F7"> 
      <!--#include file="user_menu.asp"-->
    </td>
    <td width="1" valign="top" background="images/bg_vline.gif"></td>
    <td valign="top"><TABLE align=center 
      background="images/line01.gif" 
      border=0 cellPadding=0 cellSpacing=0 height=24 width="100%">
        <TR> 
          <TD height=21 width="55%">&nbsp;<IMG height=12 
            src="images/A3.gif" width=12> 当前位置：<A 
            href="index.asp" title="联盟首页">Flash联盟</A> -&gt; 发布作品</TD>
          <TD height=21 width="45%">&nbsp;</TD>
        </TR>
      </TABLE> 
      <form action="?action=save" method="post" name="put" id="put">
        <TABLE align=center border=0 borderColor=#000000 cellPadding=0 cellSpacing=0 width="99%">
          <TR> 
            <TD background="images/T_back.gif" width="18%"><IMG src="images/T_1.gif" width=90 height=24 border="0"></TD>
            <TD 
          background="images/T_back.gif" 
          width="78%"><strong>发 布 作 品</strong></TD>
            <TD width="4%"><IMG height=24 
            src="images/T_2.gif" 
          width=29></TD>
          </TR>
        </TABLE>
        <table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
          <tr bgcolor="#FFFFFF"> 
            <td width="27%" height="25" align="center">一级分类：</td>
            <td width="73%" height="25"> 
              <select name="bigclassid" size="1" id="bigclassid" onChange="changelocation(document.put.bigclassid.options[document.put.bigclassid.selectedIndex].value)">
                <option value='' selected>请选择一级分类</option>
                <%set rs=conn.execute("select bigclassid,bigclassname from bigclass order by bigclassid")
					 do until rs.eof
					   response.write "<option value='"&rs(0)&"'>"&rs(1)&"</option>"
					 rs.movenext
					 loop
					 rs.close
					 %>
              </select></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" align="center">二级分类：</td>
            <td height="25"> 
              <select name="smallclassid" size="1" id="smallclassid">
                <option value='' selected>请选择二级分类</option>
              </select></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" align="center">Flash名称：</td>
            <td height="25"> 
              <input name="flashname" type="text" class="input" id="flashname" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" align="center">观看地址一：</td>
            <td height="25"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="25"><iframe name=ad frameborder=0 width=100% height=30 scrolling=no src=upload.asp?fpath=upload></iframe></td>
                </tr>
                <tr>
                  <td height="20">
<input name="url" type="text" class="input" id="url" size="30">
                    (*.swf、*.fla)</td>
                </tr>
              </table> </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" align="center">观看地址二：</td>
            <td height="25"> 
              <input name="url2" type="text" class="input" id="flashname3" size="30"></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" align="center">缩略图地址：</td>
            <td height="25"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="25"><iframe name=ad frameborder=0 width=100% height=30 scrolling=no src=upload.asp?fpath=smallpic></iframe></td>
                </tr>
                <tr>
                  <td height="23">
<input name="picurl" type="text" class="input" id="picurl" size="30">
                    （请自备<font color="#FF0000">130*165</font>的缩略图）</td>
                </tr>
              </table></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" align="center">简短说明：</td>
            <td height="25"> 
              <textarea name="remark" cols="45" rows="10" class="input" id="textarea"></textarea></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" align="center">&nbsp;</td>
            <td height="30"> 
              <input name="add" type="submit" class="button" id="add" value=" 发布我的作品 "> 
            </td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<%end if%>
<!--#include file="bottom.asp"-->
</DIV>
</BODY></HTML>
