How to tell if a file was viewed

0

I'm doing a system in php where the counter sends a file to the client (using database). My question is as follows, how to do when the client accesses this file, be sent to the database the time and date it was opened.

I was able to resolve it.

I have done the following, as soon as the user accesses the document (via querystring ), I do an update in a field that I have in the database with the name " / em> "by putting the current date through the sql function" CURRENT_TIMESTAMP "and enter 1 in the file_id field. So in the page where the saved documents are listed, I make a condition: If the file is equal to 0 , then I highlight the file title so that the user knows that file has not yet been viewed.

    
asked by anonymous 02.06.2014 / 21:48

1 answer

3

Controlling the exact moment the client opens a PDF I find it impossible or at least as intrusive that it should not even be considered.

What you could do would be to intermediate the file and its opening / download.

Assuming you maintain a complete document entry and exit control in a database including the path of the physical file, with the old querystrings technique (files.php ? id = 123) you can send an email to the client with a link containing the ID of that file in your controls which, when accessed for download or viewing in the browser, you would use to update a field that serves control flag.

On your dashboard , where you list the documents sent and received, you condition the flag value. If zero (DEFAULT) the document was not read / received and compared to the date you have automatic feedback that the customer needs a personal contact, by phone or email.

If it is 1 (one) or another positive value, the document has been received, and also based on the date you have to analyze the average time for a possible response.

However, again, this does not guarantee that the customer has read the content, but at least you know there has been some "interaction" between you.

    
02.06.2014 / 22:02