Solved

How to create a link that expires

Posted on 2008-06-14
4
428 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
array220 challenge 8 56
VB6 Compile Compatibility Issue 4 90
how to update exe applicatio from internet ? 6 68
Java Loop 6 49
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 …
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 …

895 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

15 Experts available now in Live!

Get 1:1 Help Now