473,395 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Track whos accessing reports

111 100+
I have an internal web page for my company that has a list of hyperlinks so that users can access different reports (.xls files on the server). What i would like to do is to keep track of who is accessing each report in a database.

I attempted to use the OnClick property of the <a href> tag to send a SQL query to insert the data into the table, however that wasnt working. Upon further investigation on the web - it appears the OnClick property only handles javascript or vbscripts.

Does anyone have any ideas on how i can go about accomplishing this?

Thank you in advance.
Nov 25 '08 #1
7 1121
Neekos
111 100+
I forgot to add - the users are hitting a login screen before they get to the reports page, so im gathering their login data through that.

also - the table im trying to populate has the following metadata:

user - varchar(6)
date - timestamp
report_name - varchar(150)
Nov 25 '08 #2
pbmods
5,821 Expert 4TB
Heya, Neekos.

The easiest way to do this is to review your server access log.

A slightly more sophisticated method would be to provide access to these files via a PHP script:

Expand|Select|Wrap|Line Numbers
  1. /* Verify credentials. */
  2. if( empty($_SESSION['isLoggedIn']) )
  3. {
  4.   goToLoginScreen();
  5. }
  6.  
  7. /* Verify that file exists. */
  8. if( $filePath = getFilePathFromFileID($_GET['fileid']) )
  9. {
  10.   /* Log file access. */
  11.   recordFileAccessToLogFile($_GET['fileid'], $_SESSION['userid']);
  12.  
  13.   /* Send the file to the browser. */
  14.   header('Content-Type: application/force-download');
  15.   header('Content-Disposition: attachment');
  16.   header('Content-Length: ' . filesize($filePath));
  17.  
  18.   readfile($filePath);
  19. }
  20.  
Nov 25 '08 #3
Neekos
111 100+
ok - i understand the verify the login creds and to verify the file exists...thats all in place.

I'm not understanding this line tho:

Expand|Select|Wrap|Line Numbers
  1. recordFileAccessToLogFile($_GET['fileid'], $_SESSION['userid']);
what is that doing? and where is the recordFileAccessToLogFile function?

thanks for your reply!
Nov 25 '08 #4
Neekos
111 100+
also - these are hyperlinks they are clicking to view the files. Here is a an example of part of the table:

Expand|Select|Wrap|Line Numbers
  1. <TD><a href="Static_Linked_Reports/WCT_HG.xls">WCT Hotel Guides CRD</a></TD>
  2. <TD><?php
  3. $filename = "Static_Linked_Reports/WCT_HG.xls";
  4. echo date ("F d Y H:i", filemtime($filename))
  5. ?></TD>
Nov 25 '08 #5
pbmods
5,821 Expert 4TB
I used "recordFileAccessToLogFile" as a dummy function name. This would be the function where you record that the User accessed the file.

Going back to your OP, I see that you are recording the access log info in a database, so a better name for the function might be recordFileAccessToDatabase() (or you can just inline the SQL query and not bother with outsourcing it to an external function).
Nov 25 '08 #6
Neekos
111 100+
The part im not understanding is how to call the function (or the SQL update query) when the hyperlink is clicked.
Dec 2 '08 #7
Markus
6,050 Expert 4TB
@Neekos
The link would point to a page, say, 'process.php'. Then in process.php, you would do what PBMods said above.
Dec 2 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: benyang22 | last post by:
I have been a long time Matlab user. I Python, I miss Matlab's whos command. So I have written a little utility whos.py, which can be downloaded here:...
0
by: dotnetprogrammer | last post by:
I have installed a custom VB.Net app on a client's PC. It works fine except for Crystal Reports (surprise). Crystal refuses to connect to the database despite the fact that I specifically point it to...
0
by: dhnriverside | last post by:
Hi all I want to create a webpage that updates say, every 5 minutes (easy), that shows me whos logged on to my network. Any ideas? I've seen this done on an antivirus program, where it pops...
6
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as...
0
by: amitda | last post by:
I am getting following error while trying to access sql server report manager: I saw an msdn article about similar issue, made sure c:\temp exists and pointed TMP and TEMP sys env var to that....
8
by: colmkav | last post by:
Hi, could someone tell me how I can check whether a database is open by name eg something like db("mydbname")
0
by: sunil sharma | last post by:
Hi all, I have an ADP (2003 format) that has forms and reports. Report source was set in class module and the class module is totally handling the report. For some technical reasons, i have to...
0
by: ateale | last post by:
Hi guys! I am having a bit of difficulty trying to get to a 'timecode' track in a QuickTime file using the QTKit framework in Mac OSX 10.5 I am using XCode 3. I have a QTMovie object (set as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.