if statements

G

Gale

Hello, I have a login script on my webpage after the login is verified I have it set to record the users name,browser,date,and IP. but I get a lot of users logging on constantly all day with if statements is there a way I could have the script check to see if the database already contains a matching username and date entry and if it does not to record the login. Thanks for any help, Gale
 
T

Thomas A. Rowe

You would have to write a function that queries the database for the specific user, date and IP, and
if not found, then create a new record.

If would be simpler to just update the login table (the one with the user name and password) to just
capture the date and IP each time the user login.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================


Gale said:
Hello, I have a login script on my webpage after the login is verified I have it set to record
the users name,browser,date,and IP. but I get a lot of users logging on constantly all day with if
statements is there a way I could have the script check to see if the database already contains a
matching username and date entry and if it does not to record the login. Thanks for any help, Gale
 
G

Gale

Thomas, I decided that I did not want to check entries for entries. I want to just make it so that certain usernames are not recorded,especially for administrators since htey logg in a lot,. I tried to do that with the code below but it doiesn't work. IF the username is "pop" it just quits running the script entirely and never redirects to the home.asp page. Thanks for your help, Gal

If Session("Username") = "pop" The

End I
Els

rs.addne
rs.Fields("User") = Session("UserName"
rs.Fields("IP") = Request.ServerVariables("REMOTE_ADDR"
rs.Fields("Date") = strdatetoda
rs.Fields("Browser") = Request.ServerVariables("HTTP_USER_AGENT"
rs.updat
rs.requer

set rs = nothin
set conn = nothin

'Redirect to the authorised user page and send the users nam
Response.Redirect"home.asp?name=" & strUserNam
 
T

Thomas A. Rowe

Try:

If Session("Username") = "pop" Then
Response.Redirect "home.asp?name=" & strUserName
End IF

If Session("Username") <> "pop" Then
rs.addnew
rs.Fields("User") = Session("UserName")
rs.Fields("IP") = Request.ServerVariables("REMOTE_ADDR")
rs.Fields("Date") = strdatetoday
rs.Fields("Browser") = Request.ServerVariables("HTTP_USER_AGENT")
rs.update
rs.requery
set rs = nothing
set conn = nothing
Response.Redirect "home.asp?name=" & strUserName
End If

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================


Gale said:
Thomas, I decided that I did not want to check entries for entries. I want to just make it so that
certain usernames are not recorded,especially for administrators since htey logg in a lot,. I tried
to do that with the code below but it doiesn't work. IF the username is "pop" it just quits running
the script entirely and never redirects to the home.asp page. Thanks for your help, Gale
 
T

Thomas A. Rowe

You are welcome.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
Top