Welcome Guest, Not a member yet? Register   Sign In
How to deactivate link
#1

[eluser]ashwini[/eluser]
Hello ,

i am newbie in codeigniter and i have developed code which will send email along with link for downloading the attachments to client now i want to deactivate those link after 3 days after sending the email. so how could i do it? please help me and thanks in advance. i need it urgent!
#2

[eluser]takasia[/eluser]
Add unix timestamp of the day and hour you need to deactivate the link to the link URL (something/somethinelse/thetimestamp)

When user access the link, check if the timestamp in the URL is after "today" - you can get the "now" timestamp with now() and it should be smaller then the URL timestamp, that should do... I think :-)
#3

[eluser]ashwini[/eluser]
thx Smile
#4

[eluser]Atharva[/eluser]
[quote author="takasia" date="1292323842"]Add unix timestamp of the day and hour you need to deactivate the link to the link URL (something/somethinelse/thetimestamp)

When user access the link, check if the timestamp in the URL is after "today" - you can get the "now" timestamp with now() and it should be smaller then the URL timestamp, that should do... I think :-)[/quote]

This is not a full-proof solution. What if I manually change the timestamp in the url in the past, so that I can access the content?

What I will suggest is that you store a field in the database which tells until when this content is accessible (a timestamp may be). When user clicks on the link, you can compare that field in db against
Code:
now()
to determine user can still access the content or not.
#5

[eluser]takasia[/eluser]
Not fool-proof but light and working :-P

I use the timestamp hashed and stored in the DB as a unique key, with a flag checking if it was used or not, if the flag says "used" - the key will couse error.
Not deleting the key every time it was used is usefull if you want to check if it's unique but takes place.

If you need really a lots of URLs with timeout, adn don't want to put all those data to the database, and you are worried that some smart users might do like Atharva says, you can always try to hide the unix timestamp adding some numbers or letters, so it wouldn't look like a timestamp to an avarage person.

You can also add the now() timestamp of the time that URL was sent to the user combined with the timeout timestamp.

Anyway, unix timestamp doesn't look like a timestamp to an avarage user so I'm not sure if there is so much to worry about.

If you need REALLY secure way to do this, you might try one-time-password.




Theme © iAndrew 2016 - Forum software by © MyBB