Solved

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

Posted on 2003-11-05
7
155 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now