<!-- #include file="include/con_down.asp" -->
<%

dim id
id=trim(request.querystring("id"))
if not(isnumeric(id)) then
  call format_redirect("down.asp")
end if
%>
<!-- #include file="include/jk_ubb.asp" -->
<!-- #include file="include/jk_review.asp" -->
<!-- #include file="include/jk_enurl.asp" -->
<!-- #include file="include/jk_keyes.asp" -->
<!-- #include file="include/jk_emoney.asp" -->
<%
dim is_download,temp1,n_username,n_topic,n_tim,down_26,tmp
dim username,d_name,d_sizes,d_genre,d_os,d_power,d_emoney,d_url,d_url2,d_pic,d_homepage,d_remark,d_tim,d_counter,d_keyes,d_types
iframe=true
is_download=true
down_26=int(format_mid_num(26))

sql="select top 1 * from down where hidden=1 and id="&id
call joekoe_cms.exec("",-1)
rs.open sql,conn,1,1
if rs.eof and rs.bof then
  rs.close
  call format_redirect("down.asp")
end if
cid=rs(1)
sid=rs(2)
username=rs("username")
d_name=rs("name")
d_sizes=rs("sizes")
d_genre=rs("genre")
d_os=rs("os")
d_power=rs("power")
d_emoney=rs("emoney")
d_url=rs("url")
d_url2=rs("url2")
d_pic=rs("pic")
d_homepage=rs("homepage")
d_remark=rs("remark")
d_tim=rs("tim")
d_counter=rs("counter")
d_keyes=rs("keyes")
d_types=rs("types")
rs.close

tit="软件浏览 - "&d_name
cname=""
sname=""
if cid>0 then
  if sid>0 then
    sql="select jk_class.c_name,jk_sort.s_name from jk_sort inner join jk_class on jk_sort.c_id=jk_class.c_id where jk_sort.c_id="&cid&" and jk_sort.s_id="&sid
  else
    sql="select c_name from jk_class where c_id="&cid
  end if
  set rs=joekoe_cms.exec(sql,1)
  if not(rs.eof) then
    cname=rs("c_name")
    tit=tit&"（"&cname
    if sid>0 then
      sname=rs("s_name")
      tit=tit&"-"&sname
    end if
    tit=tit&"）"
  end if
  rs.close
end if

if action="download" and is_download and down_26=0 then page_power=d_power
call web_head(0,0,0,0,0)
'----------------------------下载 开始----------------------------
if action="download" and is_download then
  response.clear
  if not joekoe_cms.post_chk() then	'glom_user()
    response.write joekoe_cms.js_put("alert(""软件下载出错：\n\n请不要使用WebZip、Teleport这类软件下载本站数据；\n也不要使用googlebot这类浏览器浏览本站；\n\n请更改浏览器或停止非法操作后再访问本站，谢谢。"")",1)
    response.write joekoe_cms.js_put("location.href='down_view.asp?id="&id&"';",1)
    call web_clear(1)
  end if
  dim dim_upload,prg_p,down_true
  down_true=emoney_notes(d_power,d_emoney,n_sort,id,0,"")
  if not down_true then
    response.write joekoe_cms.js_put("alert(""软件下载出错：\n\n您没有足够的权限或钱币进行刚才的操作！\n\n也可能您还没有注册和登陆本站。"");",1)
    response.write joekoe_cms.js_put("location.href='down_view.asp?id="&id&"';",1)
    call web_clear(1)
  end if
  dim_upload=split(web_dim(14),"|")
  prg_p=dim_upload(4)
  erase dim_upload
  index_url=d_url
  if trim(request("down_url"))="download2" then index_url=d_url2
  sql="update down set counter=counter+1 where id="&id
  call joekoe_cms.exec(sql,0)
  index_url=joekoe_cms.url_true(prg_p,index_url)
  call web_clear(0)
  response.clear
  response.write "nodownload"
  response.redirect index_url
  response.end
