|
 |
asp_web_howto thread: Storing IP
Message #1 by "Andy" <andy@t...> on Tue, 25 Mar 2003 08:10:58 +0800
|
|
Hello,
I have develop a login page when the user has enter the correct username and
password, it will then store his remote ip into the database table.
I have encounter that sometimes the page work but some time does not work ,
below is my sample codes :
If Password = rsAuthors("staff_pass") Then
'If the password is correct then set the session variable to True
Session("name") = rsAuthors("staff_name")
Session("login") = rsAuthors("staff_login")
Set rsAuthors2 = Server.CreateObject("ADODB.Recordset")
strSQL2 = "SELECT
tblaudit.ip,tblaudit.userlogin,tblaudit.logintime,tblaudit.status FROM
tblaudit"
rsAuthors2.Open strSQL2,adoConn,adOpenDynamic,adLockOptimistic,adCmdText
rsAuthors2.AddNew
rsAuthors2.Fields("ip") = Request.ServerVariables("REMOTE_HOST")
rsAuthors2.Fields("userlogin") = Session("login")
rsAuthors2.Fields("logintime") = Now()
rsAuthors2.Fields("status") = "Staff"
rsAuthors2.Update
Response.Redirect("Admin_Main.asp")
End if
What is the possible cause of this or is there any better idea to achieve
this?
Regards,
Andy
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 25 Mar 2003 18:00:06 +1100
|
|
What do you mean by "it doesn't work"?
a) it doesn't do anything
b) you get an error - what is the error?
c) it does something, but not what you expect
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Andy" <andy@t...>
Subject: [asp_web_howto] Storing IP
: I have develop a login page when the user has enter the correct username
and
: password, it will then store his remote ip into the database table.
:
: I have encounter that sometimes the page work but some time does not work
,
: below is my sample codes :
:
: If Password = rsAuthors("staff_pass") Then
:
: 'If the password is correct then set the session variable to True
: Session("name") = rsAuthors("staff_name")
: Session("login") = rsAuthors("staff_login")
:
: Set rsAuthors2 = Server.CreateObject("ADODB.Recordset")
: strSQL2 = "SELECT
: tblaudit.ip,tblaudit.userlogin,tblaudit.logintime,tblaudit.status FROM
: tblaudit"
: rsAuthors2.Open strSQL2,adoConn,adOpenDynamic,adLockOptimistic,adCmdText
:
: rsAuthors2.AddNew
: rsAuthors2.Fields("ip") = Request.ServerVariables("REMOTE_HOST")
: rsAuthors2.Fields("userlogin") = Session("login")
: rsAuthors2.Fields("logintime") = Now()
: rsAuthors2.Fields("status") = "Staff"
: rsAuthors2.Update
: Response.Redirect("Admin_Main.asp")
:
: End if
:
: What is the possible cause of this or is there any better idea to achieve
: this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Andy" <andy@t...> on Tue, 25 Mar 2003 22:29:54 +0800
|
|
Hello Ken,
The script works at the first time when I run it and it stored the IP
address to the database table.But when I log off and relogin and enter the
correct username and password.The checking will be perform and stored the
session variable name.I have programmed it in the way if the session has
expired , then the user will be log off of the system when he click on any
function.This happened to the issue as it seems that it detects no session
is enabled.
Regards,
Andy
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Tuesday, March 25, 2003 3:00 PM
Subject: [asp_web_howto] Re: Storing IP
> What do you mean by "it doesn't work"?
>
> a) it doesn't do anything
> b) you get an error - what is the error?
> c) it does something, but not what you expect
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Andy" <andy@t...>
> Subject: [asp_web_howto] Storing IP
>
>
> : I have develop a login page when the user has enter the correct username
> and
> : password, it will then store his remote ip into the database table.
> :
> : I have encounter that sometimes the page work but some time does not
work
> ,
> : below is my sample codes :
> :
> : If Password = rsAuthors("staff_pass") Then
> :
> : 'If the password is correct then set the session variable to True
> : Session("name") = rsAuthors("staff_name")
> : Session("login") = rsAuthors("staff_login")
> :
> : Set rsAuthors2 = Server.CreateObject("ADODB.Recordset")
> : strSQL2 = "SELECT
> : tblaudit.ip,tblaudit.userlogin,tblaudit.logintime,tblaudit.status FROM
> : tblaudit"
> : rsAuthors2.Open
strSQL2,adoConn,adOpenDynamic,adLockOptimistic,adCmdText
> :
> : rsAuthors2.AddNew
> : rsAuthors2.Fields("ip") = Request.ServerVariables("REMOTE_HOST")
> : rsAuthors2.Fields("userlogin") = Session("login")
> : rsAuthors2.Fields("logintime") = Now()
> : rsAuthors2.Fields("status") = "Staff"
> : rsAuthors2.Update
> : Response.Redirect("Admin_Main.asp")
> :
> : End if
> :
> : What is the possible cause of this or is there any better idea to
achieve
> : this?
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
|
|
 |