• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get Count of no. of downloads of a file unique to each user/computer

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm stuck, help me out !!!

I have got a FILE table with: file_id BIGINT,file_name VARCHAR,file BLOB... etc

I want to count the no of downloads of each file per user/computer so that i can identify the total count of each file and also want to avoid a situation where a single user is downloading the files multiple times,

I just want to know the best way in which it can be implemented, up till now i have thought of following ways:

1) Create a table FILE_DOWNLOAD_COUNT (FILE_ID,UNIQUE_ID) 2) whenever the file is downloaded insert a new record into this table with the ID of the file downloaded and a UNIQUE value corresponding to every download request.

But , what should be used to identfy the UNIQUE_ID???

IP ADDRESS/MAC ADDRESS/A COOKIE Value

ISSUES :
IP ADDRESS : At every new connection, a new IP address is assigned (DYNAMIC IP)

MAC ADDRESS: can be changed and MAC spoofing can be used

A COOKIE Value: can be deleted.

So just help me how can i achive this with most reliable way.

FYI: I'm implementing it in JAVA (STRUTS2+Spring) + MYSQL

Thanks in advance
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't prevent this completely. All you can do is make it a bit harder. Like you said, the MAC address (which actually isn't sent) can be spoofed. The IP address can be changed, but it can also be shared (thereby blocking users incorrectly). Cookies can be modified as well.

One solution would be to use a login system, but that too doesn't prevent duplicate downloads. I could just create a new account and download with that. Limiting accounts on email addresses won't help either because I can easily create a few hundred email addresses in my own domain if I need to.
 
Ranch Hand
Posts: 34
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about using user_id as uniqueid? If one person can make mulitple user accounts in your application, then that itself is a different problem altogether.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sushant verma wrote:I... want to avoid a situation where a single user is downloading the files multiple times...



Why? What difference does it make to you if some user downloads a file twice?

And remember that you can't tell whether a user has downloaded a file. You can tell that the user asked for a file; you can tell that you sent a complete file in response; but you can't tell that the user didn't get the file because of some network or browser failure.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic