Solved

How to create a link that expires

Posted on 2008-06-14
4
431 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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 …

710 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