主题:  紧急求助

chen1978822

职务:普通成员
等级:1
金币:0.0
发贴:6
#12005/11/7 9:12:45
默认脚本使用javascript ,但又没有做什么说明直接换成了vbs.这下出错了应该如何说明
这段vbs呢?请大家帮帮,感谢!!

<%@ language=javascript %>
<%
    var mdbpath=Server.MapPath("log.mdb";
    var conn=Server.CreateObject("Adodb.connection";
    var rs=    Server.CreateObject("Adodb.recordset";
    conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + mdbpath + "; User Id=;Password=;";
%>
<%                        
    if ( Request("action"=="add" )
    {
            var time=new Date();
var now=time.getYear()+"-"+(time.getMonth()+1)+"-"+time.getDate()+" "+time.getHours()+":"+time.getMinutes()+":"+time.getSeconds();         
         rs.Open("log",conn,1,3);
         var username=isSet(Request("username")? Request("username" : "未定义";
         var             ip=isSet(Request("ip")? Request("ip" : "未定义" ;
         rs.AddNew();
         rs("username"=Server.HTMLEncode( username );
         rs("addr"=Request.ServerVariables("REMOTE_ADDR";
         rs("ip"=Server.HTMLEncode( ip );
         rs("logtime"=now;
         rs.Update();
    }
    if (Request("action"=="show"
    {
         rs.Open("log",conn);
         var out=1;
%>
    <div align="center">
<center>
<table border="1" width="100%">
<tr>
<td width="50%">
<p align="center">访问名</td>
<td width="50%">
<p align="center">访问ip</td>
<td width="50%">
<p align="center">远程ip</td>
<td width="50%">
<p align="center">访问时间</td>
</tr>
<tr>
<%
         while(!rs.Eof)
         {
             if(out++>1000) break;
%>             
<td width="50%">
<p align="center"><%=Server.HTMLEncode(rs("username")%></td>
<td width="50%">
<p align="center"><%=Server.HTMLEncode(rs("addr")%></td>
<td width="50%">
<p align="center"><%=Server.HTMLEncode(rs("ip")%></td>
<td width="50%">
<p align="center"><%=Server.HTMLEncode(rs("logtime")%></td>
</tr>
<%            rs.MoveNext();
         }
     }    
%>

</table>
</center>
</div>
<%
    if( Request("action"=="del"
    {
            var del_ip=isSet(Request("del_ip")?Server.HTMLEncode(Request("del_ip"):"127.0.0.1";
            conn.Execute("delete from [log] where addr= '"+del_ip+ "'";
    }
    


%>

<%

function isSet(str)
{
var tf=true;
    if (str+''==undefined || str==null || str.Eof || (!(str>"" || str<""))
     tf=false;    
     else
     tf=true;

    return tf;
}
%>

<!--#include file="conn.asp"-->
<SCRIPT LANGUAGE="VBScript">
<%
if session("admin" ="open" then Response.Redirect "admin.asp"
dim username    
dim password    
username = trim(Request.Form("username")
password = trim(Request.Form("password")
OpenDB()
sql="select * from admin where password='"&password&"' and"&_
" username='"&username&"'"
set rs=server.CreateObject("Adodb.recordset"
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
if password=rs("password" then
    response.cookies("users"("username"=username
    response.cookies("users"("userpass"=password
    Session("admin"="open"
    Response.Redirect "index.asp"
end if
end if
rs.close
set rs=nothing
closeDB         
/% >
</SCRIPT>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投票首页</title>
</head>

<body bgcolor="#006699">
<br><center>
<font size="7"><strong><font color="#CC0033" size="6">部门服务满意度调查问卷</font></strong></font>
</center>
<br>
<br>
<form method="post" action="login.asp">
<table width="33%" height="213" border=0
align="center" cellpadding=5 cellspacing=1 bgcolor="#CCCCCC">
<tr bgcolor="#F0F0F0" align="center">
<td colspan="2">用户登录 </td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="50%" align="right" bgcolor="#FFFFFF"><font color="#006699">用户名</font>:</td>
<td width="50%"> <input name="username" type="text" size="11" maxlength="20">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="50%" align="right"><font color="#006699">密 码:</font> </td>
<td width="50%"> <input name="password" type="password" size="11" maxlength="20">
</td>
<tr bgcolor="#FFFFFF">
<td width="50%" height="40" align="right"><font color="#003399">被测评部门:</font>
<td width="50%"> <select name="department" >
<option value="维护">维护</option>
<option value="研发">研发</option>
<option value="人力资源" selected>人力资源</option>
<option value="财务">财务</option>
</select>
</td>
     <%
     if name="维护" then
     Response.Redirect "index.asp"
     end if %>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td colspan="2"> <input type="submit" name="Submit" value=" 登录 "> </td>
</tr>
    
<tr align="center" bgcolor="#FFFFFF">
<td colspan="2">测评时间:
<script language="javascript">
dayObj = new Date();
monthStr = dayObj.getMonth() + 1;
year2000=dayObj.getYear()
document.write(year2000+"年"+monthStr+"月"+dayObj.getDate()+"日"+" ";
if (dayObj.getDay()==1) document.write("星期一";
if (dayObj.getDay()==2) document.write("星期二";
if (dayObj.getDay()==3) document.write("星期三";
if (dayObj.getDay()==4) document.write("星期四";
if (dayObj.getDay()==5) document.write("星期五";
if (dayObj.getDay()==6) document.write("星期六";
if (dayObj.getDay()==0) document.write("星期日";
</script> </td>
</tr>
    

</table>

<div align="center"></div>
</form>
</body>
</html>