<%
if guestsoft<>"yes" and UserLogined<>True then
call guesterror()
response.end
end if

dim soft_id,cat_id,class_id
dim founderr,errmsg,RsHxcms

if request.querystring("soft_id")<>"" then
    if not isInteger(request.querystring("soft_id")) then
    Response.Redirect "show_error.asp?eid=传值参数非法!"
    Response.End
    end if
	soft_id=CLng(request("soft_id"))
else
	soft_id=0
end if

if request.querystring("cat_id")<>"" then
    if not isInteger(request.querystring("cat_id")) then
    Response.Redirect "show_error.asp?eid=传值参数非法!"
    Response.End
    end if
	cat_id=CLng(request("cat_id"))
else
	cat_id=0
end if

if request.querystring("class_id")<>"" then
  if not isInteger(request.querystring("class_id")) then
    Response.Redirect "show_error.asp?eid=传值参数非法!"
    Response.End
  end if
  class_id=CLng(request("class_id"))
else
  class_id=0
end if

if soft_id>0 then
   sql="select * from game_soft where soft_id="&soft_id
   set rs=server.createobject("adodb.recordset")
   rs.open sql,conn,1,3
	if rs.bof and rs.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>你要找的游戏不存在，或者已经被管理员删除！</li>"
	else	
		if rs("Passed")=1 then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>你要找的游戏尚未被管理员审核！</li>"
		else
			start="游戏中心 - "&rs("soft_name")&""
                        cat_id=CLng(rs("soft_catid"))
                        class_id=CLng(rs("soft_classid"))
                        rs("soft_rcount")=rs("soft_rcount")+1
			rs.update
		end if
	end if
end if

'=================================================
if FoundErr=True then
	Call HxErrMsg()
	response.end
end if

