RSS Feed

February, 2010

  1. Personalizing a page

    February 10, 2010 by Austin Hallock

    Personalizing pages I’ve found to be very powerful. “Hey Austin!” is more effective than “Hey You!”, I think it’s just because our name naturally stands out to us.

    mod_rewrite

    This can be really useful in emails you mail out to your list … you can have them click a link that brings up a page customized with their name.

    Here’s an example of what the code below will do for you (with my name in there): http://www.austinhallock.com/splash/austin

    Problem is (well, I guess this is a good thing for you) no one really does it even though it’s dead simple.

    First, name the page mypage.php rather than mypage.html.

    Next, when you send out an email linking to your page (assuming you’re using some auto-responder), link to http://www.yoursite.com/mypage.php?name={!firstname} — where I have {!firstname} you would put whatever code your auto-responder uses for the name.

    In your page where you want the name to show up put

    <?php if(isset($_GET['name']) && strlen($_GET['name']) > 0) $name = ucfirst($_GET['name']); else $name = "You"; echo $name; ?>
    

    This will grab their name if it’s in the URL, capitalize the first letter of it (ie. austin turns to Austin) and output it. If their name isn’t in the URL, it will output “You” instead. If you want it to say something other than “You” just change what’s in the quotes there.

    If you want it to show something other than “name” in the URL, for example you want it to look like: mypage.php?awesomeperson=austin just change all references of “name” in the above code to “awesomeperson”.

    To get a bit advanced and have the URL look prettier like http://www.yoursite.com/mypage/austin you’ll want to edit the .htaccess file in the folder your file is in. If you already have a .htaccess file in that folder just open it up and edit it in whichever editor you use. Otherwise, create one — it’s just named .htaccess nothing else tacked on.

    At the top of your .htaccess file you’ll need to put

    RewriteEngine on
    RewriteRule ^mypage(/|$)([^/\.]*)/?$ mypage.php?name=$2 [L]
    

    Of course replacing “mypage” and “mypage.php” with the folder you want it to appear like it’s in, and the file name.

    For example if you want yoursite.com/splash1.php?awesome=austin to show up as yoursite.com/splash/austin, you would change the first “mypage” to “splash”, “mypage.php” to “splash1.php” and “name” to “awesome”. You’d end up with something like this:

    RewriteEngine on
    RewriteRule ^splash(/|$)([^/\.]*)/?$ splash1.php?awesome=$2 [L]
    

    Hope this helps, and as always if you have any questions post them in the comments!


  2. Displaying an exchange’s name

    February 7, 2010 by Austin Hallock

    A great way to grab a surfer’s attention is to mention the exchange they’re surfing. Until now, there hasn’t really been an easy way for “Average Joe” to do this, so I went ahead and made some code that makes it easy for you.


    The code below will determine the exchange a user is surfing, and output the name of the exchange, as well as the logo’s color. About 25 of the top exchanges are listed, returning the proper name (ie. thumbvu returns ThumbVu) and color. If they’re just viewing the page not in an exchange, it will return nothing (so you would get something like “HEY SURFER”).

    What you’ll need to do first, is when you create your splash page, instead of having the name be something like splash.html, name it splash.php.

    Where you want to put the exchanges name, put:

    <?php echo get_exchange(); ?>
    

    If you want the name to be all caps, put:

    <?php echo strtoupper(get_exchange()); ?>
    

    Here’s the function (put this at the end of your .php file). All of the exchanges are on my end, so I can update for new exchanges, and it will automatically add them for you (speaking of which, if you’d like your exchange added, post a comment below).

    <?php
    function get_exchange()
    {
    	//Parse the referrer url
    	$url = parse_url($_SERVER['HTTP_REFERER']);
    	//Grab the host
    	$host = $url['host'];
    	//Grab the domain from that
    	$domain = explode(".", $host);
    	$domain = $domain[count($domain)-2];
    	//Grab the stuff to return
    	$contents = file_get_contents("http://www.austinhallock.com/exchanges.php?domain=$domain");
    	return $contents;
    }
    ?>
    

    If you want it all on your end so you can customize it a bit more, use the following function instead:

    <?php
    function get_exchange()
    {
    	//Parse the referrer url
    	$url = parse_url($_SERVER['HTTP_REFERER']);
    	//Grab the host
    	$host = $url['host'];
    	//Grab the domain from that
    	$domain = explode(".", $host);
    	$domain = $domain[count($domain)-2];
    	/* Show specific names for hosts
    	 * (doing this for proper capitalization and coloring)
    	 * To add custom ones, if the domain name is www.thumbvu.com
    	 * Do:
    	 * $exchanges['thumbvu']['name'] = "ThumbVu";
    	 * $exchanges['thumbvu']['color'] = "#F7931E";
    	 */
    	$exchanges['thumbvu']['name'] = "ThumbVu";
    	$exchanges['thumbvu']['color'] = "#F7931E";
    
    	$exchanges['easyhits4u']['name'] = "EasyHits4U";
    	$exchanges['easyhits4u']['color'] = "#EB8B00";
    
    	$exchanges['startxchange']['name'] = "StartXchange";
    	$exchanges['startxchange']['color'] = "#FF0000";
    
    	$exchanges['traffic-splash']['name'] = "Traffic Splash";
    	$exchanges['traffic-splash']['color'] = "#52D652";
    
    	$exchanges['hit2hit']['name'] = "Hit2Hit";
    	$exchanges['hit2hit']['color'] = "#FB874C";
    
    	$exchanges['hitsboosterpro']['name'] = "HBPro";
    	$exchanges['hitsboosterpro']['color'] = "#171442";
    
    	$exchanges['hitsafari']['name'] = "HitSafari";
    	$exchanges['hitsafari']['color'] = "#E96827";
    
    	$exchanges['tezaktrafficpower']['name'] = "TTP";
    	$exchanges['tezaktrafficpower']['color'] = "#CB0000";
    
    	$exchanges['ilovehits']['name'] = "ILoveHits";
    	$exchanges['ilovehits']['color'] = "#1668A4";
    
    	$exchanges['trafficwitch']['name'] = "Traffic Witch";
    	$exchanges['trafficwitch']['color'] = "#D87204";
    
    	$exchanges['traffictaxis']['name'] = "Traffic Taxis";
    	$exchanges['traffictaxis']['color'] = "#040404";
    
    	$exchanges['soaring4traffic']['name'] = "Soaring4Traffic";
    	$exchanges['soaring4traffic']['color'] = "#096FB1";
    
    	$exchanges['trafficera']['name'] = "Traffic Era";
    	$exchanges['trafficera']['color'] = "#84ADD9";
    
    	$exchanges['high-hits']['name'] = "High Hits";
    	$exchanges['high-hits']['color'] = "#FC9C21";
    
    	$exchanges['blue-surf']['name'] = "Blue-Surf";
    	$exchanges['blue-surf']['color'] = "#005A9D";
    
    	$exchanges['majorleaguehits']['name'] = "MLH";
    	$exchanges['majorleaguehits']['color'] = "#013B63";
    
    	$exchanges['rainbow-traffic']['name'] = "RainbowTraffic";
    	$exchanges['rainbow-traffic']['color'] = "#0092DF";
    
    	$exchanges['dragonsurf']['name'] = "DragonSurf";
    	$exchanges['dragonsurf']['color'] = "#1F4C23";
    
    	$exchanges['trafficgoldrush']['name'] = "Traffic Gold Rush";
    	$exchanges['trafficgoldrush']['color'] = "#B18B2A";
    
    	$exchanges['realhitz4u']['name'] = "RealHitz4u";
    	$exchanges['realhitz4u']['color'] = "#F69800";
    
    	$exchanges['fasteasytraffic']['name'] = "FastEasyTraffic";
    	$exchanges['fasteasytraffic']['color'] = "#F95307";
    
    	$exchanges['swattraffic']['name'] = "S.W.A.T.";
    	$exchanges['swattraffic']['color'] = "#00319C";
    
    	if(!isset($exchanges[$domain]))
    	{
    		$exchanges[$domain]['name'] = $domain;
    		$exchanges[$domain]['color'] = "inherit";
    	}
    
    	return "<span style='color:{$exchanges[$domain]['color']};'>{$exchanges[$domain]['name']}</span>";
    }
    ?>
    

    Below is the full code for this combined with yesterday’s post on creating a sexy splash page. You can see it in action here (though it won’t say the exchange name since you aren’t surfing).

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' >
    	<head>
    		<!-- TITLE OF YOUR PAGE -->
    		<title>
    			YOUR PAGE TITLE
    		</title>
    		<!-- END TITLE -->
    		<style type='text/css'>
    			body
    			{
    				/* The color you want the page background to be */
    				background-color: #111111;
    				font-family: 'Helvetica Neue', Helvetica, arial;
    				font-weight: bold;
    				padding: 0px;
    				margin:0px;
    			}
    			#main
    			{
    				/* The color you want the box border to be */
    				border: 4px solid #FFFFFF;
    				/* The color you want the box background to be */
    				background-color:#16DE1A;
    				/* The color you want the box font to be */
    				color: #111111;
    				font-size: 28px;
    				-moz-border-radius: 10px;
    				-o-border-radius: 10px;
    				-webkit-border-radius: 10px;
    				-khtml-border-radius: 10px;
    				border-radius: 10px;
    				width: 700px;
    				margin: 15px auto 0px auto;
    				padding: 10px 20px;
    				text-align: center;
    			}
    			.sub_text
    			{
    				font-size: 14px;
    				font-weight: normal;
    				width: 450px;
    				margin: 10px auto 0px auto;
    			}
    			h2
    			{
    				font-size: 50px;
    				/* The color you want the page heading font to be */
    				color: #FFFFFF;
    				text-shadow:0 2px 0 #111111;
    				margin: 5px;
    				text-align: center;
    			}
    			input
    			{
    				/* The color you want your input boxes to be */
    				background-color: #FFFFFF;
    				padding: 5px;
    				/* The color you want the border of your input boxes to be */
    				border: 2px solid #111111;
    				font-weight: bold;
    				-moz-border-radius: 4px;
    				-o-border-radius: 4px;
    				-webkit-border-radius: 4px;
    				-khtml-border-radius: 4px;
    			}
    			input:hover
    			{
    				/* The color you want your input boxes to be when hovered */
    				background-color: #C9F5C9;
    			}
    			input:focus
    			{
    				/* The color you want your input boxes to be when clicked */
    				background-color: #93DB94;
    			}
    			input[type=submit]
    			{
    				cursor: pointer;
    			}
    			a
    			{
    				/* The color you want your links to be */
    				color: #111111;
    			}
    		</style>
    		<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
    	</head>
    	<body>
    		<div id='main'>
    			<h2>
    				<!-- PAGE HEADER -->
    				HEY <?php echo strtoupper(get_exchange()); ?> SURFER
    				<!-- END PAGE HEADER -->
    			</h2>
    			<!-- MAIN CONTENT -->
    			YOUR PAGE CONTENT HERE
    			<!-- END MAIN CONTENT -->
    			<div class='sub_text'>
    				<div style='float:left; width:50%;'>
    					<!-- FORM DESCRIPTION -->
    					You can put a subscription form here.
    					For this example, I'm using my blog's subscription form, feel free to subscribe!
    					<!-- END FORM DESCRIPTION -->
    				</div>
    				<div style='float:right; margin-left: 2%; width:48%;'>
    					<!-- FORM -->
    					<form action='http://austinhallock.com/about/subscribe/' method='post'>
    						<p style='margin-top: 5px;'><input type='text' name='nn' value='Your name' onclick="if (this.defaultValue==this.value) this.value=''" onblur="if (this.value=='') this.value=this.defaultValue"/></p>
    						<p><input type='text' name='ne' value='Your email' onclick="if (this.defaultValue==this.value) this.value=''" onblur="if (this.value=='') this.value=this.defaultValue"/></p>
    						<p><input type='submit' value='Subscribe'/></p>
    						<input type='hidden' name='na' value='s'/>
    					</form>
    					<!-- END FORM -->
    				</div>
    				<br clear='all'/>
    			</div>
    		</div>
    	</body>
    </html>
    <?php
    function get_exchange()
    {
    	//Parse the referrer url
    	$url = parse_url($_SERVER['HTTP_REFERER']);
    	//Grab the host
    	$host = $url['host'];
    	//Grab the domain from that
    	$domain = explode(".", $host);
    	$domain = $domain[count($domain)-2];
    	//Grab the stuff to return
    	$contents = file_get_contents("http://www.austinhallock.com/exchanges.php?domain=$domain");
    	return $contents;
    }
    ?>
    

    If you have any questions or comments, post them below!


  3. So you want a better splash page?

    February 6, 2010 by Austin Hallock

    If you’re advertising in traffic exchanges, you’re going to want an awesome splash page. You’ve got to realize your page will be viewed for a very short amount of time … Your goal is to grab the attention of the ‘surfer’, and you do this with a splash page.

    That much you probably already know. It’s a matter of getting that sexy page to peak their interest.

    Here’s some code I generally base my splash pages off, feel free to use it yourself, and tweak for your own needs. In the coming weeks I’ll be posting on how to properly use HTML and CSS to spruce up your pages.

    I commented (where you see <!– … –>) certain parts so you can see what text to add where. Additionally, I commented (/* … */) some of the CSS so you can change up the colors if you’d like! Colors can be put in like “red”, “yellow”, “green”, etc. (without the quotes), or you can you a hex code (usually I use the campaign adder at ThumbVu to get this code, if you’re not upgraded, you can use this)

    You can see an example of how the code below looks here. Click “show source” to view the actual HTML.

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' >
    	<head>
    		<!-- TITLE OF YOUR PAGE -->
    		<title>
    			YOUR PAGE TITLE
    		</title>
    		<!-- END TITLE -->
    		<style type='text/css'>
    			body
    			{
    				/* The color you want the page background to be */
    				background-color: #111111;
    				font-family: 'Helvetica Neue', Helvetica, arial;
    				font-weight: bold;
    				padding: 0px;
    				margin:0px;
    			}
    			#main
    			{
    				/* The color you want the box border to be */
    				border: 4px solid #FFFFFF;
    				/* The color you want the box background to be */
    				background-color:#16DE1A;
    				/* The color you want the box font to be */
    				color: #111111;
    				font-size: 28px;
    				-moz-border-radius: 10px;
    				-o-border-radius: 10px;
    				-webkit-border-radius: 10px;
    				-khtml-border-radius: 10px;
    				border-radius: 10px;
    				width: 700px;
    				margin: 15px auto 0px auto;
    				padding: 10px 20px;
    				text-align: center;
    			}
    			.sub_text
    			{
    				font-size: 14px;
    				font-weight: normal;
    				width: 450px;
    				margin: 10px auto 0px auto;
    			}
    			h2
    			{
    				font-size: 50px;
    				/* The color you want the page heading font to be */
    				color: #FFFFFF;
    				text-shadow:0 2px 0 #111111;
    				margin: 5px;
    				text-align: center;
    			}
    			input
    			{
    				/* The color you want your input boxes to be */
    				background-color: #FFFFFF;
    				padding: 5px;
    				/* The color you want the border of your input boxes to be */
    				border: 2px solid #111111;
    				font-weight: bold;
    				-moz-border-radius: 4px;
    				-o-border-radius: 4px;
    				-webkit-border-radius: 4px;
    				-khtml-border-radius: 4px;
    			}
    			input:hover
    			{
    				/* The color you want your input boxes to be when hovered */
    				background-color: #C9F5C9;
    			}
    			input:focus
    			{
    				/* The color you want your input boxes to be when clicked */
    				background-color: #93DB94;
    			}
    			input[type=submit]
    			{
    				cursor: pointer;
    			}
    			a
    			{
    				/* The color you want your links to be */
    				color: #111111;
    			}
    		</style>
    		<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
    	</head>
    	<body>
    		<div id='main'>
    			<h2>
    				<!-- PAGE HEADER -->
    				PAGE HEADER
    				<!-- END PAGE HEADER -->
    			</h2>
    			<!-- MAIN CONTENT -->
    			YOUR PAGE CONTENT HERE
    			<!-- END MAIN CONTENT -->
    			<div class='sub_text'>
    				<div style='float:left; width:50%;'>
    					<!-- FORM DESCRIPTION -->
    					You can put a subscription form here.
    					For this example, I'm using my blog's subscription form, feel free to subscribe!
    					<!-- END FORM DESCRIPTION -->
    				</div>
    				<div style='float:right; margin-left: 2%; width:48%;'>
    					<!-- FORM -->
    					<form action='http://austinhallock.com/about/subscribe/' method='post'>
    						<p style='margin-top: 5px;'><input type='text' name='nn' value='Your name' onclick="if (this.defaultValue==this.value) this.value=''" onblur="if (this.value=='') this.value=this.defaultValue"/></p>
    						<p><input type='text' name='ne' value='Your email' onclick="if (this.defaultValue==this.value) this.value=''" onblur="if (this.value=='') this.value=this.defaultValue"/></p>
    						<p><input type='submit' value='Subscribe'/></p>
    						<input type='hidden' name='na' value='s'/>
    					</form>
    					<!-- END FORM -->
    				</div>
    				<br clear='all'/>
    			</div>
    		</div>
    	</body>
    </html>
    

    Just copy and paste that html, edit where it says to, and upload to your server.

    If you have any questions, feel free to post them below!


  4. Welcome!

    February 6, 2010 by Austin Hallock

    If you’re interested in programming, startups, traffic exchanges, or just a young adult’s life experiences in general, this is the blog for you…

    I’ll cover each of these subjects, and my personal view on them; if you don’t like what I have to say, don’t read it. You can subscribe via email to in the sidebar, or via RSS up top.

    This blog is a mesh of my personal life, and my work life, but mostly my work-life…I’ll give tips on programming: what I’ve learned and how you can improve your website — as well my knowledge of running a business, how to optimize your advertising, and a bit of personal experiences.

    A bit about me… I was the sole programmer behind ThumbVu.com, and currently am doing programming work for Jon Olson of IloveHits, and Tim Linden of StartXchange.

    On top of that, I’m attending a community college in Cedar Park, TX (just north of Austin), with a major in Computer Science. My plan is to transfer to the University of Texas for my junior year (hook ‘em). Still living at home, but in the next month or so I’m planning on moving out, so expect a few updates on that!

    Thanks for reading!