<!-- #Include File="Include/AMH_onlogin.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

admins=true
Index_Url="sql"
tit_fir="SQL"
tit="执行SQL"
Call AMH_Header(1)
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'><%Response.Write tit%></a></td>
  </tr>
  </table>
</td></tr>
</table>
<%
call AMH_table(1)
select case action
case "chk"
  call AsaiMHChk_Chk()
case else
  call AsaiMHChk_Main()
end select
Call AMH_Ender(tit)
sub AsaiMHChk_Main()
  call AMH_td(tit)
%>
<form action='?action=chk' method=post>
<tr>
<td width='20%'>输入说明：</td>
<td width='80%'>
注意：直接执行SQL是比较危险的，执行前请注意备份数据库!<br />
多句<%Response.Write tit_fir%>语句时请以换行的行式每行输入一条<%Response.Write tit_fir%>语句</td>
</tr>
<tr>
<td width='20%'>输入实例：</td>
<td width='80%'>
改用户名：Update AsaiMHUserData Set Username='用户名' where id='用户ID'<br />
比如给每位用户增加10金币：Update AsaiMHUserData Set Emoney=Emoney+10<br />
将所有软件下载金币改为2：Update AsaiMHDown Set Emoney=2</td>
</tr>
<tr>
<td><%Response.Write tit_fir%>语句：</td>
<td><textarea name=sqls rows=6 cols=65></textarea></td>
</tr>
<tr>
<td></td>
<td><input type=submit value='提交执行' class=btn>　　<input type=reset value='重新填写' class=btn></td>
</tr>
</form>
<%
End Sub
sub AsaiMHChk_Chk()
  Cls.IsDeBug = 0   '关闭错误提示开关
  call AMH_td(tit)
  dim sqls,dim_sql,dim_tmp,snum,i
  sqls=Cls.Code_Admin("sqls",1,0)
  sqls=replace(sqls,"""","'")
  if sqls="" then
    call AMH_error("请至少输入一句"&tit_fir&"语句！")
    exit sub
  End If
  dim_sql=split(sqls,vbcrlf)
  snum=ubound(dim_sql)
  redim dim_tmp(1,snum+1)
  on error resume next
  for i=0 to snum
    call Cls.exec(dim_sql(i),0)
    dim_tmp(0,i)=dim_sql(i)
    dim_tmp(1,i)=1
    if err then
      err.clear
      dim_tmp(1,i)=0
    End If
  next
  if err then err.clear
%>
<tr>
<td colspan=2 align=center>
  <table border=0 width='90%'>
  <tr><td colspan=3>您共输入<font class=red><%Response.Write snum+1%></font>条<%Response.Write tit_fir%>语句，执行情况如下：</td></tr>
  <tr><td width='5%'></td><td width='5%'></td><td width='90%'></td></tr>
<%
  for i=0 to snum
%>
  <tr>
  <td><%Response.Write i+1%>、</td>
  <td><%
    if dim_tmp(1,i)=1 then
      Response.Write "<font class=blue>成功</font>"
    else
      Response.Write "<font class=red>失败</font>"
    End If
%></td>
  <td><%Response.Write dim_tmp(0,i)%></td>
  </tr>
<%
  next
%>
  </table>
</td>
</tr>
<%
  erase dim_sql
  erase dim_tmp
End Sub
%>
