?
Solved

CGI Link Question

Posted on 2003-02-25
13
Medium Priority
?
192 Views
Last Modified: 2013-12-25
Hello,

Is there are way for me to have a link be invalid after a certain amount of time?  Example, if I have a download link that I have for a user, and I want that link to be valid for one hour, how do I do this?  Or can I?  Please provide an example.

Thanks,
aj85
0
Comment
Question by:aj85
[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
  • 4
  • 3
  • 3
  • +1
13 Comments
 

Expert Comment

by:amitabhrai
ID: 8018773
You can create two overlapping <DIV>. One containing the link  and other containing the exact text of the link without the link. Make the <DIV> with link visible first. Using javascript settimeout function, make this <DIV> invisible and the other <DIV> visible after desired amount of time. This should do the trick.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8018901
amitabhrai, is there any reason this trick should work?
I don't use JavaScript :-]]

aj85, depending on you web-server you can set such restrictions in .htaccess
IMHO this is overkill for such a simple task 'cause you need to edit the .htaccess file twice

Why not simply starting am at which deletes the file?
0
 

Expert Comment

by:amitabhrai
ID: 8018997
ahoffmann ,
 I probably misunderstood the original question. I was under impression that the user has the page opened for say 30 minutes and after that the link should be disabled. But now I guess the requirement is to not allow the user to download after specific time.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Expert Comment

by:amitabhrai
ID: 8019010
aj85,
  It would be helpful if you can specify what exactly you mean by "link be invalid".
Do uou  want the user to see the link?
What should happen if he clicks on it?
0
 

Author Comment

by:aj85
ID: 8021055

Hello,

Thanks for both of your replies.  What I mean by "link be invalid" is to have the link not be accessible by the user after 30 minutes or an hour or what ever time is set.  You wrote "But now I guess the requirement is to not allow the user to download after specific time."  This is correct.  That is what I want to do with the script.  Let me know if you have anymore questions.  Please provide example.

Thanks,
aj85
0
 

Author Comment

by:aj85
ID: 8021088
Follow up, to add a little more clearity.  What I want to happen is that when a user enters their required information, and clicks "submit" for example.  Then are taken to the download page.  I want that link to the download page to valid for only an hour.  I hope this helps.

Thanks again,
aj85
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 200 total points
ID: 8023648
the link (URL) given to the user shuld be a link to a cgi (program, script, whatever).
This CGI checks the time when called the first time, provides the link for download to the user (using redirect or whatever), and then simply executes something like:
   echo "rm /path/to/file"|at now + 1 hour
0
 

Author Comment

by:aj85
ID: 8025069
Ok, I see.  I will try this and get back with you shortly.  Thanks for the quick reply.

aj85
0
 

Expert Comment

by:amitabhrai
ID: 8025599
You can also try this:

1. when form is submitted set a cookie valid for 1 hour.
2. on download link, check for the cookie. If cookie not
  found then send error message back to user.
3. If cookie found then redirect it to download page.

I personnaly don't like to use "rm" command in CGI. It also makes the application system dependent.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8027613
what or who restricts me to accept the cookie and redefine it as I like? :-]]
Cookie, same as JavaScript, totally unreliable and unsave attempt.
0
 
LVL 2

Assisted Solution

by:martianism
martianism earned 200 total points
ID: 8185849
I would say that the cookie option seems the best way to track a user around your site.  Cookies are not inherintly insecure and are not inherintly bad,  it is just in the early days of ebiz they were over used to hold stupid data like credit card numbers and so were easily stolen.

As long as you explain to the user what the cookie is for before setting it (maybe do this client side with a pop-up yes / no type box on first use), I cannot see any great issue.

Other then that you only reliale way is to user a username password based system to track users movements on the site, are users already required to register?  If so then you could use this route instead.

Unless anyone has a good way of handleing it?

--
Martianism
0

Featured Post

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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 …
Suggested Courses

770 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