<!-- #include file="include/config.asp" -->
<%
dim id
id=trim(request.querystring("id"))
if not(isnumeric(id)) then
  call format_redirect("Index.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

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("Index.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_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="软件浏览"
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")
    if sid>0 then
      sname=rs("s_name")
    end if
  end if
  rs.close
end if

if action="download" and is_download and down_26=0 then page_power=d_power

tit=cname
url1="list.asp?action=more&c_id="&cid
if sname<>"" then
tit2=sname
url2="list.asp?action=more&c_id="&cid&"&s_id="&sid
tit3="浏览:"&d_name
else
tit2="浏览:"&d_name
end if

call web_head(0,0,0,0,0)
'----------------------------下载 开始----------------------------
if action="download" and is_download then
  response.clear
dim urltype
  Sql="select url,urltype from down_file where downid="&request("id")&" and downno="&request("down_url")
  set rs=joekoe_cms.exec(sql,1)
  if not rs.eof then
    d_url=rs("url")
    urltype=rs("urltype")
    if urltype<>"" then
    call down_server(int(urltype),d_url)
    end if
  else
    rs.close
    response.end
  end if

  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='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='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
  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 joekoe_cms.exec("insert into downlog(username,name,ip,data) values('"&login_username&"','"&d_name&"','"&user_ip&"','"&joekoe_cms.now_time&"')",0)
  call web_clear(0)
  response.clear
  response.write "nodownload"
  response.redirect index_url
  response.end
end if
'----------------------------下载 结束----------------------------
'----------------------------左边 开始----------------------------
call down_left_sort(tit,0)
call down_left2("hot",cid,sid,10,22,"本类热门下载")
call down_left2("good",cid,sid,10,22,"本类推荐下载")
'----------------------------左边 结束----------------------------
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,0,""))
temp1=Replace(temp1,"{$tim}",joekoe_cms.time_type(d_tim,2))
temp1=Replace(temp1,"{$tit_fir}","软件")
temp1=Replace(temp1,"{$tit_fir2}","下载")
temp1=Replace(temp1,"{$emony_power}",format_emoney_power(d_emoney,d_power,1))
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)


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,"view.asp?id="&id))
temp1=Replace(temp1,"{$commend_err}",commend_err(tit,d_name,id,n_sort,joekoe_cms.web_dir&"common/Err.asp?id="&id))
call down_center_table(tit2,temp1,1,0)


if is_download then
dim pi,dlist,rs_file
sql="select * from down_file where downid="&id&" order by downno"
Set rs_file= Server.CreateObject("ADODB.Recordset") 
  rs_file.open sql,conn,1,1
  if not rs_file.eof then
  do while not rs_file.eof
 pi=pi+1
   if int(down_26)=0 then
 dlist=dlist&"<img src='"&joekoe_cms.web_dir_skin&"main/download.gif' align=absmiddle border=0></a>&nbsp;"
 dlist=dlist&"<a href=""?action=download&id="&id&"&down_url="&rs_file("downno")&""" target=_blank>"
   else
 dlist=dlist&"<img src='"&joekoe_cms.web_dir_skin&"main/download.gif' align=absmiddle border=0></a>&nbsp;"
 dlist=dlist&"<a href='javascript:;' onclick=""javascript:down_load("&rs_file("downno")&");"">"

  end if
if rs_file("filename")="" then
 dlist=dlist&"<img src='"&web_var(web_config,10)&"images/download2.gif' border=0></a>&nbsp;"
else
 dlist=dlist&rs_file("filename")&"</a><br>"  
end if
 rs_file.movenext
 loop
 end if
rs_file.close
else
  dlist= "&nbsp;<font class=red_3><b>暂停下载</b></font>"
end if
response.write"<script language=javascript>" & _
vbcrlf&"<!--" & _
vbcrlf&"function down_load(url)" & _
vbcrlf&"{" & _
vbcrlf&"  var t1=note_emoney('下载此软件','"&d_emoney&"','"&d_power&"');" & _
vbcrlf&"  if (t1==true)" & _
vbcrlf&"  {" & _
vbcrlf&"    document.down_frm.down_url.value=url;" & _
vbcrlf&"    document.down_frm.submit();" & _
vbcrlf&"  }" & _
vbcrlf&"}" & _
vbcrlf&"-->" & _
vbcrlf&"</script>" 


call down_center_table("下载地址",dlist,3,1)

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_center_table("相关软件",tmp,3,1)
call down_center_table("相关评论",review_type(n_sort,id,joekoe_cms.web_path&"down/view.asp?id="&id,1,username),1,0)
call down_remark("下载说明")
'----------------------------中间 结束----------------------------
call down_end()
call web_end(0,0)
%>

