Solved

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

Posted on 2003-11-05
7
158 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

20 Experts available now in Live!

Get 1:1 Help Now