Solved

How to create a link that expires

Posted on 2008-06-14
4
429 Views
Last Modified: 2013-11-13
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
Comment
Question by:cathyc77
  • 2
4 Comments
 
LVL 3

Expert Comment

by:darkmooink
ID: 21787140
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
 
LVL 19

Expert Comment

by:bevhost
ID: 21787154
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
 
LVL 19

Accepted Solution

by:
bevhost earned 500 total points
ID: 21787161
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
 

Author Comment

by:cathyc77
ID: 21789263
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question