Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 442
  • Last Modified:

How to create a link that expires

I am wondering if anyone knows how to build (or if there is some software out there) that will make a link expire after the user downloads it once.
Here's what I'm trying to do:
Send all my customers and email with a 50% off coupon. Once they have downloaded and printed  it once, the link expires (perhaps based on their IP address?) Basically I am trying to prevent them from printing and downloading a coupon for all of their friends too!
Your comments and suggestions are appreciated.

Thanks!

0
cathyc77
Asked:
cathyc77
  • 2
1 Solution
 
darkmooinkCommented:
if you send them to a web page with a unique variable passing into it (each email having its own variable) if the variable has already been claimed then the coupon doesn't get shown.

pageurl = http://yourdomain.com/coupon.asp?id=1q2w3e4r5t6y7u8i9o0p
if not id=a claimed id then
show coupon
else
write "coupon has already been claimed"
end if
0
 
bevhostCommented:
That still won't stop them from printing it out twice.
You could also have two customers behind the same IP address.
You could ask them to enter their email address before getting the coupon and using that as the ID.
0
 
bevhostCommented:
See attached code snippet using PHPLIB.
This one is for software download in zip files, but you could change the content type to image or html.
<?php
include('phplib/prepend.php');
 
page_open(array("sess"=>"example_Session","silent"=>"silent"));
 
if (($SalesID) and ($Password)) {
        $db = new DB_example;
        $db->query("select id, SessionID, FileName from Downloads where SalesID='".$SalesID."' and Password='".$Password."'");
        if ($db->next_record()) {
                if ($db->f("SessionID")=="") {
                        header("Content-type: application/zip");
                        header("Content-Disposition: attachment; filename=".$db->f("FileName"));
                        readfile($db->f("FileName"));
                        $db->query("update Downloads set SessionID='".$sess->id."', TimeStamp=NOW() where id='".$db->f("id")."'");
                } else echo "That Password/SalesID combination has already been used to download and cannot be used again.<br>\n";
        } else echo "Invalid Password/SalesID combination.<br>\n";
} else echo "Incorrect Usage - contact your sales representative!.<br>\n";
 
page_close();
?>

Open in new window

0
 
cathyc77Author Commented:
hi All
Thanks for the possible solutions. I am just doing father's day stuff today - so I will take a look on Monday. I already know I have some questions - so please keep a look out tomorrow (if you can)
Thanks so much
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now