• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

ASP Insert record on login page


I have an application in dreamweaver that requires users to login.
Is it possible to log information on who's logged in and from what ip address?  I would like this information to be entered into a table in the database automatically when users login.

Thanks in advance.
1 Solution
Ryan ChongCommented:
>>I would like this information to be entered into a table in the database automatically when users login
Yes, it's possible, the trick is that you execute a SQL statement to "save" the info you want (IP address, date time, etc) when the user logging to your web pages.

Server side scripting is needed here, for example, to get the user's IP address in ASP, we can try use:


and that's vary if you using other Server side scripting langauges.

Hope this give you some clues on how to develop this feature.
To log  IP addresses into namesthrough software is the best way to go. Especially if your network runs dynamic IP's, which most do. But if you do have STATIC IP addresses, then you can do the same as outlined below  then track the IP address in the database. Easier to do than the NT authentication, just as long as the IP's never change. But, if they do change...then things will get all mucked up.

Let's say you have a database of all employees which gives  a unique ID for each. Using NT authentication, you can determine each visitors User Login Name:

THIS_USER = split(Request.ServerVariables("REMOTE_USER"),"\",-1,1)

bains1000Author Commented:
It was actually quite simple.

I just created an insert record on the existing login form, added a few fields and it works great.

Thanks for your help.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now