Jason Bragg
|
| Posted: 07/26/2005, 12:09 PM |
|
Hi,
I'm kind of new to the CodeCharge software and I need to build a website for re-certification. My website contains a lot of information and I already have it set up with ASP and an Access database so that each user has a unique username and password to log in and out of the site. The problem is that I need to have a log of the time that each user spends on the site because of re-certification requirements. How can I use CCS to log the time each user spends on the website? The users are allowed to break their studies up into several sections so there may be multiple logins so just logging the in and out time won't get it, unless I can log every in and out time individually... Can anyone help me with this please?
Thanks,
Jason
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/26/2005, 6:15 PM |
|
Quote :How can I use CCS to log the time each user spends on the websit
Probably not different than if you'd use just ASP without using CCS, but I don't think that such logging is possible at all with ASP. This topic was discussed previously here on the forums and I think that there was just no reliable way to determine when Web users have their Web browser active or opened. But if instead of measuring the time spent on the site you want to measure the time that users are logged in then you can run insert queries when users login/logout and update your log table. There are code examples on updating the last login date in our ASP forums, which may be a good start in your case.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Jason Bragg
|
| Posted: 07/27/2005, 5:28 AM |
|
Peter,
I used this topic to get the log going (http://forums.yessoftware.com/posts.php?post_id=42883&s_keyword=time+users) the problem is that it over-writes the previous login time. It would work for me if I could figure out how to get it to make a seperate entry in the database for each time the user logs in ot out. This way I would have a log of every single visit the user makes. How can I modify the database to do this?
Thanks!
Jason
|
|
|
 |
Jason Bragg
|
| Posted: 07/27/2005, 12:06 PM |
|
Ok.. I've made a little progress with this since my last post, but I'm still stumped on something.
I now have two tables in my Access Database. One is called "Users" and the other is called "Log". I have a realationship built in my database so that each user record can have a series of autonumber log records of login time and logout time.
The problem is, I can get my login and logout script to write the login and logout times when I use one table (User) but it will just keep updating the times after every login instead of inserting a new login time record. So when I tell it to INSERT the login time into the "Log" table it doesn't work?
The relationship between my "user" and "log" tables is the User_ID field and it's a one to many relationship.
Here is the code I have in my login page, can someone please help me figure what I have wrong? This is all I lack in having this project finished...
'Custom Code @8-73254650
' -------------------------
Dim Connection
Set Connection = New clsDBSubTrain
Connection.Open
If Login_DoLogin_OnClick = True And CCGetUserID<>"" Then Connection.Execute("INSERT Log SET date_login=#" & Now() & "# WHERE user_id=" & CCGetUserID)
Connection.Close
Set Connection = Nothing
' -------------------------
'End Custom Code
Thanks!
Jason
|
|
|
 |
Tuong Do
|
| Posted: 07/27/2005, 11:10 PM |
|
Hi Jason
Insert Statement does not use the SET like the Update Statement
The format should be like this
Insert IINTO LogTable (field1, field2) Values (value1, value2)
In your case
Connection.Execute("INSERT INTO Log (User_id , Date_Login ) VALUES ( " &
CCGetUserID & " , Current TimeStamp)"
Note: the syntax for Current Timestamp is depend on your data base back end
<JasonBragg@forum.codecharge (Jason Bragg)> wrote in message
news:242e68a72311cb@news.codecharge.com...
> Hi,
>
> I'm kind of new to the CodeCharge software and I need to build a website
> for
> re-certification. My website contains a lot of information and I already
> have
> it set up with ASP and an Access database so that each user has a unique
> username and password to log in and out of the site. The problem is that
> I
> need to have a log of the time that each user spends on the site because
> of
> re-certification requirements. How can I use CCS to log the time each
> user
> spends on the website? The users are allowed to break their studies up
> into
> several sections so there may be multiple logins so just logging the in
> and out
> time won't get it, unless I can log every in and out time individually...
> Can
> anyone help me with this please?
>
> Thanks,
> Jason
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Jason Bragg
|
| Posted: 07/28/2005, 5:45 AM |
|
Hi,
Thanks for the tip, but unfortunatley after trying your suggestions in several differant formats I'm still unable to get it to post the times in Log table. I can get it to post in the Users table with no problems, I just can't get it in the log table.. Any suggestions?
Thanks,
Jason
|
|
|
 |
Finian826
Posts: 29
|
| Posted: 07/28/2005, 10:27 AM |
|
What I would probabilly do is create a LogEvent function at the end of the common include page. Then in each pages page_unload event, insert the userid, time, and page they were on to the log. That way you can track the user from page to page. You could even put the LogEvent call in the page_intialize event as well and add some kind of note like $UserID loaded page $filename and for the leaving of the page $UserID exited page $filename.
Hope that helps. I have a simular function done in PHP for logging user actions to an event log with full date and time.
Terry
|
 |
 |
Tuong Do
|
| Posted: 07/28/2005, 6:18 PM |
|
Just after the line
Connection.Execute("INSERT INTO Log (User_id , Date_Login ) VALUES ( " &
CCGetUserID & " , Current TimeStamp)"
Have this code
<Code>
Dim ErrorMsg
ErrorMsg = CCProcessError(Connection)
Response.write ErrorMsg
Response.end
</code>
It will display the error message.
<JasonBragg@forum.codecharge (Jason Bragg)> wrote in message
news:242e8d35c2f19d@news.codecharge.com...
> Hi,
>
> Thanks for the tip, but unfortunatley after trying your suggestions in
> several
> differant formats I'm still unable to get it to post the times in Log
> table. I
> can get it to post in the Users table with no problems, I just can't get
> it in
> the log table.. Any suggestions?
>
> Thanks,
> Jason
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Jason Bragg
|
| Posted: 07/29/2005, 5:12 AM |
|
I finally got it working last night with this code. The reason it wasn't working is because there was on ")" missing off the end of the statment.
Thanks!
Jason
|
|
|
 |
|