end if
'----------------------------下载 结束----------------------------
'----------------------------左边 开始----------------------------
call down_left("hot",10,11,"热门下载")
call down_left("good",10,11,"推荐下载")
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
temp1=CMS_Skin.GetDB("down_view")
temp1=Replace(temp1,"{$name}",joekoe_cms.code_html(d_name,1,0))
temp1=Replace(temp1,"{$genre}",d_genre)
temp1=Replace(temp1,"{$os}",d_os)
temp1=Replace(temp1,"{$id}",id)
temp1=Replace(temp1,"{$sizes}",d_sizes)
temp1=Replace(temp1,"{$types}",d_types)
temp1=Replace(temp1,"{$counter}",d_counter)
temp1=Replace(temp1,"{$username}",format_user_name(username,10,""))
temp1=Replace(temp1,"{$tim}",joekoe_cms.time_type(d_tim,2))
temp1=Replace(temp1,"{$tit_fir}","软件")
temp1=Replace(temp1,"{$tit_fir2}","下载")
if var_null(d_homepage)="" or d_homepage="http://" then
  d_homepage="<font class=gray>没有</font>"
else
  d_homepage="<a href='"&d_homepage&"' target=_blank>"&joekoe_cms.code_html(d_homepage,1,28)&"</a>"
end if
temp1=Replace(temp1,"{$homepage}",d_homepage)
temp1=Replace(temp1,"{$emoney}",d_emoney)
temp1=Replace(temp1,"{$emony_power}",format_emoney_power(d_emoney,d_power,1))
if is_download then
  d_url="&nbsp;&nbsp;&nbsp;<a"
  if int(down_26)=0 then
    d_url=d_url&" href='?action=download&id="&id&"&down_url=' target=_blank"
  else
    d_url=d_url&" href='javascript:;' onclick=""javascript:down_load('');"""
  end if
  d_url=d_url&"><img src='images/down/download.gif' border=0></a>&nbsp;"
  if var_null(d_url2)<>"" and lcase(d_url2)<>"http://" then 
    d_url=d_url&"&nbsp;&nbsp;&nbsp;<a"
  if int(down_26)=0 then
    d_url=d_url&" href='?action=download&id="&id&"&down_url=download2' target=_blank"
  else
    d_url=d_url&" href='javascript:;' onclick=""javascript:down_load('download2');"""
  end if
d_url=d_url&"><img src='images/down/download2.gif' border=0></a>"
end if
else
  d_url=d_url&"&nbsp;<font class=red_3><b>暂停下载</b></font>"
end if
temp1=Replace(temp1,"{$url}",d_url)
if var_null(d_remark)="" then
  d_remark="<font class=gray>好像没有关于该软件的介绍哦！</font>"
else
  d_remark=code_jk(d_remark)
end if
temp1=Replace(temp1,"{$remark}",d_remark)
temp1=Replace(temp1,"{$pic}",pic_fk(d_pic,2,pic_url(d_pic,0)))
temp1=Replace(temp1,"{$commend_friend}",commend_friend(tit,d_name,"down_view.asp?id="&id))
temp1=Replace(temp1,"{$commend_err}",commend_err(tit,d_name,id,n_sort,"err.asp?id="&id))
call down_bar_top(tit,temp1,1,0)
i=0
if var_null(d_keyes)<>"" then
  sql="select id,username,name,tim,counter from down where hidden=1 and "&sql_key(d_keyes,"keyes",1,"or")&" and id<>"&id&" order by id desc"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    n_username=rs("username")
    n_topic=rs("name")
    n_topic=joekoe_cms.code_html(n_topic,1,0)
    n_tim=rs("tim")
    tmp=tmp&down_topic_type(60,rs("id"),n_username,n_topic,n_tim,rs("counter"),false,0)
    rs.movenext
    i=i+1
  loop
  rs.close
end if
if i=0 then tmp="<tr><td><font class=gray>没有相关软件</font></td></tr>"
call down_bar_top("相关软件",tmp,3,1)
call down_bar_top("相关评论",review_type(n_sort,id,"down_view.asp?id="&id,1,username),1,0)
call down_remark("下载说明")
'----------------------------中间 结束----------------------------
call down_end()
call web_end(0,0)

%>
