<!-- #include file="include/con_user.asp" -->
<!-- #include file="include/jk_page_cute.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/jk_put.asp" -->
<!-- #include file="include/jk_frm.asp" -->
<!-- #include file="include/jk_enurl.asp" -->
<!-- #include file="include/admin_fir.asp" -->
<script language=javascript src='style/joekoe_select.js'></script>
<%
dim tnum,nummer
tnum=10		'显示参数 1024*768建议设成：10，800*600建议设成：0
nummer=20	'列表每页显示数量

'dim admins,s_d,s_tim,del_user_true,del_upload_true,is_clear,istop_var,jk_mod,is_nsort,is_review,id,popedom_num,max_pop,ntit
dim admins,s_d,s_tim,del_user_true,del_upload_true,is_clear,istop_var,jk_mod,is_nsort,is_review,id,popedom_num,max_pop,cid,sid,ntit,sql_tmp 
dim sql_add,pageurl,nums,rssum,page,viewpage,thepages,nsort,data_name,sqladd,topic,ddim,country
s_d="'"
s_tim="now()"
dim_down=split(web_down,"|")
nsort=trim(request.querystring("nsort"))
nsort=replace(nsort,"'","")
nsort=replace(nsort,"""","")
id=trim(request.querystring("id"))
if not isnumeric(id) then id=0
nums=nummer
pageurl="?nsort="&nsort&"&"
data_name=""
popedom_num=0
dim dim_down,types
redx="&nbsp;<font class=red>*</font>&nbsp;"
tit="管理信息"

call web_head(2,1,0,0,0)
'----------------------------左边 开始----------------------------
call user_left("")
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
'response.write joekoe_cms.js_type("",2)
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td0 colspan=2>&nbsp;<script language=javascript>document.write(img_skin("m_user"));</script><%response.write tit%></td></tr>
<tr class=bg_tds><td height=30 colspan=2>
  <table border=0>
  <tr>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=book'<%if nsort="book" or nsort="" then response.write " class=red"%>>管理书籍</a></td>
  <td width=5></td>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=need'<%if nsort="need" then response.write " class=red"%>>管理需求书籍</a></td>
  <td width=5></td>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=art'<%if nsort="art" then response.write " class=red"%>>管理文章</a></td>
  <td width=5></td>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=news'<%if nsort="news" then response.write " class=red"%>>管理新闻</a></td>
  <td width=5></td>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=down'<%if nsort="down" then response.write " class=red"%>>管理软件</a></td>
  <td width=5></td>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=paste'<%if nsort="paste" then response.write " class=red"%>>管理贴图</a></td>
  <td width=5></td>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=flash'<%if nsort="flash" then response.write " class=red"%>>管理Flash</a></td>
  <td width=5></td>
  <td><script language=javascript>document.write(img_skin("m_"));</script><a href='?nsort=web'<%if nsort="web" then response.write " class=red"%>>管理网站</a></td>
  </tr>
  </table>
</td></tr>
<%
select case nsort
case "news"
  index_url="news"
  data_name="news"
  tit_fir="新闻"
  sql_add=" where username='"&login_username&"'"
case "down"
  index_url="down"
  data_name="down"
  tit_fir="软件"
  sql_add=" where username='"&login_username&"'"
case "paste"
  index_url="gallery"
  data_name="gallery"
  tit_fir="贴图"
  sql_add=" where username='"&login_username&"' and types='"&nsort&"'"
case "flash"
  index_url="gallery"
  data_name="gallery"
  tit_fir="flash"
  sql_add=" where username='"&login_username&"' and types='"&nsort&"'"
case "web"
  index_url="website"
  data_name="website"
  tit_fir="网站"
  sql_add=" where username='"&login_username&"'"
case "need"
  index_url="need"
  data_name="need"
  tit_fir="需求"
  sql_add=" where username='"&login_username&"'"
case "art"
  index_url="article"
  data_name="article"
  tit_fir="文章"
  sql_add=" where username='"&login_username&"'"
case else
  index_url="book"
  data_name="book"
  tit_fir="书籍"
  sql_add=" where username='"&login_username&"'"
end select
if action="handle" then call joekoe_go_handle()
select case action
case "edit"
if nsort="book" or nsort="" then call art_edit()
if nsort="flea" then call flea_edit()
if nsort="down" then call down_edit()
if nsort="paste" or nsort="flash" then call gall_edit()
if nsort="news" then call news_edit()
if nsort="web" then call web_edit()
if nsort="need" then call art_edit()
if nsort="art" then call art_edit()
case else%>
<tr valign=top align=center><td><table cellspacing=1 cellpadding=3 class=table0>
<form name=sel_form action='?nsort=<%response.write nsort%>&action=handle&c_id=<%response.write cid%>&s_id=<%response.write sid%>' method=post>
<tr align=center><td class=td width='7%'>序号</td>
<td class=td width='78%'><%response.write tit_fir%>标题及整理时间<%if sql_tmp<>"" then response.write "（搜索结果："&keyword&"）"%></td>
<td class=td width='10%'>编辑</td>
<td class=td width='5%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
</tr>
<%
  sql="select count(id) from "&data_name&sql_add
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from "&data_name&sql_add&" order by id desc"
  set rs=server.createobject("adodb.recordset")
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
if data_name="down" or data_name="website" or data_name="gallery" then
  for i=1 to nums
    id=rs("id")
    topic=rs("name")
%>
<tr align=center><td class=tims><%response.write (viewpage-1)*nummer+i%></td><td><table border=0 cellspacing=0 cellpadding=0 width='100%'><tr>
<td><a href='<%response.write index_url%>_view.asp?id=<%response.write id%>' target=_blank><%response.write joekoe_cms.code_html(topic,1,(18+tnum))%></a></td>
<td align=right><font class=tims><%response.write joekoe_cms.time_type(rs("tim"),4)%></font></td>
</tr></table></td>
<td align=center><%response.write pro_edit("?nsort="&nsort&"&action=edit&id="&id,"编辑该"&tit_fir)%></td>
<td><input type=checkbox name=sel_id value='<%response.write id%>'></td></tr>
<%
    rs.movenext
  next
else
  for i=1 to nums
    id=rs("id")
    topic=rs("topic")
%>
<tr align=center>
<td class=tims><%response.write (viewpage-1)*nummer+i%></td>
<td>
  <table border=0 cellspacing=0 cellpadding=0 width='100%'>
  <tr>
  <td><a href='<%response.write index_url%>_view.asp?id=<%response.write id%>' target=_blank><%response.write joekoe_cms.code_html(topic,1,(18+tnum))%></a></td>
  <td align=right><font class=tims><%response.write joekoe_cms.time_type(rs("tim"),4)%></font></td>
  </tr>
  </table>
</td>
<td align=center><%response.write pro_edit("?nsort="&nsort&"&action=edit&id="&id,"编辑该"&tit_fir)%></td>
<td><input type=checkbox name=sel_id value='<%response.write id%>'></td>
</tr>
<%
    rs.movenext
  next
end if  
  rs.close
%>
<tr class=tr1>
<td colspan=2>
现有<font class=red><%response.write rssum%></font>条<%response.write tit_fir%>，
页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>
分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
</td>
<td colspan=2 align=center>
<input name=sel_type type=submit value='删除' onclick="return sel_click(this.form);">
</td>
</tr>
</form>
  </table>
</td>
</tr>
<%end select
response.write vbcrlf&"</table>"
'response.write joekoe_cms.js_type("",1)
'response.write vbcrlf&"document.write(ukong);"
'----------------------------中间 结束----------------------------
call web_end(0,0)

sub joekoe_go_handle()
  dim sel_type,seltype,sel_id,hdim,hnum,hid,hi,htype,hintegral
  htype=1
  sel_type=trim(request.form("sel_type"))
  select case sel_type
  case "删除"
    seltype="delete"
  case else
    sel_type=""
    seltype=""
  end select
  if joekoe_cms.post_chk()=false or seltype="" then exit sub
  hintegral=mp_integral()
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
  select case seltype
  case "delete"
    for hi=0 to hnum
      hid=hdim(hi)
      if isnumeric(hid) then
        if del_user_true then
          sql="update user_data set integral=integral-"&hintegral&" where username=(select top 1 username from "&data_name&" where id="&hid&") and username<>'"&login_username&"'"
          call joekoe_cms.exec(sql,0)
        end if
        if del_upload_true then call upload_del(index_url,hid)
        call joekoe_cms.exec("delete from "&data_name&" where id="&hid,0)
      end if
    next
  end select
  erase hdim
  action=""
  call admin_event(sel_type&" "&(hnum+1)&"条（"&tit_fir&"）记录",0,0)
  response.write vbcrlf&"<script language=javascript>alert(""已成功（"&sel_type&"）操作了"&(hnum+1)&"条记录！"");</script>"
end sub

sub down_edit()
  dim name,keyes,url,url2,homepage,sizes,types,genre,os,power,emoney,username,tim,counter,hidden,pic,ispic,remark
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    name=code_admin("name",1,40)
    url=code_admin("url",1,200)
    remark=request.form("remark")
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or url="" or remark="" then
      rs.close
      call admin_error(tit_fir&"标题、下载地址 和 "&tit_fir&"内容 不能为空！")
      exit sub
    end if
    url2=code_admin("url2",1,200)
    homepage=code_admin("homepage",1,50)
    sizes=code_admin("sizes",1,10)
    types=trim(request.form("types"))
    if not isnumeric(types) then types=0
    genre=code_admin("genre",1,5)
    os=code_admin("os",1,100)
    os=replace(os," ","")
    pic=code_admin("pic",1,100)
    keyes=code_admin("keyes",1,20)
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    hidden=false
    'if trim(request.form("hidden"))="no" then hidden=true
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("name")=name
    rs("url")=url
    rs("url2")=url2
    rs("homepage")=homepage
    rs("sizes")=sizes
    rs("types")=types
    rs("genre")=genre
    rs("os")=os
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("tim")=tim
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    rs("remark")=remark
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("已成功编辑了一个"&tit_fir&"！","?nsort="&nsort&"&c_id="&cid&"&s_id="&sid,0)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
  types=rs("types")
  genre=rs("genre")
  os=rs("os")
  pic=rs("pic")
  ispic=apart_filename(pic,1,"/")
  if ispic="" then ispic=joekoe_cms.rand_file(index_url)
%>
<form name=add_frm action='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&s_id=<%response.write sid%>&action=edit&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr>
<td><%response.write tit_fir%>标题：</td>
<td><input type=text name=name value='<%response.write rs("name")%>' size=60 maxlength=40><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>分类：</td>
<td><%call chk_csid(nsort,cid,sid)%></td>
</tr>
<tr>
<td><%response.write tit_fir%>关键字：</td>
<td><%call frm_keyes(rs("keyes"))%></td>
</tr>
<tr>
<td><%response.write tit_fir%>发布人：</td>
<td><input type=text name=username value='<%response.write rs("username")%>' size=20 maxlength=20>&nbsp;&nbsp;<%call chk_emoney(rs("emoney"))%></td>
</tr>
<%call chk_power("下载",rs("power"),0)%>
<tr>
<td>软件大小：</td><td><input type=text name=sizes value='<%response.write rs("sizes")%>' size=10 maxlength=10>&nbsp;&nbsp;授权类型：<select name=genre size=1><%
  ddim=split(dim_down(1),":")
  for i=0 to ubound(ddim)
    response.write vbcrlf&"<option"
    if genre=ddim(i) then response.write " selected"
    response.write ">"&ddim(i)&"</option>"
  next
  erase ddim
%></select>&nbsp;&nbsp;推荐等级：<select name=types size=1>
<option value='0'<%if int(types)=0 then response.write " selected"%>>没有等级</option>
<option value='1'<%if int(types)=1 then response.write " selected"%>>一星级</option>
<option value='2'<%if int(types)=2 then response.write " selected"%>>二星级</option>
<option value='3'<%if int(types)=3 then response.write " selected"%>>三星级</option>
<option value='4'<%if int(types)=4 then response.write " selected"%>>四星级</option>
<option value='5'<%if int(types)=5 then response.write " selected"%>>五星级</option>
</select>&nbsp;五星级同时为推荐</td>
</tr>
<tr>
<td>运行环境：</td><td><%
  ddim=split(dim_down(0),":")
  for i=0 to ubound(ddim)
    response.write "<input type=checkbox name=os value='"&ddim(i)&"'"
    if instr((","&os&","),(","&ddim(i)&",")) then response.write " checked"
    response.write ">"&ddim(i)
  next
  erase ddim
%></td>
</tr>
<tr>
<td>本站下载：</td>
<td><input type=text name=url value='<%response.write rs("url")%>' size=60 maxlength=200><%response.write redx%></td>
</tr>
<tr>
<td>镜像下载：</td>
<td><input type=text name=url2 value='<%response.write rs("url2")%>' size=60 maxlength=200></td>
</tr>
<tr>
<td><%response.write tit_fir%>主页：</td>
<td><input type=text name=homepage value='<%response.write rs("homepage")%>' size=40 maxlength=50></td>
</tr>
<tr>
<td>发布时间：</td>
<td><input type=text name=tim value='<%response.write rs("tim")%>' size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%> disabled>&nbsp;&nbsp;&nbsp;&nbsp;<%call chk_emoney(0)%></td>
</tr>
<tr>
<td><%call frm_ubb_type("")%></td>
<td><%call frm_ubb("add_frm","remark","&nbsp;&nbsp;")%></td>
</tr>
<tr>
<td valign=top><%response.write tit_fir%>内容：</td>
<td><textarea name=remark rows=10 cols=65><%response.write joekoe_cms.code_word(rs("remark"))%></textarea></td>
</tr>
<tr>
<td><%response.write tit_fir%>图片：</td>
<td><input type=text name=pic value='<%response.write pic%>' size=40 maxlength=100><%if int(format_mid_num(30))=1 then%>&nbsp;&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic' target=upload_frame>上传图片</a>&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write left(index_url,1)%>&uptext=remark' target=upload_frame>上传至内容</a><%end if%></td>
</tr>
<%if int(format_mid_num(30))=1 then%>
<tr>
<td>上传图片：</td>
<td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic'></iframe></td>
</tr>
<%else%>
</tr>
<tr class=bg_td>
<td>上传图片：</td>
<td>功能暂时关闭</td>
</tr>
<%end if%>
<%
  call submit_edit()
  rs.close
end sub

sub gall_edit()
  dim name,ispic,spic,pic,remark,username,power,emoney,counter,tim,hidden
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    name=code_admin("name",1,50)
    pic=code_admin("pic",1,100)
    remark=code_admin("remark",1,250)
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or pic="" or remark="" then
      rs.close
      call admin_error(tit_fir&"名称、地址和说明 不能为空！")
      exit sub
    end if
    spic=code_admin("spic",1,100)
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    hidden=false
    'if trim(request.form("hidden"))="no" then hidden=true
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("name")=name
    rs("spic")=spic
    rs("pic")=pic
    rs("remark")=remark
    rs("username")=username
    rs("power")=power
    rs("emoney")=emoney
    rs("hidden")=hidden
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("已成功编辑了一条 "&tit_fir&" 信息！",pageurl&"&c_id="&cid&"&s_id="&sid,0)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
%>
<form name=add_frm action='<%response.write pageurl%>action=edit&c_id=<%response.write cid%>&s_id=<%response.write sid%>&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr><td><%response.write tit_fir%>名称：</td><td><input type=text size=40 name=name value='<%response.write rs("name")%>' maxlength=50><%response.write redx%></td></tr>
<tr><td><%response.write tit_fir%>分类：</td><td><%if nsort="paste" then call chk_csid("gall",cid,sid) else call chk_csid("flash",cid,sid) end if%></td></tr>
<%
  pic=rs("spic")
  ispic=apart_filename(pic,1,"/")
  if ispic="" then ispic=joekoe_cms.rand_file(nsort)
%>
<tr><td><%response.write tit_fir%>小图片：</td><td><input type=text name=spic value='<%response.write pic%>' size=50 maxlength=100><%if int(format_mid_num(30))=1 then%>&nbsp;　<a href='upload.asp?uppath=gallery&upname=<%response.write ispic%>&uptext=spic' target=upload_frames>上传小图片</a><%end if%></td></tr>
<%
  pic=rs("pic")
  ispic=apart_filename(pic,1,"/")
  if ispic="" then ispic=joekoe_cms.rand_file(nsort)
%>
<tr><td><%response.write tit_fir%>地址：</td><td><input type=text name=pic value='<%response.write pic%>' size=50 maxlength=100><%response.write redx%><%if int(format_mid_num(30))=1 then%><a href='upload.asp?uppath=gallery&upname=<%response.write ispic%>&uptext=pic' target=upload_frames>上传<%response.write tit_fir%></a><%end if%></td></tr>
<%if int(format_mid_num(30))=1 then%>
<tr><td>上传文件：</td><td><iframe frameborder=0 name=upload_frames width='100%' height=30 scrolling=no src='upload.asp?uppath=gallery&upname=<%response.write ispic%>&uptext=pic'></iframe></td></tr>
<%else%>
</tr>
<tr class=bg_td>
<td>上传图片：</td>
<td>功能暂时关闭</td>
</tr>
<%end if%>
<tr>
<td><%call frm_ubb_type("")%></td>
<td><%call frm_ubb("add_frm","remark","&nbsp;&nbsp;")%></td>
</tr>
<tr><td><%response.write tit_fir%>说明：<br><br><=250字符</td><td><textarea name=remark maxlength=250 rows=8 cols=60><%response.write joekoe_cms.code_word(rs("remark"))%></textarea></td></tr>
<tr><td><%response.write tit_fir%>发布人：</td><td><input type=text name=username value='<%response.write rs("username")%>' size=15 maxlength=20>&nbsp;&nbsp;<%call chk_emoney(rs("emoney"))%>&nbsp;&nbsp;&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%> disabled></td></tr>
<%
  call chk_power("浏览",rs("power"),0)
  call submit_edit()
  rs.close
end sub

sub art_edit()
  dim topic,keyes,comto,author,power,emoney,username,tim,counter,istop,hidden,word
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    topic=code_admin("topic",1,50)
    word=request.form("word")
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if topic="" or word="" then
      rs.close
      call admin_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    end if
    keyes=code_admin("keyes",1,20)
    comto=code_admin("comto",1,20)
    author=code_admin("author",1,20)
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    hidden=false
    'if trim(request.form("hidden"))="no" then hidden=true
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("cod")=cod_type()
    rs("topic")=topic
    rs("comto")=comto
    rs("author")=author
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("tim")=tim
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("word")=word
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("已成功编辑了一篇"&tit_fir&"！","?nsort="&nsort&"&c_id="&cid&"&s_id="&sid,1)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
%>
<form name=add_frm action='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&s_id=<%response.write sid%>&action=edit&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr>
<td><%response.write tit_fir%>标题：</td>
<td><input type=text name=topic value='<%response.write rs("topic")%>' size=60 maxlength=50><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>分类：</td>
<td><%call chk_csid(nsort,cid,sid)%></td>
</tr>
<tr>
<td><%response.write tit_fir%>关键字：</td>
<td><%call frm_keyes(rs("keyes"))%></td>
</tr>
<tr>
<td><%response.write tit_fir%>出处：</td>
<td><input type=text name=comto value='<%response.write rs("comto")%>' size=20 maxlength=20>&nbsp;&nbsp;<%response.write tit_fir%>作者：<input type=text name=author value='<%response.write rs("author")%>' size=20 maxlength=20></td>
</tr>
<tr>
<td><%response.write tit_fir%>发布人：</td>
<td><input type=text name=username value='<%response.write rs("username")%>' size=20 maxlength=20>&nbsp;&nbsp;<%call chk_emoney(rs("emoney"))%></td>
</tr>
<%call chk_power("浏览",rs("power"),0)%>
<tr>
<td>发布时间：</td>
<td><input type=text name=tim value='<%response.write rs("tim")%>' size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%> disabled>&nbsp;&nbsp;&nbsp;&nbsp;<%call chk_emoney(0)%></td>
</tr>
<%call html_edit(rs("cod"),"add_frm","word","")%>
<tr>
<td valign=top><%response.write tit_fir%>内容：</td>
<td><textarea name=word rows=15 cols=65><%response.write joekoe_cms.code_word(rs("word"))%></textarea></td>
</tr>
<%if int(format_mid_num(30))=1 then%>
<tr>
<td>上传图片：</td>
<td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write left(index_url,1)%>&uptext=word'></iframe></td>
</tr>
<%else%>
</tr>
<tr class=bg_td>
<td>上传图片：</td>
<td>功能暂时关闭</td>
</tr>
<%end if%>
<%
  call submit_edit()
  rs.close
end sub

sub web_edit()
  dim name,url,pic,ispic,username,country,lang,remark,counter,isgood,hidden,tim
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    name=code_admin("name",1,50)
    url=code_admin("url",1,100)
    remark=code_admin("remark",1,250)
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or url="" or lcase(url)="http://" or remark="" then
      rs.close
      call admin_error(tit_fir&"名称、地址和说明 不能为空！")
      exit sub
    end if
    pic=code_admin("pic",1,100)
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    country=code_admin("country",1,20)
    lang=code_admin("lang",1,20)
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    hidden=false
    'if trim(request.form("hidden"))="no" then hidden=true
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("name")=name
    rs("url")=url
    rs("pic")=pic
    rs("username")=username
    rs("country")=country
    rs("lang")=lang
    rs("remark")=remark
    rs("hidden")=hidden
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("成功编辑一个"&tit_fir&"信息！",pageurl&"c_id="&cid&"&s_id="&sid,0)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
%>
<form action='<%response.write pageurl%>action=edit&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr><td><%response.write tit_fir%>名称：</td><td><input type=text size=60 name=name value='<%response.write rs("name")%>' maxlength=50><%response.write redx%></td></tr>
<tr><td><%response.write tit_fir%>类型：</td><td><%call chk_csid(nsort,cid,sid)%></td></tr>
<tr><td><%response.write tit_fir%>地址：</td><td><input type=text size=60 name=url value='<%response.write rs("url")%>' maxlength=100><%response.write redx%></td></tr>
<tr><td><%response.write tit_fir%>发布人：</td><td><input type=text name=username value='<%response.write rs("username")%>' size=20 maxlength=20></td></tr>
<tr><td>国家地区：</td><td><select name=country size=1>
<%
  country=rs("country")
  response.write select_type("中国",country)
  response.write select_type("香港",country)
  response.write select_type("台湾",country)
  response.write select_type("美国",country)
  response.write select_type("英国",country)
  response.write select_type("日本",country)
  response.write select_type("韩国",country)
  response.write select_type("加拿大",country)
  response.write select_type("澳大利亚",country)
  response.write select_type("新西兰",country)
  response.write select_type("俄罗斯",country)
  response.write select_type("意大利",country)
  response.write select_type("法国",country)
  response.write select_type("西班牙",country)
  response.write select_type("德国",country)
  response.write select_type("其它国家",country)
%>
</select>&nbsp;&nbsp;&nbsp;&nbsp;<%response.write tit_fir%>语言：<select name=lang size=1>
<%
  lang=rs("lang")
  response.write select_type("简体中文",lang)
  response.write select_type("繁体中文",lang)
  response.write select_type("English",lang)
  response.write select_type("其它语言",lang)
%>
</select>&nbsp;&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden<%if rs("hidden")=false then response.write " checked"%> value='yes' disabled></td></tr>
<%
  pic=rs("pic")
  ispic=apart_filename(pic,1,"/")
  if ispic="" then ispic=joekoe_cms.rand_file(index_url)
%>
<tr><td>图片说明：</td><td><input type=text name=pic value='<%response.write pic%>' size=60 maxlength=100></td></tr>
<%if int(format_mid_num(30))=1 then%>
<tr><td>上传图片：</td><td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=website&upname=<%response.write ispic%>&uptext=pic'></iframe></td></tr>
<%else%>
</tr>
<tr class=bg_td>
<td>上传图片：</td>
<td>功能暂时关闭</td>
</tr>
<%end if%>
<tr><td valign=top class=htd><br><%response.write tit_fir%>说明：<br><=250B</td><td><textarea name=remark rows=5 cols=60><%response.write joekoe_cms.code_word(rs("remark"))%></textarea></td></tr>
<%
  call submit_edit()
end sub

sub news_edit()
  dim topic,keyes,comto,username,tim,counter,istop,hidden,pic,ispic,word
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    topic=code_admin("topic",1,40)
    word=request.form("word")
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if topic="" or word="" then
      rs.close
      call admin_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    end if
    keyes=code_admin("keyes",1,20)
    comto=code_admin("comto",1,10)
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    pic=code_admin("pic",1,100)
    ispic=true
    if pic="" then ispic=false
    hidden=false
    'if trim(request.form("hidden"))="no" then hidden=true
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("cod")=cod_type()
    rs("topic")=topic
    rs("comto")=comto
    rs("username")=username
    rs("tim")=tim
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    rs("ispic")=ispic
    rs("word")=word
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("已成功编辑了一条"&tit_fir&"！","?nsort="&nsort&"&c_id="&cid&"&s_id="&sid,0)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
  pic=rs("pic")
  ispic=apart_filename(pic,1,"/")
  if ispic="" then ispic=joekoe_cms.rand_file(index_url)
%>
<form name=add_frm action='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&s_id=<%response.write sid%>&action=edit&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr>
<td><%response.write tit_fir%>标题：</td>
<td><input type=text name=topic value='<%response.write rs("topic")%>' size=60 maxlength=40><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>分类：</td>
<td><%call chk_csid(nsort,cid,sid)%></td>
</tr>
<tr>
<td><%response.write tit_fir%>关键字：</td>
<td><%call frm_keyes(rs("keyes"))%></td>
</tr>
<tr>
<td><%response.write tit_fir%>出处：</td>
<td><input type=text name=comto value='<%response.write rs("comto")%>' size=20 maxlength=10>&nbsp;&nbsp;<%response.write tit_fir%>发布人：<input type=text name=username value='<%response.write rs("username")%>' size=20 maxlength=20></td>
</tr>
<tr>
<td>发布时间：</td>
<td><input type=text name=tim value='<%response.write rs("tim")%>' size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%> disabled>&nbsp;&nbsp;&nbsp;&nbsp;<%call chk_emoney(0)%></td>
</tr>
<%call html_edit(rs("cod"),"add_frm","word","")%>
<tr>
<td valign=top><%response.write tit_fir%>内容：</td>
<td><textarea name=word rows=15 cols=65><%response.write joekoe_cms.code_word(rs("word"))%></textarea></td>
</tr>
<tr>
<td><%response.write tit_fir%>图片：</td>
<td><input type=text name=pic value='<%response.write pic%>' size=40 maxlength=100><%if int(format_mid_num(30))=1 then%>&nbsp;&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic' target=upload_frame>上传图片</a>&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write left(index_url,1)%>&uptext=word' target=upload_frame>上传至内容</a><%end if%></td>
</tr>
<%if int(format_mid_num(30))=1 then%>
<tr>
<td>上传图片：</td>
<td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic'></iframe></td>
</tr>
<%else%>
</tr>
<tr class=bg_td>
<td>上传图片：</td>
<td>功能暂时关闭</td>
</tr>
<%end if%><%
  call submit_edit()
  rs.close
end sub

sub art_book()
  dim topic,keyes,comto,author,power,emoney,username,tim,counter,istop,hidden,word
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    topic=code_admin("topic",1,50)
    word=request.form("word")
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if topic="" or word="" then
      rs.close
      call admin_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    end if
    keyes=code_admin("keyes",1,20)
    comto=code_admin("comto",1,20)
    author=code_admin("author",1,20)
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    hidden=false
    'if trim(request.form("hidden"))="no" then hidden=true
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("cod")=cod_type()
    rs("topic")=topic
    rs("comto")=comto
    rs("author")=author
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("tim")=tim
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("word")=word
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("已成功编辑了一篇"&tit_fir&"！","?nsort="&nsort&"&c_id="&cid&"&s_id="&sid,1)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
%>
<form name=add_frm action='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&s_id=<%response.write sid%>&action=edit&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr>
<td><%response.write tit_fir%>标题：</td>
<td><input type=text name=topic value='<%response.write rs("topic")%>' size=60 maxlength=50><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>分类：</td>
<td><%call chk_csid(nsort,cid,sid)%></td>
</tr>
<tr>
<td><%response.write tit_fir%>关键字：</td>
<td><%call frm_keyes(rs("keyes"))%></td>
</tr>
<tr>
<td><%response.write tit_fir%>出处：</td>
<td><input type=text name=comto value='<%response.write rs("comto")%>' size=20 maxlength=20>&nbsp;&nbsp;<%response.write tit_fir%>作者：<input type=text name=author value='<%response.write rs("author")%>' size=20 maxlength=20></td>
</tr>
<tr>
<td><%response.write tit_fir%>发布人：</td>
<td><input type=text name=username value='<%response.write rs("username")%>' size=20 maxlength=20>&nbsp;&nbsp;<%call chk_emoney(rs("emoney"))%></td>
</tr>
<%call chk_power("浏览",rs("power"),0)%>
<tr>
<td>发布时间：</td>
<td><input type=text name=tim value='<%response.write rs("tim")%>' size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%> disabled>&nbsp;&nbsp;&nbsp;&nbsp;<%call chk_emoney(0)%></td>
</tr>
<%call html_edit(rs("cod"),"add_frm","word","")%>
<tr>
<td valign=top><%response.write tit_fir%>内容：</td>
<td><textarea name=word rows=15 cols=65><%response.write joekoe_cms.code_word(rs("word"))%></textarea></td>
</tr>
<%if int(format_mid_num(30))=1 then%>
<tr>
<td>上传图片：</td>
<td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write left(index_url,1)%>&uptext=word'></iframe></td>
</tr>
<%else%>
</tr>
<tr class=bg_td>
<td>上传图片：</td>
<td>功能暂时关闭</td>
</tr>
<%end if%>
<%
  call submit_edit()
  rs.close
end sub

sub need_edit()
  dim topic,keyes,comto,author,power,emoney,username,tim,counter,istop,hidden,word
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    topic=code_admin("topic",1,50)
    word=request.form("word")
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if topic="" or word="" then
      rs.close
      call admin_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    end if
    keyes=code_admin("keyes",1,20)
    comto=code_admin("comto",1,20)
    author=code_admin("author",1,20)
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    hidden=false
    'if trim(request.form("hidden"))="no" then hidden=true
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("cod")=cod_type()
    rs("topic")=topic
    rs("comto")=comto
    rs("author")=author
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("tim")=tim
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("word")=word
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("已成功编辑了一篇"&tit_fir&"！","?nsort="&nsort&"&c_id="&cid&"&s_id="&sid,1)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
%>
<form name=add_frm action='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&s_id=<%response.write sid%>&action=edit&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr>
<td><%response.write tit_fir%>标题：</td>
<td><input type=text name=topic value='<%response.write rs("topic")%>' size=60 maxlength=50><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>分类：</td>
<td><%call chk_csid(nsort,cid,sid)%></td>
</tr>
<tr>
<td><%response.write tit_fir%>关键字：</td>
<td><%call frm_keyes(rs("keyes"))%></td>
</tr>
<tr>
<td><%response.write tit_fir%>出处：</td>
<td><input type=text name=comto value='<%response.write rs("comto")%>' size=20 maxlength=20>&nbsp;&nbsp;<%response.write tit_fir%>作者：<input type=text name=author value='<%response.write rs("author")%>' size=20 maxlength=20></td>
</tr>
<tr>
<td><%response.write tit_fir%>发布人：</td>
<td><input type=text name=username value='<%response.write rs("username")%>' size=20 maxlength=20>&nbsp;&nbsp;<%call chk_emoney(rs("emoney"))%></td>
</tr>
<%call chk_power("浏览",rs("power"),0)%>
<tr>
<td>发布时间：</td>
<td><input type=text name=tim value='<%response.write rs("tim")%>' size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%> disabled>&nbsp;&nbsp;&nbsp;&nbsp;<%call chk_emoney(0)%></td>
</tr>
<%call html_edit(rs("cod"),"add_frm","word","")%>
<tr>
<td valign=top><%response.write tit_fir%>内容：</td>
<td><textarea name=word rows=15 cols=65><%response.write joekoe_cms.code_word(rs("word"))%></textarea></td>
</tr>
<%if int(format_mid_num(30))=1 then%>
<tr>
<td>上传图片：</td>
<td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write left(index_url,1)%>&uptext=word'></iframe></td>
</tr>
<%else%>
</tr>
<tr class=bg_td>
<td>上传图片：</td>
<td>功能暂时关闭</td>
</tr>
<%end if%>
<%
  call submit_edit()
  rs.close
end sub

function select_type(st1,st2)
  select_type=vbcrlf&"<option"
  if st1=st2 then select_type=select_type&" selected"
  select_type=select_type&">"&st1&"</option>"
end function
function pro_edit(pt,ptit)
  pro_edit="<a href='"&pt&"'>"&img_admin("edit",ptit)&"</a>"
end function
function mp_integral()
  mp_integral=dim_num(24)
end function
function img_admin(apic,atit)
  dim tmp1
  tmp1=apic
  if var_null(tmp1)="" then tmp1="s_"
  img_admin="<img border=0 src='images/admin/"&tmp1&".gif' alt='"&atit&"' align=absmiddle>"
end function
%>