benyates1 Posted November 7, 2011 Share Posted November 7, 2011 Hi, I have a web site that sells both video and images. The full versions are located securely behind a paywall, however in a bid to get visitors to purchase them and to promote the members offering I have trailer videos of 30 seconds to one minute and four free images per imageset. I want to be able to restrict the number of images a visitor can view for free to 12 and the number of videos a visitor can play to 5. With a little graphic/overlay notifying the user when they have exceeded their free play/preview limit. I have been advised that a tracking cookie and php if statement would be the way to go to achieve this. I have got a cookie that is successfully logging views that is written to on a free preview link as an onclick function. I have tried writing some php if code that will have the normal thumbnail or video divs display as usual if the views recorded in the cookie are below 12 or five, respectively, and have a not allowed, please subscribe div that would show over the thumbnails or video divs should the number of views exceed the threshold. My PHP code does not seem to be working at all, I have ran it through an online syntax checker - corrected the mistakes and now it's supposed to be working but opts to display nothing instead of either if argument. Videos then become a whole other problem because at the moment I have no other way to track the view/visit other than to count the loading of the video summary page with the free player as the preview, whether or not the clip is played - ideally I would like the view to be counted when the video begins to play. But I have no idea how to write to the cookie from Flash (is that even possible?) Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/250603-restricting-content-based-on-number-of-views/ Share on other sites More sharing options...
Adam Posted November 7, 2011 Share Posted November 7, 2011 Don't rely on cookies to protect your files. Users could easily delete them or browse in an incognito type of mode to get around your security. Instead you should force all video/image requests through a separate script. In that you can perform all your user verification and tracking, and then send the response back as the requested content. Quote Link to comment https://forums.phpfreaks.com/topic/250603-restricting-content-based-on-number-of-views/#findComment-1285845 Share on other sites More sharing options...
benyates1 Posted November 7, 2011 Author Share Posted November 7, 2011 Thanks, I'm aware that cookies can be bypassed with relative ease however I'm not relying on the cookie method to protect content but more as a way to persuade subscription by being more of an irritant than anything else. Quote Link to comment https://forums.phpfreaks.com/topic/250603-restricting-content-based-on-number-of-views/#findComment-1285880 Share on other sites More sharing options...
ManiacDan Posted November 7, 2011 Share Posted November 7, 2011 more of an irritant than anything elseMuch like with modern DRM, you're going to do nothing but annoy your paying customers and the pirates will gleefully bypass your irritant. Either do security properly or don't do it at all. "I want my site to be annoying to use" is never a good business model. Quote Link to comment https://forums.phpfreaks.com/topic/250603-restricting-content-based-on-number-of-views/#findComment-1285883 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.