Tensor is a sleek template that can fit many different websites. It can have a…
Shopping/Ecommerce Plugin Solutions For WordPress
Here is a list of Shopping/Ecommerce Plugin Solutions For WordPress. I thought i would start this post purely because i spent most of the day trying to find a ecommerce plugin that actually works. So hopefully it helps you too! Jigoshop Jigoshop is an eCommerce plugin for WordPress developed by...
06
Jul
2011
1 Comment
Read More
Good SEO practices – How to beat Google panda
Last week we did a post on Google panda “Has your site been Google Panda slapped?”. This week I want to share with you some ideas and practice that you can apply to your website to help improve and beat the panda! Google has released Panda update 2.2, just as...
27
Jun
2011
No comments
Read More
Sliding login panel with jQuery
Came across this great script for slide down login This script is based on a previous script “Show/Hide Login Panel with Mootools 1.2″ but now works with jQuery 1.3.2 instead of Mootools 1.2. Please note the Login and Register forms in this demo will not work “out of the box”...
22
Feb
2011
No comments
Read More
YouTube Clone Script
http://www.clipsharetemplates.com clone script allows you to run your own video sharing portal like YouTube.com, Metacafe, DailyMotion, and others The ClearWater template is a stunning and light design featuring stylish mouseover effects and will be a great addition to any video sharing website using Clipshare 4.1 Professional. The Clearwatter template utilizes...
10
Oct
2010
1 Comment
Read More
PHP Coupon Clone Script
Easy-to-use SEO friendly coupon script which allow you to create Discounts/Promotion Coupons web site. Earn affiliate commissions while offering discounts for your visitors! With 9 different designs you will be able to create perfect coupon web site in any niche! Add website/store with Seo title, keywords and affiliate url Activate...
23
Sep
2010
No comments
Read More
Image Sharing Script
Create your own popular image sharing website. Allow users to share their picture and photos with everyone. Host images instantly with this image hosting script. Features Rate Images Users can rate images with the 5 star rating system (ajax). Rate Images Security Users are only allowed to vote once per...
14
Jul
2010
1 Comment
Read More
Yahoo answers clone scriptYahoo answers clone script
Looking to create your own Yahoo Answer Website. Well here is the script that will help you achieve that goal! Question Answer Script with a large and highly customizable set of key features makes it the best of php answer script available. Question answer script has the question & answer...
30
May
2010
No comments
Read More
Domain Auctions Script Flippa clone script
This fantastic script can be used to create your very own Flippa website. Not only can it be used as a flippa type website, but it’s great for any marketplace niche. With this Clone Script you will be able to produce a marketplace website within minutes. PRICE: $57 DEMO...
29
May
2010
2 Comments
Read More
As a PHP developer i’m always in the search for little snippets to add to my library. This at times so often proves useful when coding big projects and quick little functions. Snippets as such are great to add to existing CMS systems, such as WordPress, drupal or Joomla.
Calculate distances in PHP
I used this on an accommodation website not to long ago. this snippet allows you to measure the distance from one point to another. Great combo with Google maps too!
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
$unit = strtoupper($unit);
return ($miles * 1.609344);
} else if ($unit == "N") {
return ($miles * 0.8684);
} else {
return $miles;
}
}
Force file download
This allows you to force file downloads such as mp3 and other files being played in browsers.
$file_name = $file;
$mime = 'application/force-download';
header('Pragma: public'); // required
header('Expires: 0'); // no cache
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private',false);
header('Content-Type: '.$mime);
header('Content-Disposition: attachment; filename="'.basename($file_name).'"');
header('Content-Transfer-Encoding: binary');
header('Connection: close');
readfile($file_name); // push it out
exit();
}
Get latitude and longitude from an address
This is a great snippet and goes well with the first one i mentioned. This allows you grab the latitude and longitude from the Google map url and returning the values as an array!
if (!is_string($address))die("All Addresses must be passed as a string");
$_url = sprintf('http://maps.google.com/maps?output=js&q=%s',rawurlencode($address));
$_result = false;
if($_result = file_get_contents($_url)) {
if(strpos($_result,'errortips') > 1 || strpos($_result,'Did you mean:') !== false) return false;
preg_match('!center:\s*{lat:\s*(-?\d+\.\d+),lng:\s*(-?\d+\.\d+)}!U', $_result, $_match);
$_coords['lat'] = $_match[1];
$_coords['long'] = $_match[2];
}
return $_coords;
}
Get how many times a page have been retweeted using PHP
This snippet will return the number of tweets that a page was tweeted. Using the tweetmeme API
$content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
$element = new SimpleXmlElement($content);
$retweets = $element->story->url_count;
if($retweets){
return $retweets;
} else {
return 0;
}
}
Send Mail using mail function in PHP
$subject = "VIRALPATEL.net";
$body = "Body of your message here you can use HTML too. e.g.
<strong> Bold </strong>";
$headers = "From: Peter\r\n";
$headers .= "Reply-To: info@yoursite.com\r\n";
$headers .= "Return-Path: info@yoursite.com\r\n";
$headers .= "X-Mailer: PHP5\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
?>
Updated 7/8/2011
Validate email Address
This snippet will help you validate a email addy. It will check the MX records of the domain to make sure the email is more robust
{
if(eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email))
if($test_mx)
{
list($username, $domain) = split("@", $email);
return getmxrr($domain, $mxrecords);
}
else
return true;
else
return false;
}
Zip Files on the Fly
Snippet created by David Walsh. zip files on the fly!
function create_zip($files = array(),$destination = '',$overwrite = false) {
//if the zip file already exists and overwrite is false, return false
if(file_exists($destination) && !$overwrite) { return false; }
//vars
$valid_files = array();
//if files were passed in...
if(is_array($files)) {
//cycle through each file
foreach($files as $file) {
//make sure the file exists
if(file_exists($file)) {
$valid_files[] = $file;
}
}
}
//if we have good files...
if(count($valid_files)) {
//create the archive
$zip = new ZipArchive();
if($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
return false;
}
//add the files
foreach($valid_files as $file) {
$zip->addFile($file,$file);
}
//debug
//echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;
//close the zip -- done!
$zip->close();
//check to make sure the file exists
return file_exists($destination);
}
else
{
return false;
}
}
/***** Example Usage ***/
$files=array('file1.jpg', 'file2.jpg', 'file3.gif');
create_zip($files, 'myzipfile.zip', true);
Resize Images on the fly
This is a very useful snippet, especially when design wordpress templates and so on. Even shopping comparison websites!
*@filename - path to the image
*@tmpname - temporary path to thumbnail
*@xmax - max width
*@ymax - max height
*/
function resize_image($filename, $tmpname, $xmax, $ymax)
{
$ext = explode(".", $filename);
$ext = $ext[count($ext)-1];
if($ext == "jpg" || $ext == "jpeg")
$im = imagecreatefromjpeg($tmpname);
elseif($ext == "png")
$im = imagecreatefrompng($tmpname);
elseif($ext == "gif")
$im = imagecreatefromgif($tmpname);
$x = imagesx($im);
$y = imagesy($im);
if($x <= $xmax && $y <= $ymax)
return $im;
if($x >= $y) {
$newx = $xmax;
$newy = $newx * $y / $x;
}
else {
$newy = $ymax;
$newx = $x / $y * $newy;
}
$im2 = imagecreatetruecolor($newx, $newy);
imagecopyresized($im2, $im, 0, 0, 0, 0, floor($newx), floor($newy), $x, $y);
return $im2;
}
Please bookmark this post, im going to weekly update it with snippets so watch this space!

What is your favorite url shortener? I used to use tinyurl and then switched to bit.ly because it offered better tracking capabilities. Over the last couple of months there have literally been hundreds of new url shorteners that have been launched. I wanted to share with you a url shortening service that you can actually use to make money with.
The service is called wwy.me and it works just like all the other services by shortening your url but you can actually make some cash each and every time someone clicks on your link. Each time your link is clicked and ad will pop up for a few seconds while your link is loading. You get paid based on the amount of page views.