Archive for the ‘Website Design Tips’ Category

Auto Update Your Payment Button

Friday, September 25th, 2009

Have you ever wondered how to change your Payment Button prices automatically? Or maybe you have done this with javascript and weren’t happy with the results…

This is where PhP comes in as a server side script. Your users can’t block it as with JavaScript. Let me show you a simple way to automatically change your prices on your payment button. The below was done with PayPal although other payment processors should work the same.

The first 5 lines are to create the dates you will need. <?php can be abreviated as <? if you wish. This simply tells the browser that it will be handled by the server.  Next come the variables which we will use. $tm is todays month, $td represents todays day, and $ty as you have guessed is the year. To use this information we concact it or “join” it all together for logical use. So, $now = mktime($tm, $td, $ty); creates a usable time stamp for php to compare with older or newer dates. mktime() is the number of seconds since the Epoch. No it’s not the “Silurean Epoch” spoken of by “Rick Wakeman” in “Journey To The Center Of The Earth”! No, no, this is the UNIX Epoch which began at midnight GMT
 January 1, 1970. I know this is probably more information than you needed, but it’s important to know how this script works!

Now that you are aware, $now stands for the time in seconds the page was  visited. The next line, $edate, is the date to change pricing. In the example below we used 9,25,2009 or September 25, 2009 in seconds which makes it easy to compare them. Next is where you payment code goes. This line, if ($now <= $edate){ simply checks to see if the date the page is visited is less than the date the payment changes. In most cases the price will increase after the $edate.

What you need to do is go to your payment processor, in this case it is PayPal, and create 2 buttons. One for the first or lesser price and the second for the higher price. Simply copy and paste your code from <form to </form> into the script. Leave the quotes ” in place. The script will not work without them. Do the same for the next form with the increased price. That’s all there is to it. The last thing is to make sure you save your page as yourpagename.php. It MUST have the .php extension in order to work. If your site does not have php enabled, don’t waster your time although most host do have php installed…

Finally, within your body paste this line where you want the payment button to appear: <? echo $pbutton; ?>

<?php
$tm = date(“m”);
$td = date(“d”);
$ty = date(“Y”);
$now = mktime($tm, $td, $ty);
$edate = mktime(9, 25, 2009);//Time for Month Day Year
if ($now <= $edate){
  $pbutton = ”
  <form action=\”https://www.paypal.com/cgi-bin/webscr\” method=\”post\”>
  <input type=\”hidden\” name=\”cmd\” value=\”_s-xclick\”>
  <input type=\”hidden\” name=\”hosted_button_id\” value=\”XXXXXXX\”>
  <input type=\”image\” src=\”http://YourButtonImageUrlHere\” border=\”0\” name=\”submit\” alt=\”PriceHere PayPal – The safer, easier way to pay online!\”>
  <img alt=\”\” border=\”0\” src=\”https://www.paypal.com/en_US/i/scr/pixel.gif\” width=\”1\” height=\”1\”>
  </form>”;
  }else{
  $pbutton = ”
  <form action=\”https://www.paypal.com/cgi-bin/webscr\” method=\”post\”>
  <input type=\”hidden\” name=\”cmd\” value=\”_s-xclick\”>
  <input type=\”hidden\” name=\”hosted_button_id\” value=\”XXXXXXX\”>
  <input type=\”image\” src=\”http://YourButtonImageUrlHere\” border=\”0\” name=\”submit\” alt=\”PriceHere PayPal – The safer, easier way to pay online!\”>
  <img alt=\”\” border=\”0\” src=\”https://www.paypal.com/en_US/i/scr/pixel.gif\” width=\”1\” height=\”1\”>
  </form>”;
}
?>

That’s all there is to it. It’s a lot easier to do than it is to explain in detail, trust me on this… Upload the entire page to your site and you have a dynamic payment button. This will change the price for you automatically after a certain date.

That’s just bare bones of what you are able to do with this. You could make it for hours since last visit by collecting the IP of the visitor and much much more. But that  requires the use of MySQL. More on that at a later date!

Please be sure to leave comments or questions on this. I will be more than happy to answer them.

Auto Date Creation

Friday, June 19th, 2009

I’m sure you have seen all those sales pages which promote something and they have the date of the sale. But, you wonder how they do it? That’s pretty simple with PhP.

This is all you need to do. Rename your page to .php. That tells the browser you are using a server-side script. You then need to add this at the top of your page before anything else!

<?php
$today = date(“M d, Y”);
?>

Now you can put <? echo $today;?> where you want todays date to be.

Properly redirect your affiliate links

Thursday, June 18th, 2009

I have seen too many people use the meta redirect for affiliate links. I know it works and all but, what are the consequences? The spiders don’t like  the meta redirect. This just tells the spider to look at the new page and not why!

You really need to use the 301 redirect since it tells the spiders your page has moved permantly. Here is how to use it;

When you send a visitor to your affiliate link, make a new folder for the link. So, if you are sending them to an affiliate program called your xyz.com, make a folder named XYZ. Now your affiliate link will look like http://yoursite.com/XYZ. Inside the XYZ folder you want to create an index.php file. It’s important to use the .php extension so the browser knows how to handle the file.

Now you create/update your index.php file with this;

<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.AffiliateLinkHere” );
?>

If you have 3 or 10 or 100 affiliate links, just create a new folder for each and use the above code in your index.php file for each folder.

A better way is to create a folder in your web root named Recommends. Inside that folder you would create all the other folders for your affiliate links. In this way when you promote http://www.yoursite/Recommends/YourPromotionName , the user is redirected to your affiliate link.

Hope that made sense to you. If not, please post your questions and I will answer them all!

PayDotCom

Recent Tweets
Follow @walleyg (128 followers)
Posts By Date
September 2010
M T W T F S S
« Dec    
 12345
6789101112
13141516171819
20212223242526
27282930  
Recommended
Polls

How Is My Site?

View Results

Loading ... Loading ...