I just wrote a simple redirect script so that I could send traffic off-site using the format: domain.com/redirect.php?url=redirecting.com
Initially I just used a switch statement with half a dozen URLs where the '.com' url would be changed for the full url, like 'http://www.redirecting.com/folder/affiliateid' so I'm just simplifying URLs for the sake of keeping things easy while I build pages.
This all works fine but it's quite useful and I'd like to add a heap more links. I'd keep using the same format but I would imagine there's a more efficient way than using a switch ? What's the best way to do it without involving a database (mysql etc) ? I believe I could use a flat file database but I wouldn't know where to start.



Looking for people to post on an Adult forum.

But like frog said, you could store a serialized array and open and write the file as needed. It would probably work a few hundred links but will not for a few thousand as it'd load of all the links in an array.


Bookmarks