不會就要學,會asp連資料庫的薪水絕對比只會dreanwaver高,而且解決問題不能只局限於一種工具.以下是我的範例並沒有很完美,但是已有達到你的功能了.
http://140.122.118.40/test.asp
(範例只能周一到周五的早上9:00到18:00看的到,個人電腦的問題看之前要按重新整理)(資料庫保密不能公怖)
原始碼
-------------------------------------------------------------------------------------
test.asp
-------------------------------------------------------------------------------------
<form method="POST" action="test2.asp">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="400">
<tr>
<td width="200" align="center">帳號</td>
<td width="200">
<p align="center"><INPUT type="text" id="eng" size="20" name="theid"></td>
</tr>
<tr>
<td width="200" align="center">密碼</td>
<td width="200">
<p align="center"><INPUT type="password" id="eng0" size="20" name="thepassword"></td>
</tr>
</table><INPUT type="submit" value="送出">
</center>
</form>
-------------------------------------------------------------------------------------
test2.asp
-------------------------------------------------------------------------------------
<Script Language="javascript">
function goout()
{
var wid=window.open ("test3.asp?theid=<%=request("theid")%>","","width=500,height=500");
}
</Script>
<body onunload="goout()">
<%
function Error(str)
response.write "<script>" & VbCrLf
response.write "alert('"&str&"')" & VbCrLf
response.write "history.go(-1)" & VbCrLf
response.write "</script>" & VbCrLf
response.end
end function
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "保密"
sqlstr="select * from theuser where theid='" & request("theid") & "' and thepassword= '" & request("thepassword") & "'"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sqlstr,Conn,adOpenKeyset,3,adCmdText
if rs.eof then error "帳號或密碼錯誤"
if rs("thestatus")=1 then error "已有人使用不得使用"
if rs("thestatus")=0 then
sqlstr="update theuser set thestatus=1 where theid='" & request("theid") & "'"
conn.execute(sqlstr)
%>
使用中
<input type="button" value="登出" name="B1" onclick="window.close()"></p>
<%
end if
%>
</body>
-------------------------------------------------------------------------------------
test3.asp
-------------------------------------------------------------------------------------
<%
function ShowMessage(str,url)
response.write "<script>" & VbCrLf
response.write "location.href='"&url&"'" & VbCrLf
response.write "alert('"&str&"')" & VbCrLf
response.write "</script>" & VbCrLf
response.end
end function
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "保密"
sqlstr="update theuser set thestatus=0 where theid='" & request("theid") & "'"
conn.execute(sqlstr)
ShowMessage "你已登出","test.asp"
%>