Jump to content

Recommended Posts

I have found a php script that allows a user to download a file and then prevent further downloads for a set amount of time. You can find it here http://www.web-development-blog.com/archives/limit-the-number-of-downloads-per-client/ As I am not very strong in coding, I am hoping with some assistance to modify the concept so that it will not allow a registered user to print a coupon I offer more than once. The process would work as such:

  • the user registers (I am developing in Joomla using the Community Builder login / member component)
  • the user clicks a link in the activation email
     
     
  • welcome page opens with a link to the coupon
     
  • user clicks the coupon link
     
  • the link opens a page with the coupon and a print button in the same window to get around a popup blocker
     
  • user clicks the print button and the page prints out the coupon
     
  • print button also advances the page to a thank you page
     
  • if the user clicks on the back button to access the link again the script prevents the user from opening the coupon window again with the message that there is only one coupon per user)

I am assuming that this is doable but don't mind being told otherwise. I would be very grateful if there are any coders out there that could assist. Thanks

Couldn't you simply make a new table that has these rows:

 

userID viewed

 

and then set it up so that when they view the page, it updates that table to set viewed as 1 for that user ID.

 

Set up the coupon page to first check if the user name has visited the page before, if it = 0, show the page, if 1, don't show the coupon.

 

If they have viewed the page, include a meta refresh that takes them to a new page instantly, so they can't go back to see it again

 

Know what I mean?

 

I would put an insert query on the thank you page.  This would be on a table called printed_coupons.  2 fields, coupon_id and user.

 

$sql = "INSERT INTO `printed_coupons`(`coupon_id`,`user`) VALUES ('$id','$user')";
mysql_query($sql);

 

at the top of the print page, I would put this.

<?php
$sql = "SELECT `coupon_id` FROM `printed_coupons` WHERE `coupon_id` = '$coupon_id' AND `user` = '$user'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
die('You have already printed this coupon');
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.