Solved

Keep Track of how many times some logs into my asset database?

Posted on 2003-11-05
7
160 Views
Last Modified: 2013-12-24
Hi, I have an asset database that keeps track of all our Assets for our department.  I would like to add a something to keep track of how many times my users log into my database and will increment every time they log in.

Every time we take new hardware to a department, we keep track of those assets via web.  Everything works fine but would like to post how many times they have logged in and possibly show who logged in last.  I am just trying to make it a little more fun so our team remembers to use it more.

I am currently using an MS ACCESS database, anyone have any ideas?
0
Comment
Question by:fixx17
7 Comments
 
LVL 6

Expert Comment

by:PE_CF_DEV
ID: 9689361
In the users table just add a column called log on, each time someone logs into the system, add one to it.
0
 
LVL 1

Author Comment

by:fixx17
ID: 9689794
can you give me an example,

What if I added a coulumn called UserCount into the database.  What would be the SQL to increment that number?

Now keep in mind that I work for the University of Michingan on the Hospital side.  I connect to a database called Cert7 and that uses LDAP, but I don't have access to that database to add the column, because it has over 36,000 employees user names and passwords.  I don't have access.  

But the other developers gave me the path to authenticate to it, so I can at least pull up the First Name, Surname.  Once they are logged in, how what kind of CFC do I write to check in that users and increment it once.

I figure I can take his FirstName and Surname in a hidden field (If possible) and have some scirpt run to check if his name is in a database (that I have access to) and if it comes back TRUE, increment the column called UserCount.

Is this possible?  I will bump up the points if someone can give me an example of some script.

0
 
LVL 11

Accepted Solution

by:
hart earned 200 total points
ID: 9691973
ok in ur side add a table called userdetails..
in that keep a unique field

userid - number
firstname - text
surname - text
usercount - number


now u say that u can get the first name and surname from the other database,
could u get the unique identifier of each user from their database too.

s u will have three details from their side userid,firstname and surname
now as soon as u get this..


run this query


<cfquery name="qry_checkuser" datasource="ur datasource name">
   select userid from userdetails where userid = #the userid that u have got from their database#
</cfquery>


<cfif qry_checkuser.recordcount eq 0>
   <cfquery name="ins_user" datasource="ur datasource name">
         insert into userdetails (userid,firstname,surname,usercount)
                                 values (#userid#,'#firstname#','#surname#',1)
      </cfquery>
<cfelse>
     <cfquery name="upd_user" datasource="ur datasource name">
         update  userdetails set usercount = usercount + 1
         where userid = #userid#
     </cfquery>
</cfif>


Regards
Hart
0
 
LVL 1

Author Comment

by:fixx17
ID: 9697686
Sorry, did not have time today, I was doing something else.  I will try tomorrow and get back to you.

0
 

Assisted Solution

by:trr1jdg
trr1jdg earned 200 total points
ID: 9853328
If you don't have access to modify a table, the only thing you can do is add a new table as hart stated above.  

Another method of doing this would be to insert a record into this table every time that a user logs in (along with a time) and then when you want to count how many times they have logged in you can use a sql count() statement to get the number...with this option you would have the option of saying 23 users have logged in 10,000 times this month. Or the user that logs in can see that he has logged in 15 times this week.  

I have encountered this situation before and in my case I decided to insert a record every time.  I decided this because it was imperative that I didn't lose any data on when the user did what he or she did.  But it was a slightly different case than the "fun fix" that you are describing.  I can give you some code or diagrams if you are interested.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question