Creating PHP Splash Pages

Program owners take note! If you’ve ever wanted to turn a splash page into a splash page your users can use, you’ll want to bookmark this page. It’s very simple but if you don’t know how to do it, where do you start?

1. Create the Splash Page in normal, dull, HTML

This is the easy part. Get a splash page made, make it yourself, whatever. Just have it in the normal HTML mode, and use your own referral link in all the links. Below is an example link:

http://www.startxchange.com/?referer=xxclixxx

2. Change the links

Next you need to open your html file with notepad. Only use notepad, unless you know the program is a PHP editor. Then find your userid or username from your link. In the example above, it’s xxclixxx. Search the html file and replace your username with:

<?php=$userid?>

The URL above now becomes what’s shown below. It’s important to make sure all links on the splash page are using referral links, and all links have been replaced with this code. Otherwise you’ll get angry affiliates thinking you are cheating them out of their referrals.

http://www.startxchange.com/?referer=<?php=$userid?>

3. Add this header

Simply put, add the following to the top of the page BEFORE the <html> tag. Ok, so it’s not crucial to be above that tag, but to keep things smooth and simple, put it before any other code.

<?php
$userid = ereg_replace("[\'\")(;|`,<>]", "",$_GET["userid"]);
?>

This is important for two reasons. You don’t have to have register globals turned on, and you don’t have to worry about XSS attacks. It cleans the user id for anything harmful, before letting you put it into the page.

4. Rename the file

Last, you’ll just rename that .html file to .php, and upload it to your website. Say you name it splash3.php, then your users would link to it as such:

http://www.yoursite.com/splash3.php?userid=xxclixxx

It’ll magically change all the links to have the ID in the userid field. Pretty sweet!

5. Bonus: Changing the variable name!

If you want it to be ?referer= rather than ?userid= all you have to do is change the header section. Where it says $_GET["userid"] change that text inside the quotes to something else. It could be anything. Just make sure you don’t change anything else, and keep the quotes!

2 thoughts to “Creating PHP Splash Pages”

  1. Even though you’re using the full tag, I believe the echo shortcut <?php= still relies on the php.ini setting of short_open_tag being on. On php configurations where this is off, such as mine, the code will have to be instead of the shortcut code.

Comments are closed.