'=================================================
'过程名：main_game
'作  用：显示游戏版面位置导航
'参  数：无
'=================================================
sub main_game()
if cat_id>0 then
  Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> >> <a href='game.asp'>游戏中心</a>" & vbCrLf
  sql="select * from game_cat where cat_id="&cat_id
  set rs3=conn.execute(sql)
  if rs3.eof then
  Response.Redirect "show_error.asp?eid=参数错误，找不到相关的记录!"
  Response.End
  End IF
  Response.Write " >> <a href=""game.asp?cat_id="&rs3("cat_id")&""">"&rs3("cat_name")&"</a>" 
  if class_id>0 then
     sql="select * from game_class where cat_id="&rs3("cat_id")&" and class_id="&class_id
     set rs4=conn.execute(sql)
     if rs4.eof then
     Response.Redirect "show_error.asp?eid=参数错误，找不到相关的记录!"
     Response.End
     End IF
     Response.Write " >> <a href='game.asp?cat_id="&rs4("cat_id")&"&class_id="&rs4("class_id")&"'>"&rs4("class_name")&"</a>" 
     rs4.close
     set rs4=nothing
  end if
  rs3.close
  set rs3=nothing 
else
  Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> >> <a href='game.asp'>游戏中心</a>" & vbCrLf
end if
end sub

'=================================================
'过程名：class_game
'作  用：下载分类——纵排
'参  数：无
'=================================================
sub class_game()
sql="select * from game_cat"
set rs1=conn.execute(sql)
do while not rs1.eof
if request("cat_id")=cstr(rs1("cat_id")) then
response.write "&nbsp;<font color=""#FF0000"">·"&rs1("cat_name")&"</font><BR>"
else
response.write "&nbsp;<font color=""#FF0000"">·</font><a href='game.asp?cat_id="&rs1("cat_id")&"'>"&rs1("cat_name")&"</a><BR>"
end if
sql="select * from game_class where cat_id="&rs1("cat_id") 
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof
if request("class_id")=cstr(rs2("class_id")) then
response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#008800>├ "&rs2("class_name")&"</a></font><BR>"
else
response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='game.asp?cat_id="&rs2("cat_id")&"&class_id="&rs2("class_id")&"'>├ "&rs2("class_name")&"</a><BR>"
end if
rs2.movenext
loop
rs1.movenext
loop
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing
end sub

'=================================================
'过程名：class1_game
'作  用：下载分类——纵排
'参  数：无
'=================================================
sub class1_game(n)
sql="select top "&n&" * from game_cat"
set rs1=conn.execute(sql)
do while not rs1.eof
if request("cat_id")=cstr(rs1("cat_id")) then
else
response.write "<a href='game.asp?cat_id="&rs1("cat_id")&"'></a>"
end if
sql="select top "&n&" * from game_class where cat_id="&rs1("cat_id") 
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof
if request("class_id")=cstr(rs2("class_id")) then
response.write "&nbsp;<font color=#FF0000>·"&rs2("class_name")&"</a></font>"
else
response.write "&nbsp;·<a href='game.asp?cat_id="&rs2("cat_id")&"&class_id="&rs2("class_id")&"'>"&rs2("class_name")&"</a>"
end if
rs2.movenext
loop
rs1.movenext
loop
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing
end sub

'=================================================
'过程名：top_game
'作  用：全部游戏排行
'参  数：n-调用条数,nn-显示长度
'        NewWindows-----是否新窗打开，True为是，False为否
'=================================================
sub top_game(n,nn,NewWindows)
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""				
end if
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
set RsHxcms=server.createobject("adodb.recordset")
set RsHxcms=conn.execute("SELECT top "&n&" * FROM game_soft where passed=0 ORDER by soft_dcount DESC,soft_id DESC")
do while not RsHxcms.eof
Response.Write "<tr><td height=22 class=table-xia>&nbsp;<font color=#FF0000>·</font><a href='showgame.asp?soft_id="&RsHxcms("soft_id")&"' Title='游戏名称："&RsHxcms("soft_name")&"&#13&#10下载次数："&RsHxcms("soft_dcount")&"&#13&#10上传时间："&RsHxcms("soft_joindate")&"' "&nnn&">"&gotTopic(RsHxcms("soft_name"),nn)&"</a></td></tr>" & vbCrLf
RsHxcms.movenext
loop
if RsHxcms.bof and RsHxcms.eof then
Response.Write "<tr><td align='center' valign='middle'>当前没有游戏！</td></tr>"
end if
RsHxcms.close
set RsHxcms=nothing
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：best_game
'作  用：推荐游戏
'参  数：n-调用条数,nn-显示长度
'        NewWindows-----是否新窗打开，True为是，False为否
'=================================================
sub best_game(n,nn,NewWindows)
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""				
end if
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
set RsHxcms=server.createobject("adodb.recordset")
set RsHxcms=conn.execute("SELECT top "&n&" * FROM game_soft where isbest = 1 order by soft_id desc")
do while not RsHxcms.eof
Response.Write "<tr><td height=22 class=table-xia>&nbsp;<font color=#FF0000>·</font><a href='showgame.asp?soft_id="&RsHxcms("soft_id")&"' Title='游戏名称："&RsHxcms("soft_name")&"&#13&#10下载次数："&RsHxcms("soft_dcount")&"&#13&#10上传时间："&RsHxcms("soft_joindate")&"' "& nnn &">"&gotTopic(RsHxcms("soft_name"),nn)&"</a></td></tr>" & vbCrLf
RsHxcms.movenext
loop
if RsHxcms.bof and RsHxcms.eof then
Response.Write "<tr><td align='center' valign='middle'>没有推荐游戏！</td></tr>"
end if
RsHxcms.close
set RsHxcms=nothing
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：search_game
'作  用：显示游戏搜索表单
'参  数：无
'=================================================
sub search_game()
Response.Write "<form name='form1' method='post' action='game.asp'><div align=center><input type='radio' name='select' value='soft_name' checked class='inuptCG'>名称&nbsp;<input type='radio' name='select' value='soft_desc' class='inuptCG'>简介&nbsp;<input type='radio' name='select' value='review' class='inuptCG'>评论<br><input type='text' name='keyword' size='15' value='搜索关键字' maxlength='50' onfocus=""this.value=''"" class='input'>&nbsp;<input type='submit' name='Submit'  value='搜索' onmouseover=""this.className='boton'"" onmouseout=""this.className='botoff'""></div></form>" & vbCrLf
end sub

'=================================================
'过程名：displayList_game
'作  用：带分页功能的游戏列表
'参  数：popdownnum------热门点击数
'        nn--------------标题长度
'        Hxperpage-------每页显示条数
'        ImgWidth   ----图片宽度
'        ImgHeight  ----图片高度
'        classyes--------是否显示分类，True为是，False为否
'        NewWindows------是否新窗打开，True为是，False为否
'=================================================
sub displayList_game(nn,Hxperpage,ImgWidth,ImgHeight,classyes,NewWindows)
Dim CurPage,Url_Add
Url_Add="?"
If Request.QueryString("Page")<>"" Then
   Curpage=Request.QueryString("Page")
   If IsInteger(Curpage)=False Then Curpage=1
Else
   Curpage=1
End If
if request("keyword")<>"" then
  if instr(request("keyword"),"'")>0 then
    Response.Write "<script language=javascript>alert('搜索参数非法！');javascript:history.back();</script>"
    Response.End
  end if
end if
if request.querystring("cat_id")<>"" and request("class_id")="" then
   sql="SELECT * FROM game_soft where soft_catid="&cat_id&" and passed=0 order by istop desc,soft_id desc"
   Url_Add=Url_Add&"cat_id="&cat_id&"&"
elseif request("class_id")<>"" and request("keyword")="" then
   sql="SELECT * FROM game_soft where soft_classid="&class_id&" and passed=0 order by istop desc,soft_id desc"
   Url_Add=Url_Add&"cat_id="&request("cat_id")&"&class_id="&class_id&"&"
elseif request("keyword")<>"" and (request("select")="soft_name" or request("select")="soft_desc" or request("select")="review" or request("select")="tjuser") then
   sql="select * FROM game_soft where passed=0 and "&request("select")&" like '%"&Jencode(checkspace(request("keyword")))&"%' order by istop desc,soft_id DESC"
   Url_Add=Url_Add&"select="&request("select")&"&keyword="&Server.URLEncode(request("keyword"))&"&"
else
sql="SELECT * FROM game_soft where passed=0 order by istop desc,soft_id desc"
end if
set rssoft=server.createobject("adodb.recordset")
rssoft.open sql,conn,1,1
Response.Write "<table width='95%' border='1' align='center' cellspacing='0' cellpadding='0' bgcolor='#FFFFFF' bordercolor='#f0f0f0' style='border-collapse: collapse'>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td height=30 colSpan=4><FONT color=#b70000>&nbsp;<B>·</B></FONT>"
if request("class_id")<> "" or request("cat_id")<>"" then
Response.Write "本分类共有"
elseif request("select")<>"" then
Response.Write "共搜索到"
else
Response.Write "当前共有"
end if
Response.Write "<span>"&rssoft.recordcount&"</span>个游戏</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
if not rssoft.eof then
   Dim Hx_Nums,MultiPages,i
   Rssoft.PageSize=Hxperpage
   Rssoft.AbsolutePage=CurPage
   Hx_Nums=Rssoft.RecordCount
   MultiPages="<tr><td colspan=""4"" height='28' align=""center"">"&MultiPage(Hx_Nums,Hxperpage,CurPage,Url_Add)&"</td></tr>"
Do Until Rssoft.EOF OR i=Hxperpage
if rssoft("istop")="1" then      
folder="<img src=""img/1.gif"" title=固顶游戏>"       
else
folder="<img src=""img/4.gif"" title=普通游戏>"       
end if      
if rssoft("istop")="0" then      
if rssoft("isbest")=1 then
folder="<img src=""img/2.gif"" title=推荐游戏>"
elseif rssoft("soft_rcount")>=popsoftnum then
folder="<img src=""img/3.gif"" title=热门游戏>"      
else
folder="<img src=""img/4.gif"" title=普通游戏>"       
end if      
end if 
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""				
end if          
Response.Write "<tr>" & vbCrLf
Response.Write "<td colspan=3 height='10'></td>"
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td colspan=3 height=25>"
Response.Write "<table width='100%' border='0'>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<TD width='15' align=Center>"&folder&"</TD>"
Response.Write "<td width='*'>"
if classyes=True then Response.Write "<a href='game.asp?cat_id="&rssoft("soft_catid")&"&class_id="&rssoft("soft_classid")&"'>『"&left(rssoft("soft_classname"),10)&"』</a>"
Response.Write "<a href='showgame.asp?soft_id="&rssoft("soft_id")&"' Title='查看详细内容' "& nnn &"><font color='#ff0000'><B>"&gotTopic(rssoft("soft_name"),nn)&"</B></font></a></td>"
Response.Write "<td width='140' align='right'>"&rssoft("soft_joindate")&"</td>"
Response.Write "</tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
Response.Write "</td></tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td rowspan='5' align='center' width='110'><a href='showgame.asp?soft_id="&rssoft("soft_id")&"' Title='查看详细内容' "& nnn &"><img src='"&rssoft("soft_showpic")&"' width='"&ImgWidth&"' height='"&ImgHeight&"' border='0' alt='点击进入'></a></td>"
Response.Write "<td width='80' height='22' align=Center>游戏大小：</td>"
Response.Write "<td width='400' height='22'>&nbsp;"&rssoft("soft_size")&"</td>"
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td height='22' align=Center>应用平台：</td>"
Response.Write "<td height='22'>&nbsp;平台:&nbsp;"&rssoft("soft_roof")&"&nbsp;&nbsp;类型:&nbsp;"&rssoft("soft_mode")&"</td>"
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf 
Response.Write "<td height='22' align=Center>推荐程度：</td>"
Response.Write "<td height='22'>&nbsp;<img src='img/star"&rssoft("soft_commend")&".gif' align='absmiddle'></td>"
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf 
Response.Write "<td height='22' align=Center>下载浏览：</td>"
Response.Write "<td height='22'>&nbsp;下载:"&rssoft("soft_dcount")&"&nbsp;&nbsp;浏览:"&rssoft("soft_rcount")&"</td>"
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf 
Response.Write "<td height='40' align=Center>游戏介绍：</td>"
Response.Write "<td height='40'>　　"&left(rssoft("soft_desc"),90)&"...</td>"
Response.Write "</tr>" & vbCrLf
i=i+1
rssoft.movenext
loop
else
if rssoft.eof and rssoft.bof then
Response.Write "<tr align='center'>" & vbCrLf
Response.Write "<td align=middle height='60' colSpan=4>"
if request("class_id")<> "" or request("cat_id")<>"" then
Response.Write "该分类暂时没有游戏"
elseif request("keyword")<>"" then
Response.Write "没有找到包含[<b><font color=red>"&request("keyword")&"</font></b>]的游戏！"
else
Response.Write "当前还没有提供游戏下载！"
end if
Response.Write "</td></tr>" & vbCrLf
end if
end if
Response.Write "<tr><td colspan='4' height='10'></td></tr>"
Response.Write(MultiPages)
Response.Write "</TABLE>" 
rssoft.close
set rssoft=nothing
end sub

'=================================================
'过程名：content_pic
'作  用：显示游戏标题、内容
'参  数：无
'=================================================
sub content_game()
if rs("Grade")="0" then
hxGrade="游客身份"
elseif rs("Grade")="1" then
hxGrade="会员身份"       
elseif rs("Grade")="2" then
hxGrade="VIP身份"       
end if      
Response.Write "<table width=""100%""  border=""1"" align=""center"" cellspacing=""0"" cellpadding=""3"" bgcolor=""#FFFFFF"" bordercolor=""#f0f0f0"" style=""border-collapse: collapse"">"
Response.Write "<tr>" & vbCrLf 
Response.Write "<td colspan=3 align='center' HEIGHT=30><b><font color=ff6600><b>"&rs("soft_name")&"</b></font><b></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td height='25' align='center' width='15%'>加入时间</td>" & vbCrLf
Response.Write "<td width='35%'>&nbsp;"&rs("soft_joindate")&"</td>" & vbCrLf
Response.Write "<td rowspan='9' align='center' >" & vbCrLf
if rs("soft_showpic")<>"http://eove.cn" then
Response.Write "<a href='"&rs("soft_showpic")&"' title='"&rs("soft_showpic")&"' target=_blank><img src='"&rs("soft_showpic")&"' border='0'></a>" & vbCrLf
else
Response.Write "<img src='img/nopic.gif' border='0' valign='center'>" & vbCrLf
end if
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td height='25' align='center' width='15%'>游戏类别</td>" & vbCrLf
Response.Write "<td width='35%'>&nbsp;"&rs("soft_classname")&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td height='25' align='center'>游戏大小</td>" & vbCrLf
Response.Write "<td>&nbsp;"&rs("soft_size")&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td height='25' align='center'>应用平台</td>" & vbCrLf
Response.Write "<td>&nbsp;"&rs("soft_roof")&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td height='25' align='center'>推荐程度</td>" & vbCrLf
Response.Write "<td>&nbsp;<img src='img/star"&rs("soft_commend")&".gif' align='absmiddle'></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td height='25' align='center'>下载权限</td>" & vbCrLf
Response.Write "<td>&nbsp;<font color=red>"&hxGrade&"</font></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td height='25' align='center'>下载花费</td>" & vbCrLf
Response.Write "<td>&nbsp;<font color=red>"&rs("points")&"</font> " &moneyname& "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td height='30' align='center' width='15%'>发布会员</td>" & vbCrLf
Response.Write "<td>&nbsp;"&rs("tjuser")&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr> " & vbCrLf
Response.Write "<td height='25' align='center'>下载浏览</td>" & vbCrLf
Response.Write "<td >&nbsp;下载:"&rs("soft_dcount")&"&nbsp;&nbsp;浏览:"&rs("soft_rcount")&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf 
Response.Write "<td width='100%' colspan=3 style=""display:block;padding:0px 10px;LINE-HEIGHT: 180%"">&nbsp;&nbsp;<b>相关简介：</b><br>"&formatStr(autourl(rs("soft_desc")))&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf 
Response.Write "<tr>" & vbCrLf 
Response.Write "<td height='25' align='center'>下载地址</td>" & vbCrLf
Response.Write "<td colspan=3>" & vbCrLf
if UserLogined<>True then 
    Grade=0
else 
    Grade=Hx66_Grade+1
end if
if Grade>=RS("Grade") and Hx66_points>=rs("points") then 
Response.Write "&nbsp;&nbsp;<a href='opengame_soft.asp?soft_id="&rs("soft_id")&"&url=1' title='直接下载'><img src=img/download_1.gif border=0></a> " & vbCrLf
if rs("soft_url2")<>"" then
Response.Write "&nbsp;&nbsp;<a href='opengame_soft.asp?soft_id="&rs("soft_id")&"&url=2' title='直接下载'><img src=img/download_2.gif border=0></a>" & vbCrLf 
end if
if rs("soft_url3")<>"" then
Response.Write "&nbsp;&nbsp;<a href='opengame_soft.asp?soft_id="&rs("soft_id")&"&url=3' title='直接下载'><img src=img/download_3.gif border=0></a>" & vbCrLf 
end if
if rs("soft_url4")<>"" then
Response.Write "&nbsp;&nbsp;<a href='opengame_soft.asp?soft_id="&rs("soft_id")&"&url=4' title='直接下载'><img src=img/download_4.gif border=0></a>" & vbCrLf 
end if
Response.Write "</td>" & vbCrLf
elseif Grade<RS("Grade") then
Response.Write "<font color=red>对不起，不能下载本游戏，请注册后再下载本游戏！</font>" & vbCrLf
elseif Hx66_points<rs("points") then
Response.Write "<font color=red>对不起，你的点数不足(你当前点数为：" &Hx66_points& ")，无法下载本游戏。请与我们联系进行充值。</font>" & vbCrLf
end if
Response.Write "</tr></table>" & vbCrLf
end sub

'=================================================
'过程名：contextual_game
'作  用：显示游戏上下个
'参  数：无
'=================================================
sub contextual_game()
set RelationArt = conn.execute("select top 1 soft_id,soft_name FROM game_soft where soft_id<"&request.querystring("soft_id")&" and passed=0 order by soft_joindate desc")
IF RelationArt.eof and relationArt.bof Then
Response.Write "<font color=red>·上个游戏：</font>已经没有了<BR> "    
else
Response.Write "<font color=red>·上个游戏：</font><a href=""showgame.asp?soft_id=" & RelationArt(0) & """>" & relationArt(1) & "</a><BR>"   
end if   
Set RelationArt=Nothing
set RelationArt = conn.execute("select top 1 soft_id,soft_name FROM game_soft where soft_id>"&request.querystring("soft_id")&" and passed=0 order by soft_id")
IF RelationArt.eof and relationArt.bof Then
Response.Write "<font color=red>·下个游戏：</font>已经没有了"   
else
Response.Write "<font color=red>·下个游戏：</font><a href=""showgame.asp?soft_id=" & RelationArt(0) & """>" & relationArt(1) & "</a></td>"  
end if  
RelationArt.close
Set RelationArt=Nothing 
end sub
%>