Solved

How to create a link that expires

Posted on 2008-06-14
4
425 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Specific format 21 140
wordappend challenge 8 84
groovy example issue 10 65
Windows Service to Receive TCP Packets 4 33
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now