Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-18-2007, 08:36 PM   #1
Young
Bland for life
 
Industry Role:
Join Date: Nov 2004
Posts: 10,468
PHP people...quick question

What's the best way to approach easily creating expiring links?

Links that expire after the first click? Or after a certain amount of clicks or time. Whichever is easier.
__________________
★★★
Young is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 09:08 PM   #2
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
And by expire you mean?
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 09:14 PM   #3
Young
Bland for life
 
Industry Role:
Join Date: Nov 2004
Posts: 10,468
1 click. link gone.
__________________
★★★
Young is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 09:14 PM   #4
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Never tried it but maybe a CSS thing:

a:visited { display: none; }

?
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 09:17 PM   #5
Young
Bland for life
 
Industry Role:
Join Date: Nov 2004
Posts: 10,468
Quote:
Originally Posted by psili View Post
Never tried it but maybe a CSS thing:

a:visited { display: none; }

?
Thats a cosmetic way of doing it (which I had never thought of) but I'm going to be sending this links via email.

What I want to do is after a potential client visits a page. I don't want them to be able to go to that page again. Unless I send them a fresh link.
__________________
★★★
Young is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 09:23 PM   #6
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Quote:
Originally Posted by Young View Post
Thats a cosmetic way of doing it (which I had never thought of) but I'm going to be sending this links via email.

What I want to do is after a potential client visits a page. I don't want them to be able to go to that page again. Unless I send them a fresh link.
I suck at this, but:
<?php
// on page being hit
if(isset($_COOKIE["alreadyhere"]))
{
header("Location: /another/uri");
}
else
{
setcookie( "alreadyhere", 1, (time()*100000), $_SERVER["REQUEST_URI"] );
}
?>

-- or some shit. basically, store something of the URI they already visited, test and send somewhere else.

someone else has a more elegant solution that's bug-checked, so I'll just bump this for ya
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 09:24 PM   #7
Young
Bland for life
 
Industry Role:
Join Date: Nov 2004
Posts: 10,468
Quote:
Originally Posted by psili View Post
I suck at this, but:
<?php
// on page being hit
if(isset($_COOKIE["alreadyhere"]))
{
header("Location: /another/uri");
}
else
{
setcookie( "alreadyhere", 1, (time()*100000), $_SERVER["REQUEST_URI"] );
}
?>

-- or some shit. basically, store something of the URI they already visited, test and send somewhere else.

someone else has a more elegant solution that's bug-checked, so I'll just bump this for ya
thanks i can play around with that.

ill take anything else anyone can throw at me though.
__________________
★★★
Young is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 09:58 PM   #8
FightThisPatent
Confirmed User
 
Join Date: Aug 2003
Location: Austin, TX
Posts: 4,090
Quote:
Originally Posted by Young View Post
What's the best way to approach easily creating expiring links?

Links that expire after the first click? Or after a certain amount of clicks or time. Whichever is easier.

if you want to do it with a database, rather than a cookie... in the email, you have an ID like ID=12 that is unique to the person.. or the ID is for a particular URL and after so many incremental clicks, you do something else.

when they land on your page, you mark in the database that they visited via the unique ID (so this helps you to confirm they clicked through), and the next time they click through on the email, your database lookup will see they were already there, and then redirect to another URL or display some message.


Fight the tips & tricks!
__________________

http://www.t3report.com
(where's the traffic?) v5.0 is out! |
http://www.FightThePatent.com
| ICQ 52741957
FightThisPatent is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 10:01 PM   #9
Pipecrew
Master of Gfy.com
 
Pipecrew's Avatar
 
Industry Role:
Join Date: Feb 2002
Posts: 14,887
i am not a php pro by any means, i have my own threads on here asking for help ;) but what if you set a status for the links? on the main page it only shows "active links" and when they click, you have a variable that sets it inactive, thus it wont be shown on the main page anymore after a click. Just an idea
Pipecrew is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 10:35 PM   #10
Swish
Confirmed User
 
Swish's Avatar
 
Join Date: Mar 2006
Location: San Diego, CA
Posts: 1,421
Do this in a database. Store a unique id for each link sent (i.e. md5($email . time()); ) using the md5 hash prevents people guessing for someone else's link (by incrementing a numeric value like id=5 as suggested above).

In your db table also have a field for date_clicked which you update when the url is loaded. You could also have a campaign_id or something to track multiple links mailed in the same table, maybe the email address as well, whatever suits your needs.

Then you send a link like : http://www.someurl.com/somepage.html...23456789abcedf

When the link is loaded you check the db for that hash and whether date_clicked has been set or not. Redirect or load the one time link page based on those conditions and then update the db.
__________________


Naughty America - Director of Technology
It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!
Swish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-18-2007, 10:43 PM   #11
Young
Bland for life
 
Industry Role:
Join Date: Nov 2004
Posts: 10,468
Thanks Swish and Fight This Patent, I think I'll mesh your two ideas hash + lookup

thanks to you too pipecrew. good to see you still posting around here. hows miami treating you?
__________________
★★★
Young is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-19-2007, 12:42 AM   #12
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
Quote:
Originally Posted by Swish View Post
Do this in a database. Store a unique id for each link sent (i.e. md5($email . time()); ) using the md5 hash prevents people guessing for someone else's link (by incrementing a numeric value like id=5 as suggested above).
If you use hashes then there's a small chance that they will not be unique across two or more messages. Better to generate an array of hashes, weed out any dupes, and then allocate IDs from that.
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-19-2007, 12:48 AM   #13
dissipate
The Dirty Frenchman
 
dissipate's Avatar
 
Industry Role:
Join Date: Nov 2005
Location: Lost Angeles
Posts: 8,904
Use PHP's APC Cache.

Put the link URL in a key in apc cache, once it's been accessed, destroy the key.

http://us.php.net/apc
dissipate is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-19-2007, 12:48 AM   #14
tom3k
Confirmed User
 
Industry Role:
Join Date: Nov 2007
Posts: 105
database + unique hashes is the only sure shot way to go at this.

it what i would do.
tom3k is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-19-2007, 02:53 AM   #15
brandonstills
Confirmed User
 
brandonstills's Avatar
 
Join Date: Dec 2007
Location: Chatsworth, CA
Posts: 1,964
href="myScript.php?linkID=xxxx"

then the myScript.php redirects and removes the link as a valid option

you can probably use a database as the easiest way to keep track of it
brandonstills is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-03-2011, 05:39 AM   #16
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
do you still need this?

i know its a very old thread, but i use something like this, you can make the url expire after certain amount of time. bind it to an ip address, etc.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.