Solved

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

Posted on 2003-11-05
7
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

717 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