Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevArticles:
Keeping a Secret Inside PHP
Mar 21, 2003 @ 13:05:49

Everyone knows that to get most of the search engines to spider their sites, they need to have "friendly" URLS, things more like foo.com/test/1, and less like foo.com?test=1. Making links work like the first example can make your site easier to spider, and could result in more visitors in the long run. But, what happens if you want the opposite? How can PHP help with making one-time URLs that can't be accessed again? Well, DevArticles just might have the cure.

In their new piece, aptly titled "Generating One-Time URLs with PHP", they show you the code for a script that will generate a URL for you with a token 32 characters long - which allows for plenty of variance. What you get ends up looking more like a normal PHP session ID, but they give you the other piece of the puzzle - the validation. So, if someone comes in with a "secret URL" using this method, you can check to see if it's valid.

Doing things like this can be great for things like special offers (with tracking), and even validating a user from a link in their email. The potential is pretty limitless...

tagged:

Link:


Trending Topics: