<!-- #include file="include/admin_onlogin.asp" -->
<%
'****************************************************
' 阳光情缘 2006V3.0      Power by sdsun.com.cn
' Email: 27072320@qq.com  , sdsun163@163.com
' Web: http://www.sdsun.com.cn
' Copyright (C) 2006 sdsun.com.cn All Rights Reserved.
'****************************************************
admins=true
popedom_num=0
index_url="sql"
tit_fir="SQL"
tit="执行SQL"
call admin_header(0,0)
%>
<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 admin_table(1)

select case action
case "chk"
  call joekoe_chk_chk()
case else
  call joekoe_chk_main()
end select

call admin_ender(1)

sub joekoe_chk_main()
  call admin_td(tit)
%>
<form action='?action=chk' method=post>
<tr>
<td width='20%'>输入说明：</td>
<td width='80%'>多句<%response.write tit_fir%>语句时请以换行的行式每行输入一条<%response.write tit_fir%>语句</td>
</tr>
<tr>
<td><%response.write tit_fir%>语句：</td>
<td>
<table border=0><tr>
<td><textarea name=sqls rows=6 cols=65></textarea></td>
<td width=5></td>
<td valign=bottom><%call textarea_resize("sqls")%></td>
</tr></table>
</td>
</tr>
<tr>
<td></td>
<td><input type=submit value=' 提 交 执 行 '>　　<input type=reset value='重新填写'></td>
</tr>
</form>
<%
end sub

sub joekoe_chk_chk()
  call admin_td(tit)
  dim sqls,dim_sql,dim_tmp,snum,i
  sqls=code_admin("sqls",1,0)
  sqls=replace(sqls,"""","'")
  if sqls="" then
    call admin_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 joekoe_cms.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
'****************************************************
' 阳光情缘 2006V3.0      Power by sdsun.com.cn
' Email: 27072320@qq.com  , sdsun163@163.com
' Web: http://www.sdsun.com.cn
' Copyright (C) 2006 sdsun.com.cn All Rights Reserved.
'****************************************************
%>