Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging a user

Status
Not open for further replies.

Haraldo

Programmer
Jun 9, 2003
41
GB
I am building a content management system using dreamweaver so my knowledge of asp is minimal but i have experience in programming such as c++.

My query is how to add session variables and the date to a database. So i can log the user when they sign in. I would use a greeting page when the log in which they press enter on. This enter button would be in a form and would log the user.

Could anyone point me in the right direction, Thank you for your time,
 
Don't worry fixed the problem with hidden field in the form then creating an insert database server behaviour.
 
Im assuming you already know how to create the actual login script for the user.. if not I can show you an example of this but i will concentrate on logging the login to the db for now... I am also assuming you already have a connection to the database set up, with connection being named 'objCon'.

So imagine that the user has been verified and logged in:

Your code to add a log to the database would be something like this:

strSQL = "INSERT INTO Logs(Date, Time, UserName, UserID) VALUES("
strSQL = strSQL & "'" & Date() & "',"
strSQL = strSQL & "'" & Time() & "',"
strSQL = strSQL & "'" & Session("username") & "',"
strSQL = strSQL & "'" & Session("userid") & "')"

objCon.Execute strSQL

Simple as that!

I hope that is what you needed to know, if not please let me know!



Nick (Software Developer)


nick@retrographics.fsnet.co.uk
nick.price@myenable.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top