<%
set rs=conn.execute("select count(*) as counts from table where P_UserId='"&session("P_UserId")&"' and datediff(day,logintime,getdate())=0")
if rs("counts") < 10 then
Set rs_userid=Conn.execute("Select P_UserId From table where P_UserId='"&request("P_UserId")&"' and datediff(day,logintime,getdate())=0")
IF not rs_userid.eof Then
SQL = "Update table Set shijian='"&now()&"' Where P_UserId='"&session("P_UserId")&"'"
Else
SQL = "Insert Into [table](P_UserId,shijian) Values ('"&request("P_UserId")&"','"&now()&"')"
End If
Conn.Execute(SQL)
else
Response.Write "<Script Language=JavaScript>alert('已经超出查看次数');history.back(-1);</Script>"
end if
%>