CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 Tracking IP Address in CCSB5

Print topic Send  topic

Author Message
Harry Wheat
Posted: 05/29/2002, 4:22 PM

Can someone point me in the right direction to track a users IP Address
Whenever a user Logs in. I would like to store it in the users Table in the
Database. I am using Code Charge Studio Beta 5 ASP 3.0 With Templates.

Thanks
Harry Wheat

CodeCharge Support
Posted: 05/29/2002, 8:33 PM

Let's say that you add 2 new fields to the employees table in the sample
Intranet database:
last_login_ip
last_login_date

You can then use at least couple methods to populate those fields when a
user logs in:

1. Modify Common.asp
Find the function CCLoginUser, then modify:
-----------------------
If Result Then
Session("UserID") = RecordSet("emp_id")
Session("UserLogin") = Login
Session("GroupID") = RecordSet("group_id")
End If
-----------------------
to
-----------------------
If Result Then
Session("UserID") = RecordSet("emp_id")
Session("UserLogin") = Login
Session("GroupID") = RecordSet("group_id")
Connection.Execute("UPDATE employees SET last_login_date=#" & Now() &
"#, last_login_ip=" & CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")
& " WHERE emp_id=" & CCToSQL(CCGetUserID,"Integer"))
End If
-----------------------

2. Modify Login page by adding Custom Code to the "On Click" event of the
login button.
(this should be 2nd action, as CCS already creates "Login" action in "On
Click" event)
In your new action/event, place the following code:
-----------------------
Dim Connection
If Login_DoLogin_OnClick = True Then
Set Connection = New clsDBIntranetDB
Connection.Open
Connection.Execute("UPDATE employees SET last_login_date=#" & Now() &
"#, last_login_ip=" & CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")
& " WHERE emp_id=" & CCToSQL(CCGetUserID,"Integer"))
Connection.Close
Set Connection = Nothing
End If

-----------------------

Regards,

Konrad



"Harry Wheat" <sales@ifixpcs.com> wrote in message
news:ad3nro$gdu$1@news.codecharge.com...
> Can someone point me in the right direction to track a users IP Address
> Whenever a user Logs in. I would like to store it in the users Table in
the
> Database. I am using Code Charge Studio Beta 5 ASP 3.0 With Templates.
>
> Thanks
> Harry Wheat
>
>

Jeff Turkington
Posted: 05/29/2002, 11:49 PM

This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C2076B.7702EA10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

For added functionality, you may want to add a reverse DNS lookup =
component to log the symbolic name as well as an IP address.

Get the DLL and source code at =
http://www.programmersresource.com/articles/dnslookup.asp
CCS Code to insert in logon events (part of header of logon page in my =
example) below.

-Jeff

<%
Function Login_Header_IP_BeforeShow() 'Login_Header_IP_BeforeShow =
@2-7E64BB49

'Custom Code @3-73254650
' -------------------------
' Write your own code here.
' -------------------------

Dim DNSObj
dim rem_ip
dim rem_name

' get IP
rem_ip =3D request.ServerVariables("REMOTE_ADDR")

' resolve to name

On Error Resume Next
Set DNSObj =3D Server.CreateObject("qdns.DNSLookup")
If Err.Number =3D -2147221005 Then
rem_name =3D "qdns.dll not registered"
Else
If Not DNSObj.IsDnsResponsive() then
rem_name =3D "DNS error"
Else
If Not IsEmpty(rem_ip) And Len(rem_ip) > 0 Then
rem_name =3D DNSObj.ReverseLookup(rem_ip)
end if
End if
End if

' cleanup
Set DNSObj =3D Nothing

Login_Header.IP.value =3D rem_ip & " [" & rem_name & "]"

'End Custom Code

End Function 'Close Login_Header_IP_BeforeShow @2-54C34B28
%>




"CodeCharge Support" <support@codecharge.com> wrote in message =
news:ad46j2$b5j$1@news.codecharge.com...
> Let's say that you add 2 new fields to the employees table in the =
sample
> Intranet database:
> last_login_ip
> last_login_date
>=20
> You can then use at least couple methods to populate those fields when =
a
> user logs in:
>=20
> 1. Modify Common.asp
> Find the function CCLoginUser, then modify:
> -----------------------
> If Result Then
> Session("UserID") =3D RecordSet("emp_id")
> Session("UserLogin") =3D Login
> Session("GroupID") =3D RecordSet("group_id")
> End If
> -----------------------
> to
> -----------------------
> If Result Then
> Session("UserID") =3D RecordSet("emp_id")
> Session("UserLogin") =3D Login
> Session("GroupID") =3D RecordSet("group_id")
> Connection.Execute("UPDATE employees SET last_login_date=3D#" & =
Now() &
> "#, last_login_ip=3D" & =
CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")
> & " WHERE emp_id=3D" & CCToSQL(CCGetUserID,"Integer"))
> End If
> -----------------------
>=20
> 2. Modify Login page by adding Custom Code to the "On Click" event of =
the
> login button.
> (this should be 2nd action, as CCS already creates "Login" action in =
"On
> Click" event)
> In your new action/event, place the following code:
> -----------------------
> Dim Connection
> If Login_DoLogin_OnClick =3D True Then
> Set Connection =3D New clsDBIntranetDB
> Connection.Open
> Connection.Execute("UPDATE employees SET last_login_date=3D#" & =
Now() &
> "#, last_login_ip=3D" & =
CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")
> & " WHERE emp_id=3D" & CCToSQL(CCGetUserID,"Integer"))
> Connection.Close
> Set Connection =3D Nothing
> End If
>=20
> -----------------------
>=20
> Regards,
>=20
> Konrad
>=20
>=20
>=20
> "Harry Wheat" <sales@ifixpcs.com> wrote in message
>news:ad3nro$gdu$1@news.codecharge.com...
> > Can someone point me in the right direction to track a users IP =
Address
> > Whenever a user Logs in. I would like to store it in the users Table =
in
> the
> > Database. I am using Code Charge Studio Beta 5 ASP 3.0 With =
Templates.
> >
> > Thanks
> > Harry Wheat
> >
> >
>=20
>=20

------=_NextPart_000_000E_01C2076B.7702EA10
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>For added functionality, you may want =
to add a=20
reverse DNS lookup component to log the symbolic name as well as an IP=20
address.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Get the DLL and source code =
at </FONT><A=20
href=3D"http://www.programmersresource.com/articles/dnslookup.asp"><FONT =

face=3DArial=20
size=3D2>http://www.programmersresource.com/articles/dnslookup.asp</FONT>=
</A></DIV>
<DIV><FONT face=3DArial size=3D2>CCS Code to insert in logon events =
(part of header=20
of logon page in my example) below.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-Jeff</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1><%<BR>Function=20
Login_Header_IP_BeforeShow() 'Login_Header_IP_BeforeShow=20
@2-7E64BB49</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>'Custom Code @3-73254650<BR>'=20
-------------------------<BR>' Write your own code here.<BR>'=20
-------------------------</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>Dim DNSObj<BR>dim rem_ip<BR>dim =

rem_name</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>' get IP<BR>rem_ip =3D=20
request.ServerVariables("REMOTE_ADDR")</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>' resolve to name</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>On Error Resume Next<BR>Set =
DNSObj =3D=20
Server.CreateObject("qdns.DNSLookup")<BR>If Err.Number =3D -2147221005=20
Then<BR> rem_name =3D "qdns.dll not registered"<BR>Else<BR> If =
Not=20
DNSObj.IsDnsResponsive() then<BR>  rem_name =3D "DNS=20
error"<BR> Else<BR>  If Not IsEmpty(rem_ip) And =
Len(rem_ip) >=20
0 Then<BR>   rem_name =3D=20
DNSObj.ReverseLookup(rem_ip)<BR>  end if<BR> End =
if<BR>End=20
if</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>' cleanup<BR>Set DNSObj =3D=20
Nothing</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>Login_Header.IP.value =3D =
rem_ip & " ["=20
& rem_name & "]"</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>'End Custom Code</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D1></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D1>End Function 'Close=20
Login_Header_IP_BeforeShow @2-54C34B28<BR>%><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"CodeCharge Support" <</FONT><A=20
href=3D"mailto:support@codecharge.com"><FONT face=3DArial=20
size=3D2>support@codecharge.com</FONT></A><FONT face=3DArial =
size=3D2>> wrote in=20
message </FONT><A href=3D"news:ad46j2$b5j$1@news.codecharge.com"><FONT =
face=3DArial=20
size=3D2>news:ad46j2$b5j$1@news.codecharge.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> Let's say that =
you add 2 new=20
fields to the employees table in the sample<BR>> Intranet =
database:<BR>>=20
    last_login_ip<BR>>    =20
last_login_date<BR>> <BR>> You can then use at least couple =
methods to=20
populate those fields when a<BR>> user logs in:<BR>> <BR>> 1. =
Modify=20
Common.asp<BR>> Find the function CCLoginUser, then modify:<BR>>=20
-----------------------<BR>>     If Result =
Then<BR>>=20
        Session("UserID") =3D=20
RecordSet("emp_id")<BR>>        =20
Session("UserLogin") =3D Login<BR>> =
       =20
Session("GroupID") =3D RecordSet("group_id")<BR>>     =
End=20
If<BR>> -----------------------<BR>> to<BR>>=20
-----------------------<BR>>     If Result =
Then<BR>>=20
        Session("UserID") =3D=20
RecordSet("emp_id")<BR>>        =20
Session("UserLogin") =3D Login<BR>> =
       =20
Session("GroupID") =3D RecordSet("group_id")<BR>>=20
       Connection.Execute("UPDATE =
employees SET=20
last_login_date=3D#" & Now() &<BR>> "#, last_login_ip=3D" =
&=20
CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")<BR>> & " =
WHERE=20
emp_id=3D" & CCToSQL(CCGetUserID,"Integer"))<BR>> =
    End=20
If<BR>> -----------------------<BR>> <BR>> 2. Modify Login page =
by=20
adding Custom Code to the "On Click" event of the<BR>> login =
button.<BR>>=20
(this should be 2nd action, as CCS already creates "Login" action in =
"On<BR>>=20
Click" event)<BR>> In your new action/event, place the following=20
code:<BR>> -----------------------<BR>> Dim Connection<BR>> If=20
Login_DoLogin_OnClick =3D True Then<BR>>     Set =
Connection =3D=20
New clsDBIntranetDB<BR>>     Connection.Open<BR>>=20
    Connection.Execute("UPDATE employees SET =
last_login_date=3D#"=20
& Now() &<BR>> "#, last_login_ip=3D" &=20
CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")<BR>> & " =
WHERE=20
emp_id=3D" & CCToSQL(CCGetUserID,"Integer"))<BR>>=20
 Connection.Close<BR>>     Set Connection =3D=20
Nothing<BR>> End If<BR>> <BR>> -----------------------<BR>> =
<BR>>=20
Regards,<BR>> <BR>> Konrad<BR>> <BR>> <BR>> <BR>> =
"Harry=20
Wheat" <</FONT><A href=3D"mailto:sales@ifixpcs.com"><FONT =
face=3DArial=20
size=3D2>sales@ifixpcs.com</FONT></A><FONT face=3DArial size=3D2>> =
wrote in=20
message<BR>> </FONT><A =
href=3D"news:ad3nro$gdu$1@news.codecharge.com"><FONT=20
face=3DArial =
size=3D2>news:ad3nro$gdu$1@news.codecharge.com</FONT></A><FONT=20
face=3DArial size=3D2>...<BR>> > Can someone point me in the right =
direction=20
to track a users IP Address<BR>> > Whenever a user Logs in. I =
would like=20
to store it in the users Table in<BR>> the<BR>> > Database. I =
am using=20
Code Charge Studio Beta 5  ASP 3.0 With Templates.<BR>> =
><BR>>=20
> Thanks<BR>> > Harry Wheat<BR>> ><BR>> ><BR>> =
<BR>>=20
</FONT></BODY></HTML>

------=_NextPart_000_000E_01C2076B.7702EA10--
Eddy - IntraManga
Posted: 05/21/2003, 3:42 PM

Anybody has this for PHP & MySQL :-)
Thanks,
Ed,




"CodeCharge Support" <support@codecharge.com> wrote in message
news:ad46j2$b5j$1@news.codecharge.com...
> Let's say that you add 2 new fields to the employees table in the sample
> Intranet database:
> last_login_ip
> last_login_date
>
> You can then use at least couple methods to populate those fields when a
> user logs in:
>
> 1. Modify Common.asp
> Find the function CCLoginUser, then modify:
> -----------------------
> If Result Then
> Session("UserID") = RecordSet("emp_id")
> Session("UserLogin") = Login
> Session("GroupID") = RecordSet("group_id")
> End If
> -----------------------
> to
> -----------------------
> If Result Then
> Session("UserID") = RecordSet("emp_id")
> Session("UserLogin") = Login
> Session("GroupID") = RecordSet("group_id")
> Connection.Execute("UPDATE employees SET last_login_date=#" & Now()
&
> "#, last_login_ip=" &
CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")
> & " WHERE emp_id=" & CCToSQL(CCGetUserID,"Integer"))
> End If
> -----------------------
>
> 2. Modify Login page by adding Custom Code to the "On Click" event of the
> login button.
> (this should be 2nd action, as CCS already creates "Login" action in "On
> Click" event)
> In your new action/event, place the following code:
> -----------------------
> Dim Connection
> If Login_DoLogin_OnClick = True Then
> Set Connection = New clsDBIntranetDB
> Connection.Open
> Connection.Execute("UPDATE employees SET last_login_date=#" & Now() &
> "#, last_login_ip=" &
CCToSQL(Request.ServerVariables("REMOTE_ADDR"),"Text")
> & " WHERE emp_id=" & CCToSQL(CCGetUserID,"Integer"))
> Connection.Close
> Set Connection = Nothing
> End If
>
> -----------------------
>
> Regards,
>
> Konrad
>
>
>
> "Harry Wheat" <sales@ifixpcs.com> wrote in message
>news:ad3nro$gdu$1@news.codecharge.com...
> > Can someone point me in the right direction to track a users IP Address
> > Whenever a user Logs in. I would like to store it in the users Table in
> the
> > Database. I am using Code Charge Studio Beta 5 ASP 3.0 With Templates.
> >
> > Thanks
> > Harry Wheat
> >
> >
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.