<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2593963131891535133</id><updated>2024-11-05T18:48:49.141-08:00</updated><category term="PHP"/><category term="Development Ideas"/><category term="Website Optimization"/><category term="PHP SEO"/><category term="PHP Optimization"/><category term="SEO Optimization"/><category term="Web Design"/><category term="jQuery"/><category term="JavaScript"/><category term="PHP Image"/><category term="CSS"/><category term="HTML"/><category term="MySQL"/><category term="PHP Functions"/><category term="HTTP Request"/><category term="PHP OAuth"/><category term="Regular Expression"/><category term="htaccess"/><category term="On-Page SEO"/><category term="PHP Array"/><category term="PHP Date Time"/><category term="SEO Server Fixes"/><category term="Yahoo Login for websites"/><category term="htaccess mod rewrite"/><category term="Google Login for Websites"/><category term="MySQL Date Functions"/><category term="Oauth Google yahoo Login"/><category term="PHP Captcha"/><category term="PHP Chart"/><category term="PHP Data URI"/><category term="PHP Tidy Object"/><category term="Resize Image"/><category term="SQL Query Logics"/><category term="Ajax Image Uploader"/><category term="Alexa Rank"/><category term="Auto Resize Image"/><category term="CAPTCHA Image Processing PHP"/><category term="CSV Processing PHP"/><category term="CSV to Array"/><category term="CSV to Database"/><category term="Converters"/><category term="Decryption"/><category term="Encryption"/><category term="Facebook Login"/><category term="Facebook login for website"/><category term="Form Objects"/><category term="Form Validation"/><category term="Get Contacts from Yahoo"/><category term="HTML Form design"/><category term="Horizontal Menu Scroller"/><category term="Liquid Layout"/><category term="Login with Gmail Account"/><category term="Login with Google Account"/><category term="Login with Yahoo Account"/><category term="Login with facebook"/><category term="Login with twitter"/><category term="New Updated Page Rank Script"/><category term="Newsletter Script"/><category term="Oauth Yahoo"/><category term="Off-Page SEO"/><category term="OpenID"/><category term="PHP Custom Functions"/><category term="PHP Image Upload"/><category term="PHP Page Rank Script"/><category term="PHP Upload"/><category term="PHP Zip Archive"/><category term="Sitemap Generation"/><category term="Time Arithmetic"/><category term="Twitter Oauth Login"/><category term="URL Masking"/><category term="Watermark Image"/><category term="Website login with twitter"/><category term="encode php files"/><category term="facebook connect"/><category term="jQuery Clipboard"/><category term="jQuery Menu"/><category term="protect php source code"/><category term="working with iframe"/><title type='text'>W3 Lessons</title><subtitle type='html'>W3 Lessons Articles for PHP, MySQL, CSS, HTML, jQuery for web Developers and Designers</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>84</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-5228487326582461195</id><published>2019-07-24T23:42:00.000-07:00</published><updated>2019-07-24T23:42:22.371-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Auto Resize Image"/><category scheme="http://www.blogger.com/atom/ns#" term="CAPTCHA Image Processing PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Captcha"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Image"/><category scheme="http://www.blogger.com/atom/ns#" term="Resize Image"/><title type='text'>Dynamic Image Dimension based on Font size in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Working with images and text, we need to set image size based on font size is very useful for dynamic image processing. like &lt;span class=&quot;_Tgc&quot;&gt;&lt;b&gt;CAPTCHA&lt;/b&gt; &lt;/span&gt;and text images. if you looking for PHP script to set image size based on font size here is the solution for you.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php


if($_GET[&#39;fontsize&#39;]!=&quot;&quot; and is_numeric($_GET[&#39;fontsize&#39;]))
$size=$_GET[&#39;fontsize&#39;];
else
$size=20;


define(&quot;F_SIZE&quot;, $size);
define(&quot;F_ANGLE&quot;, 0);
define(&quot;F_FONT&quot;, &quot;verdana.ttf&quot;);


$text = &quot;W3 Lessons&quot;;

$Leading=0;
$W=0;
$H=0;
$X=0;
$Y=0;

$_bx = imagettfbbox(F_SIZE, F_ANGLE, F_FONT, $text);
$s = preg_split(&quot;/\n]+/&quot;, $text);  // Array of lines
$nL = count($s);  // Number of lines

$W = ($W==0)?abs($_bx[2]-$_bx[0]):$W;
$H = ($H==0)?abs($_bx[5]-$_bx[3])+2+($nL&amp;gt;1?($nL*$Leading):0):$H;

$W*=1.05;
$H*=1.5;

$img = @imagecreate($W+8, $H) or die(&quot;Cannot Initialize new GD image stream&quot;);

$white = imagecolorallocate($img, 255,255,255);
$txtColor = imagecolorallocate($img, 29,56,131);

// Adjust padding right:
$W+=8;
$bgwhite = imagecolorallocatealpha($img,238,238,238,0);
imagefilledrectangle($img, 0, 0,$W,$H, $bgwhite);

$alpha = &quot;&quot;.range(&quot;a&quot;, &quot;z&quot;);
$alpha = $alpha.strtoupper($alpha).range(0, 9);

// Use the string to determine the height of a line
$_b = imageTTFBbox(F_SIZE, F_ANGLE, F_FONT, $alpha);
$_H = abs($_b[5]-$_b[3]);
$__H = 0;

// Use the string to determine the width of a line
$_b = imagettfbbox(F_SIZE, F_ANGLE, F_FONT, $text);
$_W = abs($_b[2]-$_b[0]);

// Final width and height
$_X = abs($W/2)-abs($_W/2);
$__H += $_H;

imagettftext($img, F_SIZE, F_ANGLE, $_X, $__H, $txtColor, F_FONT, $text);

header(&quot;Content-Type: image/png&quot;);
imagepng($img);
imagedestroy($img);
// END EMAIL IMAGE  
exit();
?&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/5228487326582461195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/image-size-based-on-font-size-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5228487326582461195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5228487326582461195'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/image-size-based-on-font-size-in-php.html' title='Dynamic Image Dimension based on Font size in PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-6669898289727958746</id><published>2019-07-24T23:41:00.000-07:00</published><updated>2019-07-24T23:41:34.550-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="URL Masking"/><category scheme="http://www.blogger.com/atom/ns#" term="Web Design"/><category scheme="http://www.blogger.com/atom/ns#" term="Website Optimization"/><title type='text'>Full Screen iframe, frameset URL Masking</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
URL Masking technique with frameset, widely used method and support all modern and old browsers.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #eee; border: 2px dashed #f00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1&quot;&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;frameset border=&quot;0&quot; rows=&quot;100%,*&quot; cols=&quot;100%&quot; frameborder=&quot;no&quot;&amp;gt;
 &amp;lt;frame name=&quot;TopFrame&quot; scrolling=&quot;yes&quot; noresize src=&quot;http://www.w3lessons.com&quot;&amp;gt;
 &amp;lt;frame name=&quot;BottomFrame&quot; scrolling=&quot;no&quot; noresize&amp;gt;

 &amp;lt;noframes&amp;gt;&amp;lt;/noframes&amp;gt;
&amp;lt;/frameset&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/6669898289727958746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2018/10/full-screen-iframe-frameset-url-maskting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/6669898289727958746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/6669898289727958746'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2018/10/full-screen-iframe-frameset-url-maskting.html' title='Full Screen iframe, frameset URL Masking'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-7719050332148274631</id><published>2018-01-24T22:09:00.001-08:00</published><updated>2018-01-24T22:10:24.291-08:00</updated><title type='text'>PHP Image class with data_uri, resize, crop, watermark, scale, fitTosize</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP Image manipulation class almost every options in this class.&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Following features are included in this PHP class.&amp;nbsp;&lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;ul&gt;
&lt;li&gt;data_uri&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;getWidth&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;getHeight&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;resizeToHeight&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;resizeToWidth&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;scale&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;crop&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;resize&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;addWatermark&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;fitToSize&lt;/li&gt;
&lt;/ul&gt;
&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: rgb(238, 238, 238); border: 2px dashed rgb(255, 0, 0); margin: 10px; padding: 15px; text-align: left;&quot;&gt;&amp;lt;?php


/*
Written by: Jailani M, http://www.W3Lessons.com
w3_image Image Manipulation Class 
*/
class w3_image {

   var $image;
   var $image_type;

   function load($filename) {
      $image_info = getimagesize($filename);
      $this-&amp;gt;image_type = $image_info[2];
      if( $this-&amp;gt;image_type == IMAGETYPE_JPEG ) {
         $this-&amp;gt;image = imagecreatefromjpeg($filename);
      } elseif( $this-&amp;gt;image_type == IMAGETYPE_GIF ) {
         $this-&amp;gt;image = imagecreatefromgif($filename);
      } elseif( $this-&amp;gt;image_type == IMAGETYPE_PNG ) {
         $this-&amp;gt;image = imagecreatefrompng($filename);
      }

   }
   
   
   function save($filename, $image_type=IMAGETYPE_JPEG, $compression=100, $permissions=null) {
    

imagecolortransparent($this-&amp;gt;image, imagecolorallocatealpha($this-&amp;gt;image, 0, 0, 0, 127));
imagealphablending($this-&amp;gt;image, false);
imagesavealpha($this-&amp;gt;image, true);

    
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($this-&amp;gt;image,$filename,$compression);
      } elseif( $image_type == IMAGETYPE_GIF ) {
         imagegif($this-&amp;gt;image,$filename);         
      } elseif( $image_type == IMAGETYPE_PNG ) {
         imagepng($this-&amp;gt;image,$filename);
      }   
      if( $permissions != null) {
         chmod($filename,$permissions);
      }
   }
   
   
 function output($image_type=IMAGETYPE_JPEG) {
  
  imagecolortransparent($this-&amp;gt;image, imagecolorallocatealpha($this-&amp;gt;image, 0, 0, 0, 127));
  imagealphablending($this-&amp;gt;image, false);
  imagesavealpha($this-&amp;gt;image, true);  
    
  if( $image_type == IMAGETYPE_JPEG ) {
  imagejpeg($this-&amp;gt;image);
  } elseif( $image_type == IMAGETYPE_GIF ) {
  imagegif($this-&amp;gt;image);         
  } elseif( $image_type == IMAGETYPE_PNG ) {
  imagepng($this-&amp;gt;image);
  }   
 }
 
 function data_uri($image_type=IMAGETYPE_JPEG) {
  
  imagecolortransparent($this-&amp;gt;image, imagecolorallocatealpha($this-&amp;gt;image, 0, 0, 0, 127));
  imagealphablending($this-&amp;gt;image, false);
  imagesavealpha($this-&amp;gt;image, true);  
   ob_start();
  if( $image_type == IMAGETYPE_JPEG ) {
  $mime=&quot;image/jpeg&quot;;
  imagejpeg($this-&amp;gt;image);
  } elseif( $image_type == IMAGETYPE_GIF ) {
  $mime=&quot;image/gif&quot;;   
  imagegif($this-&amp;gt;image);         
  } elseif( $image_type == IMAGETYPE_PNG ) {
  $mime=&quot;image/png&quot;;   
  imagepng($this-&amp;gt;image);
  }
  $image_data= ob_get_clean();
  $base64=base64_encode($image_data);
  return &quot;data:$mime;base64,$base64&quot;;
 } 
   
   
   function getWidth() {
      return imagesx($this-&amp;gt;image);
   }
   function getHeight() {
      return imagesy($this-&amp;gt;image);
   }
   function resizeToHeight($height) {
      $ratio = $height / $this-&amp;gt;getHeight();
      $width = $this-&amp;gt;getWidth() * $ratio;
      $this-&amp;gt;resize($width,$height);
   }
   function resizeToWidth($width) {
      $ratio = $width / $this-&amp;gt;getWidth();
      $height = $this-&amp;gt;getheight() * $ratio;
      $this-&amp;gt;resize($width,$height);
   }
   function scale($scale) {
      $width = $this-&amp;gt;getWidth() * $scale/100;
      $height = $this-&amp;gt;getheight() * $scale/100; 
      $this-&amp;gt;resize($width,$height);
   }
   function resize($width,$height) {
  $new_image = imagecreatetruecolor($width, $height);
  imagealphablending($new_image, false);
  imagesavealpha($new_image, true);   
     imagecopyresampled($new_image, $this-&amp;gt;image, 0, 0, 0, 0, $width, $height, $this-&amp;gt;getWidth(), $this-&amp;gt;getHeight());
     $this-&amp;gt;image = $new_image;   
   }  
   
   function crop($left,$top,$width,$height)
   {
 // create a blank image having the same width and height as the crop area
    // this will be our cropped image
    $cropped_image = imagecreatetruecolor($width, $height);
 $bgwhite = imagecolorallocatealpha($cropped_image,255,255,255,0);
 imagefilledrectangle($cropped_image, 0, 0,$width,$height, $bgwhite);
    // copy the crop area from the source image to the blank image created above
    imagecopy($cropped_image, $this-&amp;gt;image, 0, 0, $left, $top,$width, $height);
  $this-&amp;gt;image = $cropped_image;
   }
   
   function addWatermark($watermark_image,$position=&quot;B_RIGHT&quot;)
   {
    // T_LEFT, T_RIGHT, B_LEFT, B_RIGHT
    
  ImageAlphaBlending($this-&amp;gt;image, true); 
  
  // Same Size PNG Watermark Image with Transparency
  $logoImage = ImageCreateFromPNG($watermark_image); 
  $logoW = ImageSX($logoImage); 
  $logoH = ImageSY($logoImage); 
  
  if($position == &quot;T_LEFT&quot;)
  {
  $dst_x = 0;
  $dst_y = 0;
  }elseif($position == &quot;T_RIGHT&quot;)
  {
  $dst_x = $this-&amp;gt;getWidth()-$logoW;
  $dst_y = 0;
  }elseif($position == &quot;B_LEFT&quot;)
  {
  $dst_x = 0;
  $dst_y = $this-&amp;gt;getHeight()-$logoH;   
  }elseif($position == &quot;B_RIGHT&quot;)
  {
  $dst_x = $this-&amp;gt;getWidth()-$logoW;
  $dst_y = $this-&amp;gt;getHeight()-$logoH;
  }
  
  
  // were you see the two 1&#39;s this is the offset from the top-left hand corner!
  ImageCopy($this-&amp;gt;image, $logoImage, $dst_x, $dst_y, 0, 0, $logoW, $logoH);  
   }
   
   function fitToSize($width,$height)
   {
 // create a blank image having the same width and height fitToSize
    // this will be our final image
    $fitToImage = imagecreatetruecolor($width, $height);
 $bgwhite = imagecolorallocatealpha($fitToImage,255,255,255,0);
 imagefilledrectangle($fitToImage, 0, 0,$width,$height, $bgwhite);
    // resize image based on fit to size in both height and width
 $this-&amp;gt;resizeToWidth($width);
 
 if($this-&amp;gt;getHeight() &amp;gt; $height)
 $this-&amp;gt;resizeToHeight($height); 
 
 $_x = ($width - $this-&amp;gt;getWidth())/2;
 $_w = $this-&amp;gt;getWidth();
 
 $_y = ($height - $this-&amp;gt;getHeight()) / 2; 
 $_h = $this-&amp;gt;getHeight();
 
 imagecopy($fitToImage,$this-&amp;gt;image,$_x,$_y,0,0,$_w,$_h);
  $this-&amp;gt;image = $fitToImage;
   }
}


&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/7719050332148274631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2018/01/php-image-class-with-datauri-resize.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/7719050332148274631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/7719050332148274631'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2018/01/php-image-class-with-datauri-resize.html' title='PHP Image class with data_uri, resize, crop, watermark, scale, fitTosize'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-6125870503023239886</id><published>2018-01-23T21:52:00.000-08:00</published><updated>2018-01-23T21:54:12.351-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Decryption"/><category scheme="http://www.blogger.com/atom/ns#" term="Encryption"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Functions"/><title type='text'>Simple Two way Encryption and Decryption Function PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;Hello guys, after
a long time, I came back to my blog with new flavor of articles, and I am plan
to concentrate my blog half my working day here after. So my followers can
expect valuable development ideas from me through comment and feed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;Here we go
our come back article, Here now I teach you the Two way encryption and
decryption method with full explanation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;Objective Build a function for Two
Way Encryption and Decryption:&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Encrypt as well as Decrypt our given
string with our own Encrypt Decrypt Key and Initiative Vector (IV) (?), with Advanced
Encryption Standard (AES) (?) this method is highly secure method all time ever
with few PHP functions to build Two way Encryption and Decryption.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;Functions Involved in Two Day
Encryption and Decryption. &lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
hash - Generate a hash value (message digest)&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: .5in;&quot;&gt;
&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt; &lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;&quot;&gt;hash&lt;/span&gt;&lt;/strong&gt; ( &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$algo&lt;/span&gt;&lt;/code&gt;
, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$data&lt;/span&gt;&lt;/code&gt; [, &lt;span class=&quot;type&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$raw_output&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = false&lt;/span&gt; ] )&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: .5in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;substr -
Return part of a string&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;&quot;&gt;substr&lt;/span&gt;&lt;/strong&gt; ( &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$string&lt;/span&gt;&lt;/code&gt;
, &lt;span class=&quot;type&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$start&lt;/span&gt;&lt;/code&gt; [, &lt;span class=&quot;type&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$length&lt;/span&gt;&lt;/code&gt;
] )&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;base64_encode
- Encodes data with MIME base64&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: .5in;&quot;&gt;
&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt; &lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;&quot;&gt;base64_encode&lt;/span&gt;&lt;/strong&gt; ( &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$data&lt;/span&gt;&lt;/code&gt; )&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: .5in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;base64_decode
- Decodes data encoded with MIME base64&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;&quot;&gt;base64_decode&lt;/span&gt;&lt;/strong&gt; ( &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$data&lt;/span&gt;&lt;/code&gt; [, &lt;span class=&quot;type&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$strict&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = false&lt;/span&gt; ] )&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;openssl_encrypt
- Encrypts data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: .5in;&quot;&gt;
&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt; &lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;&quot;&gt;openssl_encrypt&lt;/span&gt;&lt;/strong&gt; ( &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$data&lt;/span&gt;&lt;/code&gt; , &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$method&lt;/span&gt;&lt;/code&gt;
, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$key&lt;/span&gt;&lt;/code&gt; [, &lt;span class=&quot;type&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$options&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = 0&lt;/span&gt; [, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$iv&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = &quot;&quot;&lt;/span&gt; [, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;&amp;amp;$tag&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = NULL&lt;/span&gt; [, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$aad&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = &quot;&quot;&lt;/span&gt; [, &lt;span class=&quot;type&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$tag_length&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = 16&lt;/span&gt; ]]]]] )&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: .5in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;openssl_decrypt
- Decrypts data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;&quot;&gt;openssl_decrypt&lt;/span&gt;&lt;/strong&gt; ( &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$data&lt;/span&gt;&lt;/code&gt; , &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$method&lt;/span&gt;&lt;/code&gt;
, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$key&lt;/span&gt;&lt;/code&gt; [, &lt;span class=&quot;type&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$options&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = 0&lt;/span&gt; [, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$iv&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = &quot;&quot;&lt;/span&gt; [, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$tag&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = &quot;&quot;&lt;/span&gt; [, &lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;methodparam&quot;&gt; &lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-size: 10.0pt; line-height: 115%; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;$aad&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;initializer&quot;&gt; = &quot;&quot;&lt;/span&gt; ]]]] )&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
Two Encryption &amp;amp; Decryption Function&lt;/h3&gt;
&lt;pre style=&quot;background: #eee; border: 2px dashed #f00; margin: 10px; padding: 15px;&quot;&gt;/*
Written by: Jailani M, http://www.W3Lessons.com
Defineds:
ED_KEY - Encryption and Decription key your choice
IV_KEY - INITIATIVE VECTOR your choice
*/
define(&quot;ED_KEY&quot;,&quot;your_key&quot;);
define(&quot;IV_KEY&quot;,&quot;your_iv&quot;);

function w3_encode( $string) {
    $encrypt_method = &quot;AES-256-CBC&quot;;
    $key = hash( &#39;md5&#39;, ED_KEY );
    $iv = substr( hash( &#39;md5&#39;, IV_KEY ), 0, 16 );
    $encoded_string = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) );
    return $encoded_string;
}

function w3_decode($string)
{
    $encrypt_method = &quot;AES-256-CBC&quot;;
    $key = hash( &#39;md5&#39;, ED_KEY );
    $iv = substr( hash( &#39;md5&#39;, IV_KEY ), 0, 16 );
    $decoded_string = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv );
    return $decoded_string;
}

&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/two-way-encrypt-decrypt/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/two-way-encrypt-decrypt/EncDec.php.txt&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/6125870503023239886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2018/01/simple-two-way-encryption-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/6125870503023239886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/6125870503023239886'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2018/01/simple-two-way-encryption-and.html' title='Simple Two way Encryption and Decryption Function PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s72-c/zip.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-301504231604224213</id><published>2015-02-18T01:34:00.000-08:00</published><updated>2015-02-18T01:34:04.538-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP Functions"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP SEO"/><title type='text'>Get Google Page through PHP for Multiple URL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here is the PHP Script for best solution for Finding PR
 for multiple URLs hope this very useful for your projects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQEgrjTpbukXIf3_24bxqT2R7uNWUHc92ZENwBSVETWz98HuA6KnTbCNdJL9sKJIwmjxgVxFzRdCgT4RxsgmmEjPUpJx8oiV1uen2QokOQCioruZGYAb4R9WIK0_Ru0JQNILFtXjNY940/s1600/google-pagerank-explained.gif&quot; /&gt;&lt;/div&gt;
&lt;h2&gt;
Google PageRank Script PHP&lt;/h2&gt;
&lt;h2&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&amp;nbsp;Main Function&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt; (Download Full Script it Work like demo)&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre class=&quot;php&quot; name=&quot;code&quot;&gt;# Desc: function to check the Given URL with http:// and fetch PR
# Param: $url as String
# Depen: fetch_google_page_rank
# Return: Gogole Rank as Integer
function fetch_google_page_rank($url) {
 $url = strstr($url,&quot;http://&quot;)? $url:&quot;http://&quot;.$url;
    $fp = fsockopen(&quot;toolbarqueries.google.com&quot;, 80, $errno, $errstr, 30);
    if (!$fp) {
        echo &quot;$errstr ($errno)&amp;lt;br /&amp;gt;\n&quot;;
        } else {
        $out = &quot;GET /tbl?client=navclient-auto&amp;amp;ch=&quot;.CheckHash(HashURL($url)).&quot;&amp;amp;features=Rank&amp;amp;q=info:&quot;.$url.&quot;&amp;amp;num=100&amp;amp;filter=0 HTTP/1.1\r\n&quot;;
        $out .= &quot;Host: toolbarqueries.google.com\r\n&quot;;
        $out .= &quot;User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 2.0.114-big; Windows XP 5.1)\r\n&quot;;
        $out .= &quot;Connection: Close\r\n\r\n&quot;;
        fwrite($fp, $out);

        while (!feof($fp)) {
            $data = fgets($fp, 128);
            $pos = strpos($data, &quot;Rank_&quot;);
        if($pos === false){} else{
                $pagerank = substr($data, $pos + 9);
            }
        }
        fclose($fp);
        return (int)$pagerank;
    }
}&amp;nbsp;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;     &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/google-page-rank/&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;     &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/google-page-rank/php-pr-finder.zip&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/301504231604224213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/google-pagerank-script-php.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/301504231604224213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/301504231604224213'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/google-pagerank-script-php.html' title='Get Google Page through PHP for Multiple URL'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQEgrjTpbukXIf3_24bxqT2R7uNWUHc92ZENwBSVETWz98HuA6KnTbCNdJL9sKJIwmjxgVxFzRdCgT4RxsgmmEjPUpJx8oiV1uen2QokOQCioruZGYAb4R9WIK0_Ru0JQNILFtXjNY940/s72-c/google-pagerank-explained.gif" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-4317869741144570993</id><published>2013-03-07T03:46:00.000-08:00</published><updated>2013-03-07T03:46:39.086-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP Optimization"/><category scheme="http://www.blogger.com/atom/ns#" term="SEO Optimization"/><title type='text'>Fix External Broken links PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Adding External links may not guarantee to available all time, following code will check header response before redirect the user to that particular url using the following Code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php

$url = &quot;http://www.w3lessons.com&quot;;

$user_agent = 
&#39;Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0&#39;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_USERAGENT,$user_agent);
curl_setopt($ch, CURLOPT_REFERER, &quot;&quot;);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);


// Then, after your curl_exec call:
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
$body = substr($response, $header_size);
curl_close($ch);


echo &quot;&amp;lt;pre&amp;gt;&quot;;
print_r($header);

// Re
HTTP/1.1 200 OK
Server: Apache/2.2.3 (Red Hat)
Last-Modified: Tue, 03 Jul 2012 15:28:22 GMT
ETag: &quot;bc241f05-1aace1-4c3ee90929180&quot;
Accept-Ranges: bytes
Content-Length: 1748193
Content-Type: application/pdf
Date: Thu, 07 Mar 2013 11:36:42 GMT
Connection: keep-alive




?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Checking corresponding Content-Type before redirecting user help to improve user experience.&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;br /&gt;&lt;/td&gt;
    &lt;td&gt;&lt;br /&gt;&lt;/td&gt;
    &lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/4317869741144570993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2013/03/fix-external-broken-links-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/4317869741144570993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/4317869741144570993'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2013/03/fix-external-broken-links-php.html' title='Fix External Broken links PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-38272607127293996</id><published>2013-01-09T04:13:00.000-08:00</published><updated>2013-01-09T04:13:03.264-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="facebook connect"/><category scheme="http://www.blogger.com/atom/ns#" term="Facebook Login"/><category scheme="http://www.blogger.com/atom/ns#" term="Facebook login for website"/><category scheme="http://www.blogger.com/atom/ns#" term="Login with facebook"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP OAuth"/><title type='text'>Facebook login integration with website, Login with Facebook for websites</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEircLDBs4yw5dApnBG45gb3xOZKZiXLQ-VJEQ64lgMVwXoVqhQ8K1OpPjs-n_xmmig7pM7llrJH6W7Yjrd3wNhmYS-t2U8CdgH7z_Y1tlQYful1uqdHC2IGQLajTew-0hxIjZr-200SePY/s1600/login-with-facebook.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;136&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEircLDBs4yw5dApnBG45gb3xOZKZiXLQ-VJEQ64lgMVwXoVqhQ8K1OpPjs-n_xmmig7pM7llrJH6W7Yjrd3wNhmYS-t2U8CdgH7z_Y1tlQYful1uqdHC2IGQLajTew-0hxIjZr-200SePY/s320/login-with-facebook.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Facebook provide OAuth support provides web developers are able to create a Login or Sign In option with Existing Facebook Account without spending more time on new registration on your website.&lt;br /&gt;
Herewith we saw how to integrate in to your website using &amp;nbsp;&lt;b&gt;Login with Facebook &lt;/b&gt;Button in easy way.&lt;br /&gt;
&lt;br /&gt;
In Order to Create a &lt;b&gt;&quot;Login with Facebook&quot; &lt;/b&gt;for your website you need a Facebook account to generate APP_ID and APP_SECRET, Create a&amp;nbsp;Facebook&amp;nbsp;user account and Navigate to the App&amp;nbsp;Developer&amp;nbsp;Page&lt;br /&gt;
&lt;a href=&quot;http://www.facebook.com/developers/&quot;&gt;http://www.facebook.com/developers/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In Top right &amp;nbsp;press&amp;nbsp;&lt;b&gt;&quot;Create New App&quot; &lt;/b&gt;Button you will navigate to the following screen.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDl74tXqH_1K0yc4l6uAmnhoj_PwjNODaeqnv5C95WfDrxkSOrNnPRGy5nvpjhs-BkZQlNtiAmtW8Hx02uz2VV6hSAUw38dZFUID2fzGPlOKf4eP4I9aCeoD3tNL3xf8mDKsFFsYEhg3Y/s1600/Facebook-Create-New-App.jpg&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
In this App Creation Popup, tell your app Display Name on your Facebook Login Popup. and App Namespace is Unique&amp;nbsp;Identifier&amp;nbsp;on Facebook (all lowercase) Check I Agree and Continue. in next screen expand Website Rown from &quot;Select how your app Integrates with facebook&quot; Section.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;105&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3H7RKL8j6fc7Ik8gvVzvB5J0t3REM6q2pRcIe_XHbTc2kZxgw4ZhKZ5UGafFEZwZFFdSxsQVDyWqjCQ4aHqxsVmSRWxa-svIZb5XgnJEv_ZpSWoUhRlVxPGAL3jIQt-S7RzdNS1KUUr4/s640/integration_website_url.jpg&quot; width=&quot;640&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
put your website URL which actually place the &quot;Login with Facebook&quot; Button. eg: http://www.w3lessons.com/ or In case of Local testing you can put &lt;b&gt;http://localhost/facebooklogin/&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;press &quot;Save Changes&quot; on Bottom of that screen register your App on Facbook.&lt;br /&gt;
&lt;br /&gt;
Now Your App is Ready and you can create &lt;b&gt;&quot;Login with Facbook&quot; &lt;/b&gt;Button for your website.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1.&amp;nbsp;&lt;/b&gt;&lt;b&gt;PHP functions for Server Side handling to get Facebook data and store them to our database.&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;2.&amp;nbsp;&lt;/b&gt;&lt;b&gt;Create Login Button Using Facbook JavaScript SDK&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;3. Create Logout Button Using Facebook SDK&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;facebook-login.php &amp;nbsp;(full Source)&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php
session_start();
define(&#39;YOUR_APP_ID&#39;, &#39;YOUR_APP_KEY_HERE&#39;);
define(&#39;YOUR_APP_SECRET&#39;, &#39;YOUR_SECRET_KEY_HERE&#39;);

function get_facebook_cookie($app_id, $app_secret) { 
    $signed_request = parse_signed_request(@$_COOKIE[&#39;fbsr_&#39; . $app_id], $app_secret);
    // $signed_request should now have most of the old elements
    $signed_request[&#39;uid&#39;] = $signed_request[&#39;user_id&#39;]; // for compatibility 
    if (!is_null($signed_request)) {
        // the cookie is valid/signed correctly
        // lets change &quot;code&quot; into an &quot;access_token&quot;
  // openssl must enable on your server inorder to access HTTPS
        $access_token_response = file_get_contents(&quot;https://graph.facebook.com/oauth/access_token?client_id=$app_id&amp;amp;redirect_uri=&amp;amp;client_secret=$app_secret&amp;amp;code={$signed_request[&#39;code&#39;]}&quot;);
        parse_str($access_token_response);
        $signed_request[&#39;access_token&#39;] = $access_token;
        $signed_request[&#39;expires&#39;] = time() + $expires;
    }
    return $signed_request;
}

function parse_signed_request($signed_request, $secret) {
  list($encoded_sig, $payload) = explode(&#39;.&#39;, $signed_request, 2); 

  // decode the data
  $sig = base64_url_decode($encoded_sig);
  $data = json_decode(base64_url_decode($payload), true);

  if (strtoupper($data[&#39;algorithm&#39;]) !== &#39;HMAC-SHA256&#39;) {
    error_log(&#39;Unknown algorithm. Expected HMAC-SHA256&#39;);
    return null;
  }

  // check sig
  $expected_sig = hash_hmac(&#39;sha256&#39;, $payload, $secret, $raw = true);
  if ($sig !== $expected_sig) {
    error_log(&#39;Bad Signed JSON signature!&#39;);
    return null;
  }

  return $data;
}

function base64_url_decode($input) {
  return base64_decode(strtr($input, &#39;-_&#39;, &#39;+/&#39;));
}

if (isset($_COOKIE[&#39;fbsr_&#39; . YOUR_APP_ID]))
{ 
$cookie = get_facebook_cookie(YOUR_APP_ID, YOUR_APP_SECRET);

$user = json_decode(@file_get_contents(
    &#39;https://graph.facebook.com/me?access_token=&#39; .
    $cookie[&#39;access_token&#39;]));
 
/*
Uncomment this to show all available variables
echo &quot;&amp;lt;pre&amp;gt;&quot;;
 - print_r function expose all the values available to get from facebook login connect.
print_r($user);
 1. Save nessary values from $user Object to your Database
 2. Register a Sesion Variable based on your user account code
 3. Redirect to Account Dashboard
echo &quot;&amp;lt;/pre&amp;gt;&quot;;
*/
 
}
?&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Facebook Login Connect for Website Demo&amp;lt;/title&amp;gt;
&amp;lt;style type=&quot;text/css&quot;&amp;gt;
body,td,th {
 font-family: Verdana, Geneva, sans-serif;
 font-size: 14px;
 color: #333;
}
body {
 margin-left: 50px;
 margin-top: 50px;
}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;?php if (@$cookie) { ?&amp;gt;
&amp;lt;h2&amp;gt;Welcome &amp;lt;?= $user-&amp;gt;name ?&amp;gt; &amp;lt;/h2&amp;gt; &amp;lt;br /&amp;gt;
E-mail ID: &amp;lt;?= $user-&amp;gt;email ?&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;a href=&quot;javascript://&quot; onclick=&quot;FB.logout(function() { window.location=&#39;facebook-login.php&#39; }); return false;&quot; &amp;gt;Logout&amp;lt;/a&amp;gt;
&amp;lt;?php } else { ?&amp;gt;
&amp;lt;h2&amp;gt;Welcome Guest! &amp;lt;/h2&amp;gt;    
&amp;lt;div id=&quot;fb-root&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;fb:login-button perms=&quot;email&quot; width=&quot;width_value&quot; show_faces=&quot;true&quot; autologoutlink=&quot;true&quot; size=&quot;large&quot;&amp;gt;Login with Facebook&amp;lt;/fb:login-button&amp;gt;
&amp;lt;?php } ?&amp;gt;
&amp;lt;script src=&quot;http://connect.facebook.net/en_US/all.js&quot;&amp;gt;&amp;lt;/script&amp;gt;   
&amp;lt;script&amp;gt;
 // Initiate FB Object
 FB.init({
   appId: &#39;&amp;lt;?= YOUR_APP_ID ?&amp;gt;&#39;, 
   status: true,
   cookie: true, 
   xfbml: true
   });
 // Reloading after successfull login
 FB.Event.subscribe(&#39;auth.login&#39;, function(response) { 
 window.location.reload(); 
 });
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
If you have any problem feel free to comment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;     &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/facebook-connect-login/&quot; target=&quot;_blank&quot;&gt;Facebook Connect Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;     &lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/38272607127293996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/01/facebook-login-integration-with-website.html#comment-form' title='55 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/38272607127293996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/38272607127293996'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/01/facebook-login-integration-with-website.html' title='Facebook login integration with website, Login with Facebook for websites'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEircLDBs4yw5dApnBG45gb3xOZKZiXLQ-VJEQ64lgMVwXoVqhQ8K1OpPjs-n_xmmig7pM7llrJH6W7Yjrd3wNhmYS-t2U8CdgH7z_Y1tlQYful1uqdHC2IGQLajTew-0hxIjZr-200SePY/s72-c/login-with-facebook.jpg" height="72" width="72"/><thr:total>55</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-5639332118938341452</id><published>2012-11-22T23:55:00.000-08:00</published><updated>2012-11-22T23:55:26.872-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Development Ideas"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><title type='text'>Prevent your website opening in Iframe</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
One of our client,&amp;nbsp;don&#39;t&amp;nbsp;want to load their website inside an iframe any other website. In this case PHP provide an excellent header option to prevent or deny iframe opening of your web pages. In case you are in static html we can use&amp;nbsp;JavaScript&amp;nbsp;to redirect a actual page as browser URL on top.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;311&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqgHiJ1wyGffF0c4-5G_mDDpLLhhFlXBNtDHn7XzTrpW73qC9H7G8fYueAQayZY4KrRgkoBxIPpW4lve_kB-qdS_ZkfffaidaAB-b6kbv3dSuhkx4hwte4ceMf85ZtF4MWU7q1UbGRMYw/s400/prevent-iframe-load.jpg&quot; width=&quot;400&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
Google is example website for iframe blocking, you did not open&amp;nbsp;Google&amp;nbsp;website in iframe.&lt;/div&gt;
&lt;br /&gt;
PHP code to prevent iframe loading on dynamic php pages.&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php
// php header to prevent iframe loading of your web page
header(&quot;X-FRAME-OPTIONS: DENY&quot;);
?&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Example of prevent iframe loading in PHP pages&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(255, 0, 0); border-bottom-style: dashed; border-bottom-width: 2px; border-left-color: rgb(255, 0, 0); border-left-style: dashed; border-left-width: 2px; border-right-color: rgb(255, 0, 0); border-right-style: dashed; border-right-width: 2px; border-top-color: rgb(255, 0, 0); border-top-style: dashed; border-top-width: 2px; margin-bottom: 10px; margin-left: 10px; margin-right: 10px; margin-top: 10px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px;&quot;&gt;&lt;b&gt;&amp;lt;?php
header(&quot;X-FRAME-OPTIONS: DENY&quot;);
?&amp;gt;&lt;/b&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Iframe Blocker&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;h1&amp;gt;Welcome&amp;lt;/h1&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code to prevent loading iframe on Static HTML pages&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(255, 0, 0); border-bottom-style: dashed; border-bottom-width: 2px; border-left-color: rgb(255, 0, 0); border-left-style: dashed; border-left-width: 2px; border-right-color: rgb(255, 0, 0); border-right-style: dashed; border-right-width: 2px; border-top-color: rgb(255, 0, 0); border-top-style: dashed; border-top-width: 2px; margin-bottom: 10px; margin-left: 10px; margin-right: 10px; margin-top: 10px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px;&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;

// Prevent iframe loading of your web page and redirect to iframe target.
if( (self.parent &amp;amp;&amp;amp; !(self.parent===self))
    &amp;amp;&amp;amp;(self.parent.frames.length!=0)){
    self.parent.location=document.location
}
&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Example of prevent iframe loading in Static HTML pages&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(255, 0, 0); border-bottom-style: dashed; border-bottom-width: 2px; border-left-color: rgb(255, 0, 0); border-left-style: dashed; border-left-width: 2px; border-right-color: rgb(255, 0, 0); border-right-style: dashed; border-right-width: 2px; border-top-color: rgb(255, 0, 0); border-top-style: dashed; border-top-width: 2px; margin-bottom: 10px; margin-left: 10px; margin-right: 10px; margin-top: 10px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px;&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Iframe Blocker&amp;lt;/title&amp;gt;

&lt;b&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
if( (self.parent &amp;amp;&amp;amp; !(self.parent===self))
    &amp;amp;&amp;amp;(self.parent.frames.length!=0)){
    self.parent.location=document.location
}
&amp;lt;/script&amp;gt;&lt;/b&gt;

&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Welcome&amp;lt;/h1&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/5639332118938341452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2011/12/prevent-or-deny-opening-your-website-in.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5639332118938341452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5639332118938341452'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2011/12/prevent-or-deny-opening-your-website-in.html' title='Prevent your website opening in Iframe'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqgHiJ1wyGffF0c4-5G_mDDpLLhhFlXBNtDHn7XzTrpW73qC9H7G8fYueAQayZY4KrRgkoBxIPpW4lve_kB-qdS_ZkfffaidaAB-b6kbv3dSuhkx4hwte4ceMf85ZtF4MWU7q1UbGRMYw/s72-c/prevent-iframe-load.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-1569959876269214002</id><published>2012-10-30T00:49:00.001-07:00</published><updated>2012-10-30T00:57:27.487-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL Date Functions"/><title type='text'>MySQL select today and last 30 days records</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
If you need to select records from MySQL table records with date today and last 30 days records.&lt;br /&gt;
based on the Server date.&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
MySQL select today and last 30 days records&lt;/h4&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;SELECT * FROM posts WHERE 
date_of_create &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; CURDATE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; INTERVAL &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; DAY &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; CURDATE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;/code&gt;;
&lt;/pre&gt;
In case if your field data type were DATETIME format you need to convert 

your datetime format into date

 
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; DATE_FORMAT&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;date_of_create&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;%m/%d/%Y&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;) &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; posts
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;   &lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;date_of_create&lt;/span&gt;&lt;/code&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; CURDATE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; INTERVAL &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; DAY &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; CURDATE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;/code&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/1569959876269214002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/mysql-select-today-and-last-30-days.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/1569959876269214002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/1569959876269214002'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/mysql-select-today-and-last-30-days.html' title='MySQL select today and last 30 days records'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-7467072567466283619</id><published>2012-10-24T21:49:00.000-07:00</published><updated>2012-10-24T21:51:53.576-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL Date Functions"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Query Logics"/><title type='text'>MySQL Date Functions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Working with date in MySQL is very important for date based query processing. today we going to get some important MySQL date functions frequently  used in projects.&lt;br /&gt;
&lt;br /&gt;
Here is the date functions with example queries from Article table&amp;nbsp; have the column date_of_post&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
CURDATE() - Return the current date&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Example:&lt;/h4&gt;
SELECT * FROM articles WHERE date_of_post = CURDATE()&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
DAY() &amp;nbsp;&amp;nbsp;- Return day number from the date  column&lt;/h4&gt;
Example:&lt;br /&gt;
SELECT * FROM article WHERE DAY(date_of_post) = 1&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
MONTH() - Return Month number from the date column&lt;/h4&gt;
Example:&lt;br /&gt;
SELECT * FROM article WHERE MONTH(date_of_post) = 2&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
YEAR() – Return year number from the date column&lt;/h4&gt;
Example:&lt;br /&gt;
SELECT * FROM article WHERE MONTH(date_of_post) = 2011 &lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
LAST_DAY() -&amp;nbsp; Return Last date as number,  From the month of the date column&lt;/h4&gt;
Example:&lt;br /&gt;
SELECT * FROM article WHERE DAY(date_of_post) = LAST_DAY(date_of_post)&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
DAYNAME() - Return day name as string from the date column&lt;/h4&gt;
SELECT DAYNAME (date_of_post) AS `day_of_post` FROM article&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
MONTHNAME() - Return Month name as string from date column&lt;/h4&gt;
Example:&lt;br /&gt;
SELECT MONTHNAME(date_of_post) as `month_of_post` FROM article&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
QUARTER() - Return Quarter Number as 1 to 4 Format as number&lt;/h4&gt;
Example:&lt;br /&gt;
SELECT QUARTER(date_of_post) AS `post_quarter` FROM article&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
WEEK() - Return Week Number Number (0-53)&lt;/h4&gt;
Example:&lt;br /&gt;
SELECT WEEK(date_of_post) AS `week ` FROM article&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/7467072567466283619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/mysql-date-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/7467072567466283619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/7467072567466283619'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/mysql-date-functions.html' title='MySQL Date Functions'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-4935182629992853528</id><published>2012-10-20T00:01:00.000-07:00</published><updated>2012-10-20T00:12:13.739-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Get Contacts from Yahoo"/><category scheme="http://www.blogger.com/atom/ns#" term="Oauth Yahoo"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP OAuth"/><title type='text'>Get Yahoo contacts from address book</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Mr. Antony request me how to list all email ids from user&#39;s yahoo email account. here is the simple solution to get all Emails from user contact list in yahoo address book.&lt;br /&gt;
&lt;br /&gt;
In order to work with Yahoo Address book we need to create oauth Project on yahoo developer network. let us create it first.&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step: 1&lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Goto : &lt;a href=&quot;http://developer.yahoo.com/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://developer.yahoo.com/&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw2O6tf_ihIDnK8d2wX_wcCCh8hIuYyCrjMd0NQbjv7AN1k-7_FWkn-rJPZk-DG8GbfqjBn8g2hsJNsgYFMmqGM7fzU7qCCJOYbS0LiMe7DsivN5tf3gW7faFB6Y6I50QKUQ4LQqhuVgE/s1600/Step_001.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw2O6tf_ihIDnK8d2wX_wcCCh8hIuYyCrjMd0NQbjv7AN1k-7_FWkn-rJPZk-DG8GbfqjBn8g2hsJNsgYFMmqGM7fzU7qCCJOYbS0LiMe7DsivN5tf3gW7faFB6Y6I50QKUQ4LQqhuVgE/s1600/Step_001.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Select My Projects on Top Right below the search box. (You are ask to Login with existing yahoo account)&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step: 2&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtU0AWNoyNprEcIK6NCFW1ojT5nDhYB3kuWu-ZYLNjumc7wONI5HTTd7-bpbFLphXFEZQ84QLqHcacig5MsyXVdwtaLFeMOPqX2h7gNYze74uUrrqXyXxuwhi9DZVYTfPaqaP2lHC_0-I/s1600/Step_003_Create_key.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtU0AWNoyNprEcIK6NCFW1ojT5nDhYB3kuWu-ZYLNjumc7wONI5HTTd7-bpbFLphXFEZQ84QLqHcacig5MsyXVdwtaLFeMOPqX2h7gNYze74uUrrqXyXxuwhi9DZVYTfPaqaP2lHC_0-I/s1600/Step_003_Create_key.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;Click &lt;b&gt;New Project &lt;/b&gt;Button&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step 3:&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu4ksuEGb1EJR3cl5stolsQDyUA8b-4X0f7xBNo-ow5fSBSa6xhghwMtiOEVVxwFCYmaV-g71PvtEAVIeFTqd2zpcg0qIudcWvQasf8H-1hTYeLI6IaCQp3u3UTrK7AJa-UiN0Pq9daqQ/s1600/Step_004.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu4ksuEGb1EJR3cl5stolsQDyUA8b-4X0f7xBNo-ow5fSBSa6xhghwMtiOEVVxwFCYmaV-g71PvtEAVIeFTqd2zpcg0qIudcWvQasf8H-1hTYeLI6IaCQp3u3UTrK7AJa-UiN0Pq9daqQ/s1600/Step_004.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Select Application Type &quot;Standard&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step 4: ( Fill your Application as per the form below with your own values)&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgccC7JuptpzSMWN0K7y40jyYbdmMU7Q7Z7QKQCaWLbL6qj1T-ZDFSbUQJRGoBiF5AQDxtYnBdlzaqWfjGq8uYKYUfJGhDB3P42i__9z4ZUjHrX3XVFTNL1EW8-fra0vTxS8ghnkjN69zA/s1600/Step_006.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgccC7JuptpzSMWN0K7y40jyYbdmMU7Q7Z7QKQCaWLbL6qj1T-ZDFSbUQJRGoBiF5AQDxtYnBdlzaqWfjGq8uYKYUfJGhDB3P42i__9z4ZUjHrX3XVFTNL1EW8-fra0vTxS8ghnkjN69zA/s1600/Step_006.jpg&quot; /&gt;&lt;/a&gt; &lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step 5: (Get your Project Keys) &lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Application ID: below the Project Name&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Consumer Key and Consumer Secret Inside the Box&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrdW3W3XI4m0KVL3Rac3bk2c5srS8FPMhpZfPrhEC7-HCFppuSfdVJnT49YrNy-xbqpYtUMn3IVleXRMFZ5oZOzV7wsU80XmcdvjElPPdRqaTBcgZjBrk_4j_vKa0wM0Q1olWeDANfgrs/s1600/Step_007_key.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;249&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrdW3W3XI4m0KVL3Rac3bk2c5srS8FPMhpZfPrhEC7-HCFppuSfdVJnT49YrNy-xbqpYtUMn3IVleXRMFZ5oZOzV7wsU80XmcdvjElPPdRqaTBcgZjBrk_4j_vKa0wM0Q1olWeDANfgrs/s640/Step_007_key.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step 6: (Verify your Domain) &lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbV4Q7hwlCqPN3wzk4vR4ty7kDhuSR4qv8GwUd2P0VSlvYk6bS5LYEJl93-_j_zC16HoptfKz7mb8cTMYvAGT7_bQdjkDNAgYv5LjbrUYIeE6HvNLWicMfjWYxVUShBUpvZNnTahoQ5lA/s1600/Step_08_Verify_domain.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;230&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbV4Q7hwlCqPN3wzk4vR4ty7kDhuSR4qv8GwUd2P0VSlvYk6bS5LYEJl93-_j_zC16HoptfKz7mb8cTMYvAGT7_bQdjkDNAgYv5LjbrUYIeE6HvNLWicMfjWYxVUShBUpvZNnTahoQ5lA/s640/Step_08_Verify_domain.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Step: 7 (Download Yahoo PHP SDK -&amp;nbsp; Included in Demo Download)&lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Goto: &lt;a href=&quot;http://developer.yahoo.com/social/sdk/php/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://developer.yahoo.com/social/sdk/php/ &lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;index.php&lt;/b&gt; ( Show the Button labled &quot;Get Yahoo Contacts&quot;)&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;p align=&quot;center&quot;&amp;gt;&amp;lt;br /&amp;gt;

&amp;lt;a href=&quot;getContact.php&quot; style=&quot;background:#939; color:#FFF; 
padding:10px; font-family:&#39;Trebuchet MS&#39;, Arial, Helvetica, sans-serif; 
text-decoration:none; font-size:14px; font-style:italic; margin-top:50px; 
text-align:center;&quot;&amp;gt;Get Yahoo Contacts&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;getContacts.php&lt;br /&gt;&lt;br /&gt;Get List of contacts using YQL after user access&lt;/b&gt;http://developer.yahoo.com/social/rest_api_guide/contacts_table.html&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php session_start();

error_reporting(0);

// Replace your Own KEYS 

require(&quot;lib/Yahoo.inc&quot;);
// Your Consumer Key (API Key) goes here.
define(&#39;OAUTH_CONSUMER_KEY&#39;, &quot;j0yJmk9M1Zzc0F3YURkV3AwJmQ9WVdrOU5tMVRhSFJETjJNbWNHbzlNVEUxTXpRek9UUTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0wMg--&quot;);
// Your Consumer Secret goes here.
define(&#39;OAUTH_CONSUMER_SECRET&#39;, &quot;febded04011a8e6e2f1227b9e24688f2252587a&quot;);
// Your application ID goes here.
define(&#39;OAUTH_APP_ID&#39;, &quot;mShtC7c&quot;);
// Call back URL
define(&#39;CALL_BACK_URL&#39;,&#39;http://demos.w3lessons.com/yahoo-contact/getContact.php&#39;);

/*
    Consumer Key:
    Consumer Secret:
    Application URL:
    App Domain:

   dj0yJmk9M1Zzc0F3YURkV3AwJmQ9WVdrOU5tMVRhSFJETjJNbWNHbzlNVEUxTXpRek9UUTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0wMg--
    afebded04011a8e6e2f1227b9e24688f2252587a
    http://demos.w3lessons.com/yahoo-contact/index.php
    demos.w3lessons.com
 
*/ 

$session = YahooSession::requireSession(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, OAUTH_APP_ID);   

$user = $session-&amp;gt;getOwner();

$query = sprintf(&quot;select * from social.contacts where guid=me;&quot;);  
$response = $session-&amp;gt;query($query); 



if(isset($response)){

   foreach($response-&amp;gt;query-&amp;gt;results-&amp;gt;contact as $id){

       foreach($id-&amp;gt;fields as $subid){

               if( $subid-&amp;gt;type == &#39;email&#39; )
               $emails[] = $subid-&amp;gt;value;
       }
   }
}

$session-&amp;gt;clearSession();

echo &quot;&amp;lt;pre&amp;gt;&quot;;
print_r($emails);
?&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;a href=&quot;index.php&quot;&amp;gt;Back&amp;lt;/a&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/yahoo-contact/&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/yahoo-contact/yahoo-contacts.zip&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/4935182629992853528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/get-yahoo-contacts-from-address-book.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/4935182629992853528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/4935182629992853528'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/get-yahoo-contacts-from-address-book.html' title='Get Yahoo contacts from address book'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw2O6tf_ihIDnK8d2wX_wcCCh8hIuYyCrjMd0NQbjv7AN1k-7_FWkn-rJPZk-DG8GbfqjBn8g2hsJNsgYFMmqGM7fzU7qCCJOYbS0LiMe7DsivN5tf3gW7faFB6Y6I50QKUQ4LQqhuVgE/s72-c/Step_001.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-9019750437750624712</id><published>2012-10-12T23:30:00.001-07:00</published><updated>2012-10-12T23:30:34.183-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="htaccess"/><category scheme="http://www.blogger.com/atom/ns#" term="HTTP Request"/><category scheme="http://www.blogger.com/atom/ns#" term="On-Page SEO"/><category scheme="http://www.blogger.com/atom/ns#" term="Website Optimization"/><title type='text'>Change of Domain 301 Redirect htaccess</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEistmE59Ssok1C04D7aIJLuZZkmC2YBstSx6SOT2AWf4nZr-8eNnKImjlPdShXP2snkTU72d4rSmObXF0eI8zbAmBbEH32pBA4HBEUvUaDdIn_LWS383STOFJ26TzK8dw1ngbfOvgk60EQ/s1600/change-of-address-301.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEistmE59Ssok1C04D7aIJLuZZkmC2YBstSx6SOT2AWf4nZr-8eNnKImjlPdShXP2snkTU72d4rSmObXF0eI8zbAmBbEH32pBA4HBEUvUaDdIn_LWS383STOFJ26TzK8dw1ngbfOvgk60EQ/s1600/change-of-address-301.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
For SEO best practices, when you change domain name of existing website, we need to setup 301 redirect of all existing web pages exactly to a new domain name. This is very important for Search engines detect a new version of URLs&lt;br /&gt;
&lt;br /&gt;
Using the following htaccess code we will redirect all the existing pages of our website to new. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;RewriteEngine On
# Redirect all urls with new domain name
RewriteCond %{HTTP_HOST} ^domainone.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domainone.com$
RewriteRule ^(.*)$ http://www.domaintwo.com/$1 [r=301,nc]

# Redirect with www of new domain.
RewriteCond %{http_host} ^domaintwo.com [nc]
RewriteRule ^(.*)$ http://www.domaintwo.com/$1 [r=301,nc]
&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;about code will redirect all the existing pages of current website to new website with same request URL.&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/9019750437750624712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/change-of-domain-301-redirect-htaccess.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/9019750437750624712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/9019750437750624712'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/change-of-domain-301-redirect-htaccess.html' title='Change of Domain 301 Redirect htaccess'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEistmE59Ssok1C04D7aIJLuZZkmC2YBstSx6SOT2AWf4nZr-8eNnKImjlPdShXP2snkTU72d4rSmObXF0eI8zbAmBbEH32pBA4HBEUvUaDdIn_LWS383STOFJ26TzK8dw1ngbfOvgk60EQ/s72-c/change-of-address-301.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-8273670122155454981</id><published>2012-10-11T22:14:00.000-07:00</published><updated>2012-10-11T22:19:19.520-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Image"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Optimization"/><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression"/><category scheme="http://www.blogger.com/atom/ns#" term="Website Optimization"/><title type='text'>Protect email address in web content.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
While building web content we may need to include email address. In this case spam bots are may access our web page and collect email address inside our web content. based on this &lt;a href=&quot;http://www.w3lessons.com/2012/10/extract-email-id-from-content-php.html&quot;&gt;email address extracting script.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The only way to protect Email address inside the content is convert all email address into image.&lt;br /&gt;
&lt;br /&gt;
Here is the solution to convert email address into dynamic text images&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuB9UtiOLXd8TYma-XON-IUdj_bnXtRkJ18kTB9ywhUnhYveHETvxi7WC8VZ_EMmUqAcUzNnkAo2xjKvSM6jy-gvXEDugZAuz5B75NmvacXfKB2Bsc2F6hw_Jy5A0hdY9murysPSXz1XQ/s1600/emai_addressl_to_image.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuB9UtiOLXd8TYma-XON-IUdj_bnXtRkJ18kTB9ywhUnhYveHETvxi7WC8VZ_EMmUqAcUzNnkAo2xjKvSM6jy-gvXEDugZAuz5B75NmvacXfKB2Bsc2F6hw_Jy5A0hdY9murysPSXz1XQ/s1600/emai_addressl_to_image.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
email-to-image.php &lt;/h4&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php

define(&quot;F_SIZE&quot;, 10);
define(&quot;F_ANGLE&quot;, 0);
define(&quot;F_FONT&quot;, &quot;verdana.ttf&quot;);

$text = base64_decode(base64_decode($_GET[&#39;id&#39;]));

$Leading=0;
$W=0;
$H=0;
$X=0;
$Y=0;
$_bx = imagettfbbox(F_SIZE, F_ANGLE, F_FONT, $text);
$s = preg_split(&quot;/\n]+/&quot;, $text);  // Array of lines
$nL = count($s);  // Number of lines

$W = ($W==0)?abs($_bx[2]-$_bx[0]):$W;
$H = ($H==0)?abs($_bx[5]-$_bx[3])+2+($nL&amp;gt;1?($nL*$Leading):0):$H;

$img = @imagecreate($W+8, $H) or die(&quot;Cannot Initialize new GD image stream&quot;);

$white = imagecolorallocate($img, 255,255,255);
$txtColor = imagecolorallocate($img, 255,50,0);

// Adjust padding right:
$W+=8;
$bgwhite = imagecolorallocatealpha($img,238,238,238,0);
imagefilledrectangle($img, 0, 0,$W,$H, $bgwhite);

$alpha = &quot;&quot;.range(&quot;a&quot;, &quot;z&quot;);
$alpha = $alpha.strtoupper($alpha).range(0, 9);

// Use the string to determine the height of a line
$_b = imageTTFBbox(F_SIZE, F_ANGLE, F_FONT, $alpha);
$_H = abs($_b[5]-$_b[3]);
$__H = 0;

// Use the string to determine the width of a line
$_b = imagettfbbox(F_SIZE, F_ANGLE, F_FONT, $text);
$_W = abs($_b[2]-$_b[0]);

// Final width and height
$_X = abs($W/2)-abs($_W/2);
$__H += $_H;

imagettftext($img, F_SIZE, F_ANGLE, $_X, $__H, $txtColor, F_FONT, $text);

header(&quot;Content-Type: image/png&quot;);
imagepng($img);
imagedestroy($img);
// END EMAIL IMAGE  
exit();
?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
index.php &lt;/h4&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php
if(isset($_POST[&#39;content&#39;]))
{
$content=$_POST[&#39;content&#39;];
// Keep line breaks inside textarea
$content=preg_replace(&quot;/[\n]/&quot;, &#39;&amp;lt;br /&amp;gt;&#39;, $content);
// Find All email ids inside content
preg_match_all(&#39;/([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})/&#39;,$content,$emails);

// Replace as image every email address
foreach($emails[0] as $email)
$content=str_replace($email,&#39;&amp;lt;img src=&quot;email-to-image.php?id=&#39;.base64_encode(base64_encode($email)).&#39;&quot;&amp;gt;&#39;,$content);
}
?&amp;gt;
&amp;lt;!DOCTYPE&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Untitled Document&amp;lt;/title&amp;gt;
&amp;lt;style type=&quot;text/css&quot;&amp;gt;
body,td,th {
 font-family: Verdana, Geneva, sans-serif;
 font-size: 12px;
 color: #000;
}
body {
 margin-left: 5px;
 margin-top: 5px;
 margin-right: 5px;
 margin-bottom: 5px;
 margin:0 auto;
 width:750px;
}

textarea { width:750px; font-size:15px; font-family:Verdana, Geneva, sans-serif;}

#content
{
 font-size:13px;
 padding:10px;
 background:#EEE;
 border:1px solid #CCC; 
}

#content img
{

 position:relative;
 margin-bottom:-3px;
}

&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;br&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;h1&amp;gt;Protect Email Address inside web content&amp;lt;/h1&amp;gt;
&amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
&amp;lt;textarea cols=&quot;70&quot; rows=&quot;10&quot; name=&quot;content&quot;&amp;gt;
content mixed with any email address. that email address text will be converted into as image. for example we have info@example.com mail in this text area it will be return as image after the compilation. any no of occurrence will automatically replaced as image 

For Example:
Contact
admin@example.com

Technical
tech@example.com
&amp;lt;/textarea&amp;gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;

&amp;lt;input type=&quot;submit&quot; value=&quot;Compile&quot; name=&quot;submit&quot; /&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;

&amp;lt;/form&amp;gt;

&amp;lt;div id=&quot;content&quot;&amp;gt;
&amp;lt;?php echo @$content; ?&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/email-to-image/email-to-image.zip&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/subscribe/index.php?sid=fba9d88164f3e2d9109ee770223212a0&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/8273670122155454981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/protect-email-address-in-web-content.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/8273670122155454981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/8273670122155454981'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/protect-email-address-in-web-content.html' title='Protect email address in web content.'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuB9UtiOLXd8TYma-XON-IUdj_bnXtRkJ18kTB9ywhUnhYveHETvxi7WC8VZ_EMmUqAcUzNnkAo2xjKvSM6jy-gvXEDugZAuz5B75NmvacXfKB2Bsc2F6hw_Jy5A0hdY9murysPSXz1XQ/s72-c/emai_addressl_to_image.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-5003640308711412651</id><published>2012-10-10T21:17:00.003-07:00</published><updated>2012-10-10T21:17:28.857-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression"/><category scheme="http://www.blogger.com/atom/ns#" term="Website Optimization"/><title type='text'>Extract Email ID from Content PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
In many, CMS development, We may often to check whether any email was found inside the content in this case. Here is the best solution to extract email ids from content using the power of regular expression.&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Regular Expression to extract Email IDs from Content.&lt;/h4&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&#39;/([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})/&#39;&lt;/pre&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
PHP function to extract All Regular Expression Matches&lt;/h4&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&lt;a href=&quot;http://us.php.net/preg_match_all&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;preg_match_all&lt;/a&gt;(&#39;/([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})/&#39;,$content,$output);&lt;/pre&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Sample Content.txt with email id mixed html&lt;/h4&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;p&amp;gt;example for extracting email id &amp;lt;b&amp;gt;example@gmail.com&amp;lt;/b&amp;gt; 
from entire content it mean how many &amp;lt;b&amp;gt;email@example.com&amp;lt;/b&amp;gt; 
&amp;lt;b&amp;gt;admin.connnect@example.com&amp;lt;/b&amp;gt;&amp;lt;/p&lt;/pre&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php

//Extract Email ID from content.txt

$whois = file_get_contents(&quot;content.txt&quot;);
preg_match_all(&#39;/([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})/&#39;,$whois,$emails);


echo &quot;&amp;lt;pre&amp;gt;&quot;;
print_r($emails[0]);

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Output&lt;/h4&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;// OUTPUT


Array
(
    [0] =&amp;gt; example@gmail.com
    [1] =&amp;gt; email@example.com
    [2] =&amp;gt; admin.connnect@example.com
)&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/5003640308711412651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/extract-email-id-from-content-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5003640308711412651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5003640308711412651'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/extract-email-id-from-content-php.html' title='Extract Email ID from Content PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-9041270979320462610</id><published>2012-10-09T21:29:00.000-07:00</published><updated>2012-10-09T21:29:30.130-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Functions"/><category scheme="http://www.blogger.com/atom/ns#" term="Website Optimization"/><title type='text'>Optimize All MySQL Tables PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
If you looking for optimizing MySQL database tables from PHP dynamically, here is a solution to optimize entire tables a database. &lt;br /&gt;&lt;br /&gt;Optimizing Tables we need to get Entire table list using &quot;SHOW TABLES&quot; query. as this return entire table names as record, after getting executed of this command call OPTIMIZE TABLE and REPAIR TABLE as per the table needs.&lt;br /&gt;&lt;br /&gt;Primary Optimization will failed if the table been damage or corrupt. we will apply REPAIR TABLE&lt;br /&gt;&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php

mysql_connect(&quot;localhost&quot;,&quot;root&quot;,&quot;&quot;);
mysql_select_db(&quot;your_db_name&quot;);


echo &quot;&amp;lt;br /&amp;gt; OPTIMIZING TABLES &quot;;

$alltables = mysql_query(&quot;SHOW TABLES&quot;);

// Process all tables.
while ($table = mysql_fetch_assoc($alltables))
{
 foreach ($table as $db =&amp;gt; $tablename)
 {
 // Optimize them!
 if(mysql_query(&quot;OPTIMIZE TABLE &quot;.$tablename))
  echo &quot;&amp;lt;br&amp;gt;OK Optimized : &quot;.$tablename;
 else
 {
  echo &quot;&amp;lt;br&amp;gt;Error Optimizing Applying Reapir... &quot;.$tablename;
  // Apply Reapirt if Optimization Failed;
  if(mysql_query(&quot;REPAIR TABLE &quot;.$tablename))
  echo &quot;Repaired !&quot;;
  else
  echo &quot;Error Repairing Table!&quot;;
 }
 }
}
mysql_close();
?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/9041270979320462610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/10/optimize-all-mysql-tables-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/9041270979320462610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/9041270979320462610'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/10/optimize-all-mysql-tables-php.html' title='Optimize All MySQL Tables PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-5342238531856156506</id><published>2012-09-28T03:17:00.000-07:00</published><updated>2012-09-28T03:22:50.894-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Converters"/><category scheme="http://www.blogger.com/atom/ns#" term="Development Ideas"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Array"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Custom Functions"/><title type='text'>PHP Currency Converter with Google Currency Converter API</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi79l9JAEYs5c6RZBOI2j8FY2aYNIBfIs7otEEepzmpUAborTCO0Wea7gio_O21GbRWPrYmkYO1Hx_iP2cO8ojFt6sIxjDLK5loLexmSswmjB-g3ZF3d1YmW-zbGZQeZgQL-drvMCaBVlI/s1600/easy-currency-converter.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi79l9JAEYs5c6RZBOI2j8FY2aYNIBfIs7otEEepzmpUAborTCO0Wea7gio_O21GbRWPrYmkYO1Hx_iP2cO8ojFt6sIxjDLK5loLexmSswmjB-g3ZF3d1YmW-zbGZQeZgQL-drvMCaBVlI/s1600/easy-currency-converter.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Are you looking for a reliable PHP Currency Converter, here is Google give you a solution from their open Google Currency Converter API&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;How this API Works:&lt;/b&gt;&lt;/h4&gt;
&lt;br /&gt;
This PHP Currency Converter work with following URL call back.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Querying Converter API from PHP function as per following URL:&lt;/h4&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;q=1USD=?INR&lt;/span&gt;&lt;/b&gt;

http://www.google.com/ig/calculator?q=1USD=?INR&lt;/pre&gt;
&lt;br /&gt;
Based on Google Currency Converter API, I build an PHP Function to get Currency values from the out put of &lt;a href=&quot;http://www.google.com/ig/calculator?hl=en&amp;amp;q=1USD=?INR&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.google.com/ig/calculator?hl=en&amp;amp;q=1USD=?INR&lt;/a&gt;. as PHP Array&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;function google_currency_converter($amount,$to,$from=&quot;INR&quot;)
{
 $content = file_get_contents(&quot;http://www.google.com/ig/calculator?hl=en&amp;amp;q=$amount.&quot;.&quot;$from=?$to&quot;); 
 // Remove Spaces on API Output
 $content = preg_replace(&#39;/[^A-Za-z0-9.]+/&#39;,&#39;&#39;,$content);
 // Match All Currency values 0-9 and .(decimal)
 preg_match_all(&#39;/([0-9.]+)/&#39;, $content, $m);
 
 // Convert values with 3 decimal points
 $currency[$from] = sprintf(&quot;%.3f&quot;,$m[0][0]);
 $currency[$to] = sprintf(&quot;%.3f&quot;,$m[0][1]);
 
 return $currency;
}


$c = google_currency_converter(2800,&quot;USD&quot;);

echo &quot;INR:&quot;.$c[&#39;INR&#39;];
echo &quot;&amp;lt;br /&amp;gt;&quot;;
echo &quot;USD:&quot;.$c[&#39;USD&#39;];
&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/5342238531856156506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/google-currency-converter-api-php.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5342238531856156506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5342238531856156506'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/google-currency-converter-api-php.html' title='PHP Currency Converter with Google Currency Converter API'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi79l9JAEYs5c6RZBOI2j8FY2aYNIBfIs7otEEepzmpUAborTCO0Wea7gio_O21GbRWPrYmkYO1Hx_iP2cO8ojFt6sIxjDLK5loLexmSswmjB-g3ZF3d1YmW-zbGZQeZgQL-drvMCaBVlI/s72-c/easy-currency-converter.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-6390820374094752682</id><published>2012-09-27T05:43:00.000-07:00</published><updated>2012-09-27T05:43:13.276-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Login with Gmail Account"/><category scheme="http://www.blogger.com/atom/ns#" term="Login with Google Account"/><category scheme="http://www.blogger.com/atom/ns#" term="Login with Yahoo Account"/><title type='text'>Website Login with Google Account, Yahoo Account</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Make your registration process easily with Google Account OAuth integration along with yahoo.&lt;br /&gt;
Website registration and&amp;nbsp;Login&amp;nbsp;forms have important aspect of our development process. Currently visitors were not interested to fill large forms in any website. In this case visitors are not willing to join by signup on our website. In this aspect, technology will a solution. that is open social login from other major services. By this way, we can be use&amp;nbsp;Login&amp;nbsp;from google, yahoo, facebook, twitter.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHYMYk9g3HtnvgCrh7mWSL0ownLESlyOK4yHwX_ee_Cgne5Fu6v0kL7GtfSCdJG-AjvIZGiEKOFPJWMa48GB9gN_qmn5knKVQ7hY4NELxQUkyBLx6jhY9TRgK4RmZLUhn7B3NO1O567b0/s1600/Google_Yahoo_Login_with_OAuth.jpg&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
First, Let us create a open login for our website login or registration form with Google Account and Yahoo Mail. upcoming days we will see other services. Now we can create website&amp;nbsp;Login&amp;nbsp;with OpenID OAuth Login with Google Accounts and Yahoo Accounts.&lt;br /&gt;
&lt;br /&gt;
let us create How to make people login into your website with their Google account and Yahoo&lt;br /&gt;
Google and Yahoo provides Federated Login for Account Users with OAuth.&lt;br /&gt;&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(255, 0, 0); border-bottom-style: dashed; border-bottom-width: 2px; border-left-color: rgb(255, 0, 0); border-left-style: dashed; border-left-width: 2px; border-right-color: rgb(255, 0, 0); border-right-style: dashed; border-right-width: 2px; border-top-color: rgb(255, 0, 0); border-top-style: dashed; border-top-width: 2px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&lt;b&gt;UPDATE:&lt;/b&gt;
YAHOO OpenID Identify URL has been changed:
&lt;b&gt;http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds&lt;/b&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step: 1&lt;/b&gt;&lt;br /&gt;
Download LightOpenID Class from&lt;br /&gt;
https://nodeload.github.com/brice/LightOpenId/zipball/master&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step: 2: Write a Following Code and design a Form to Handle Login&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(255, 0, 0); border-bottom-style: dashed; border-bottom-width: 2px; border-left-color: rgb(255, 0, 0); border-left-style: dashed; border-left-width: 2px; border-right-color: rgb(255, 0, 0); border-right-style: dashed; border-right-width: 2px; border-top-color: rgb(255, 0, 0); border-top-style: dashed; border-top-width: 2px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;&quot;&gt;&amp;lt;?php session_start();
# Logging in with Google accounts requires setting special identity, so this example shows how to do it.
require &#39;require/openid.php&#39;;

try {
    # Change &#39;localhost&#39; to your domain name.
    $openid = new LightOpenID(&#39;demos.w3lessons.com&#39;);
 
  $openid-&amp;gt;required = array(
  &#39;namePerson&#39;,
  &#39;namePerson/first&#39;,
  &#39;namePerson/last&#39;,
  &#39;contact/email&#39;,
  );

    if(!$openid-&amp;gt;mode) {
  
 if(@$_GET[&#39;auth&#39;]==&quot;google&quot;)
    {
  $_SESSION[&#39;auth&#39;]=&quot;Google&quot;;
        $openid-&amp;gt;identity = &#39;https://www.google.com/accounts/o8/id&#39;;
        header(&#39;Location: &#39; . $openid-&amp;gt;authUrl());
 }elseif(@$_GET[&#39;auth&#39;]==&quot;yahoo&quot;)
 {
  $_SESSION[&#39;auth&#39;]=&quot;Yahoo&quot;;
  $openid-&amp;gt;identity =&#39;http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds&#39;;
  header(&quot;Location:&quot;.$openid-&amp;gt;authUrl());
 }

    } elseif($openid-&amp;gt;mode == &#39;cancel&#39;) {
        echo &#39;User has canceled authentication!&#39;;
    } else {
   $external_login=$openid-&amp;gt;getAttributes();
   $_SESSION[&#39;name&#39;]=$external_login[&#39;namePerson/first&#39;].&quot; &quot;.$external_login[&#39;namePerson/last&#39;];
   $_SESSION[&#39;email&#39;]=$external_login[&#39;contact/email&#39;];
   header(&quot;Location:account-home.php&quot;);
   exit();
   
    }
} catch(ErrorException $e) {
    echo $e-&amp;gt;getMessage();
}
?&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/open-id-with-google-yahoo/&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/open-id-with-google-yahoo/open-id-with-google-yahoo.zip&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/6390820374094752682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2011/11/website-login-with-google-account-yahoo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/6390820374094752682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/6390820374094752682'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2011/11/website-login-with-google-account-yahoo.html' title='Website Login with Google Account, Yahoo Account'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHYMYk9g3HtnvgCrh7mWSL0ownLESlyOK4yHwX_ee_Cgne5Fu6v0kL7GtfSCdJG-AjvIZGiEKOFPJWMa48GB9gN_qmn5knKVQ7hY4NELxQUkyBLx6jhY9TRgK4RmZLUhn7B3NO1O567b0/s72-c/Google_Yahoo_Login_with_OAuth.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-2934516605386761772</id><published>2012-09-27T05:27:00.002-07:00</published><updated>2012-09-27T05:27:14.601-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Development Ideas"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Upload"/><title type='text'>Get MIME type</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
If you looking for a solution to find the File Content-Type or MIME Type.&lt;br /&gt;Detecting MIME Type of each file extension is necessary to build dynamic file processing in PHP&lt;br /&gt;&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;Example:

// In the following code &lt;b&gt;image/png&lt;/b&gt; is MIME type which is assigned dynamically
header(&quot;Content-Type:image/png&quot;); 
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
We can get MIME Type using the following simple php code&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzCTT7vnS7ZebTswt4eHl6u0hl8An7Cqal_yV1Z6n0m7OUOSKmHQVQCtKhrtvHc0ZEbHJr8dVJvRQncflkvTBWkTMFtkPYCF-_R4o3TzIQOMI4aEPbOv1hxJR0ahlfXGNtoaAMg95QS3o/s1600/get-mime-type.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzCTT7vnS7ZebTswt4eHl6u0hl8An7Cqal_yV1Z6n0m7OUOSKmHQVQCtKhrtvHc0ZEbHJr8dVJvRQncflkvTBWkTMFtkPYCF-_R4o3TzIQOMI4aEPbOv1hxJR0ahlfXGNtoaAMg95QS3o/s1600/get-mime-type.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Here is the best solution to find the Exact MIME Type of the file using the following simple upload form.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php
session_start();

if(isset($_POST[&#39;upload&#39;]))
{
 $mime_type =  $_FILES[&#39;upload_file&#39;][&#39;type&#39;];
 $_SESSION[&#39;mime_type&#39;][] = $mime_type;
}

?&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Upload and Resize Image&amp;lt;/title&amp;gt;
&amp;lt;style type=&quot;text/css&quot;&amp;gt;
body,td,th {
 font-size: 14px;
 font-family: Verdana, Geneva, sans-serif;
}
body {
 margin-left: 10px;
 margin-right: 10px;
}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;
    &amp;lt;fieldset&amp;gt;
    &amp;lt;legend&amp;gt;Upload File in PHP&amp;lt;/legend&amp;gt;
    
        &amp;lt;input name=&quot;upload_file&quot; type=&quot;file&quot; id=&quot;upload_file&quot; /&amp;gt;
        
        &amp;lt;input name=&quot;upload&quot; type=&quot;submit&quot; id=&quot;upload&quot; value=&quot;Upload&quot; /&amp;gt;
        
    &amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;div style=&quot;padding:10px;&quot;&amp;gt;
Uploaded File MIME Type is : &amp;lt;br /&amp;gt;
&amp;lt;pre&amp;gt;
&amp;lt;?php 
if(is_array(@$_SESSION[&#39;mime_type&#39;]))
foreach($_SESSION[&#39;mime_type&#39;] as $type)
echo @$type.&quot;\n&quot;; ?&amp;gt;
&amp;lt;/pre&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/get-mime-type/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp; &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/2934516605386761772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/get-mime-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/2934516605386761772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/2934516605386761772'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/get-mime-type.html' title='Get MIME type'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzCTT7vnS7ZebTswt4eHl6u0hl8An7Cqal_yV1Z6n0m7OUOSKmHQVQCtKhrtvHc0ZEbHJr8dVJvRQncflkvTBWkTMFtkPYCF-_R4o3TzIQOMI4aEPbOv1hxJR0ahlfXGNtoaAMg95QS3o/s72-c/get-mime-type.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-2538821158614856413</id><published>2012-09-27T04:52:00.000-07:00</published><updated>2012-09-27T04:52:43.972-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP Image"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Image Upload"/><category scheme="http://www.blogger.com/atom/ns#" term="Resize Image"/><title type='text'>Resize Image when upload PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Upload and Resize Image dynamically. when upload a image file in PHP is very use full to manage images on web development.&lt;br /&gt;here is my solution how to &lt;b&gt;upload image after resize&lt;/b&gt;&amp;nbsp; uploaded image in PHP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3V8gUjXlaT3TamQNopqVtsEjvdzBoc0fzeNV2fz3ryRSyAdtOvhrY_BpF9jDkLDeRlEs8J4unxT8qr8v1t6CqgfTlHpNU-hTzjAT63rnW1a2XXQOL5CHtwBdrxLfsrBQyLyr9UPvI0vI/s1600/upload-and-resize-php.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Upload Rezied Image on Server&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3V8gUjXlaT3TamQNopqVtsEjvdzBoc0fzeNV2fz3ryRSyAdtOvhrY_BpF9jDkLDeRlEs8J4unxT8qr8v1t6CqgfTlHpNU-hTzjAT63rnW1a2XXQOL5CHtwBdrxLfsrBQyLyr9UPvI0vI/s1600/upload-and-resize-php.jpg&quot; title=&quot;Upload Rezied Image on Server&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;Upload and Resize Image PHP&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Upload-Resize.php (full Source)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php

if(isset($_POST[&#39;upload_image&#39;]))
{
 
 // Check Valid Image 
 if(preg_match(&quot;/(jpg)|(png)|(gif)/i&quot;,$_FILES[&#39;image_file&#39;][&#39;name&#39;]))
 {
   
 // Load uploaded image from $_FILES
 // encode type in form need to set | encode=&quot;multipart/form-data&quot; |
 $filename = $_FILES[&#39;image_file&#39;][&#39;tmp_name&#39;];
 
 // Prepare target image name with path on server appending with timestamp
 $target_file_name = &quot;Image&quot;.time();
 $target_file_name = &quot;images/$target_file_name&quot;;  
 
 $image_info = getimagesize($filename);
 $image_type = $image_info[2];


  
  if( $image_type == IMAGETYPE_JPEG ) {
   $image = imagecreatefromjpeg($filename);
   $target_file_name.=&quot;.jpg&quot;; // append file extention based on image type;
  } elseif( $image_type == IMAGETYPE_GIF ) {
   $image = imagecreatefromgif($filename);
   $target_file_name.=&quot;.gif&quot;;  
  } elseif( $image_type == IMAGETYPE_PNG ) {
   $target_file_name.=&quot;.png&quot;;  
   $image = imagecreatefrompng($filename);
  }
  
  // get width height of upload image file
  $height = imagesy($image);
  $width = imagesx($image);
 
  // SET THE SIZE OF TARGET IMAGE i use 250 x 250
  $target_width = 250;
  $target_height = 250;
  // Create a Empty Image Canvas
  $new_image = imagecreatetruecolor($target_width,$target_height);
  imagealphablending($new_image, true);
  imagesavealpha($new_image, true);
  
  // Set Canvas Background Color / Transparent as per your requirement
  // I prefer to go with Transparent
  
  // Make canvas Filled Background Color
  $white = imagecolorallocate($new_image, 255, 255, 255);
  $grey = imagecolorallocate($new_image, 128, 128, 128);
  $black = imagecolorallocate($new_image, 0, 0, 0);
  imagefilledrectangle($new_image, 0, 0, $target_width,$target_height, $grey); 
  
  // Make Canvas Transparent
  $trans_colour = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
  imagefill($new_image, 0, 0, $trans_colour);
 
  // Copy Source Image to Canvas
  imagecopyresampled($new_image, $image, 0, 0, 0, 0, $target_width,$target_height,$width, $height);
  $image = $new_image;
  

  
  // Save image based on file type;
  if( $image_type == IMAGETYPE_JPEG ) {
   imagejpeg($image,$filename,100);
  } elseif( $image_type == IMAGETYPE_GIF ) {
   imagegif($image,$target_file_name);         
  } elseif( $image_type == IMAGETYPE_PNG ) {
   imagepng($image,$target_file_name);
  }   
   chmod($target_file_name,777);
  
  $response = &#39;&amp;lt;span style=&quot;color:#060&quot;&amp;gt;Image Successfully Uploaded!&amp;lt;/span&amp;gt;&#39;;
 }else
 {
  $response = &#39;&amp;lt;span style=&quot;color:#FF0000;&quot;&amp;gt;Select a Valid (JPG,GIF,PNG) Images&amp;lt;/span&amp;gt;&#39;;
 }
}

?&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Upload and Resize Image&amp;lt;/title&amp;gt;
&amp;lt;style type=&quot;text/css&quot;&amp;gt;
body,td,th {
 font-size: 14px;
 font-family: Verdana, Geneva, sans-serif;
}
body {
 margin-left: 10px;
 margin-right: 10px;
}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;div style=&quot;padding:10px;&quot;&amp;gt;
&amp;lt;?php echo @$response; ?&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;
    &amp;lt;fieldset&amp;gt;
    &amp;lt;legend&amp;gt;Upload Image&amp;lt;/legend&amp;gt;
    
        &amp;lt;input name=&quot;image_file&quot; type=&quot;file&quot; id=&quot;image_file&quot; /&amp;gt;
        
        &amp;lt;input name=&quot;upload_image&quot; type=&quot;submit&quot; id=&quot;upload_image&quot; value=&quot;Upload&quot; /&amp;gt;
        
    &amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/2538821158614856413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/resize-image-when-upload-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/2538821158614856413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/2538821158614856413'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/resize-image-when-upload-php.html' title='Resize Image when upload PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3V8gUjXlaT3TamQNopqVtsEjvdzBoc0fzeNV2fz3ryRSyAdtOvhrY_BpF9jDkLDeRlEs8J4unxT8qr8v1t6CqgfTlHpNU-hTzjAT63rnW1a2XXQOL5CHtwBdrxLfsrBQyLyr9UPvI0vI/s72-c/upload-and-resize-php.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-1732533722304859836</id><published>2012-09-25T06:25:00.000-07:00</published><updated>2012-09-25T06:25:07.744-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SEO Server Fixes"/><category scheme="http://www.blogger.com/atom/ns#" term="Website Optimization"/><title type='text'>Get PHP script execution time</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Get PHP Script executation time&lt;/b&gt; with following simple php script&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUJXHl5pFgOlgANSNMpj4Ck2itDlmOMucj9eOMqfRi_MTofE0N_-pdfPnAuGxyH1WQDF-m3dGCJVEcip1nwsFq7YiRtviniLQ3sTBXCRbCVTx_tnhVmef4DXlaZOeha4zJwOJzn3vVXrA/s1600/site-monitor-loading-time.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;PHP Script Execution Time&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUJXHl5pFgOlgANSNMpj4Ck2itDlmOMucj9eOMqfRi_MTofE0N_-pdfPnAuGxyH1WQDF-m3dGCJVEcip1nwsFq7YiRtviniLQ3sTBXCRbCVTx_tnhVmef4DXlaZOeha4zJwOJzn3vVXrA/s1600/site-monitor-loading-time.jpg&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php
function page_loading_time()
{
    list ($msec, $sec) = explode(&#39; &#39;, microtime());
    $microtime = (float)$msec + (float)$sec;
    return $microtime;
}

// Capture current time at the Begining of the file
$start=page_loading_time();

usleep(100000);  // Delaying page output 0.1 second for testing purpose.
// Your Content Goes here


echo &quot;&amp;lt;br /&amp;gt;At the End of the File
&quot;;
$end = page_loading_time();
// Print results.
echo &#39;Page Loading Time: &amp;lt;b&amp;gt;&#39; . round($end - $start, 2) . &#39;&amp;lt;/b&amp;gt; seconds&#39;;   
?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/1732533722304859836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/get-php-script-execution-time.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/1732533722304859836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/1732533722304859836'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/get-php-script-execution-time.html' title='Get PHP script execution time'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUJXHl5pFgOlgANSNMpj4Ck2itDlmOMucj9eOMqfRi_MTofE0N_-pdfPnAuGxyH1WQDF-m3dGCJVEcip1nwsFq7YiRtviniLQ3sTBXCRbCVTx_tnhVmef4DXlaZOeha4zJwOJzn3vVXrA/s72-c/site-monitor-loading-time.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-9166069704836123226</id><published>2012-09-25T06:02:00.002-07:00</published><updated>2012-09-25T06:02:45.330-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP Image"/><category scheme="http://www.blogger.com/atom/ns#" term="Watermark Image"/><title type='text'>Add Image watermark Over another Image PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Adding watermark is very 
help full. Add Image Watermark with original image is also help to 
protect our images here is my solution to Add &lt;b&gt;Water Mark in PHP&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
Use the following &lt;b&gt;Images &lt;br /&gt;&lt;br /&gt;original_image.jpg&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbbfke0T4Gg80mYmDOHqC1IhYYDneMKgYI0L_73HSxjJTgddbwQ9YyMpSIYpPX8cirD3RrrBFF6nOhwni81oKtvS8OXqvh3iOvB9HJSi7UhXvGDfKv99A3E-GElkaudpJsX2VYwof2Noc/s1600/original_image.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbbfke0T4Gg80mYmDOHqC1IhYYDneMKgYI0L_73HSxjJTgddbwQ9YyMpSIYpPX8cirD3RrrBFF6nOhwni81oKtvS8OXqvh3iOvB9HJSi7UhXvGDfKv99A3E-GElkaudpJsX2VYwof2Noc/s320/original_image.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;watermark_image.png&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkiH4kT603VBXZhkbDDkWCXzVps-AChRzf0zSoSg52lOfDByC-aJnoSRgsdodK3EDywhpHEKY34MiKiNETFBRuHXRQrPlqiBe0Gahcpxqunf46Ta49PwCEW7K_AUTBfPOXfXNn-U_yKlA/s1600/watermark_image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;water mark image&quot; border=&quot;0&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkiH4kT603VBXZhkbDDkWCXzVps-AChRzf0zSoSg52lOfDByC-aJnoSRgsdodK3EDywhpHEKY34MiKiNETFBRuHXRQrPlqiBe0Gahcpxqunf46Ta49PwCEW7K_AUTBfPOXfXNn-U_yKlA/s320/watermark_image.png&quot; title=&quot;Copy this water mark image&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Prepare
 an transparent image with exact same size of the original image. 
Transparent PNG with Text by overlap original image to create a final 
watermark added image.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php
// Original Image Path
$image= &quot;images/original_image.jpg&quot;;  

header(&quot;Content-type: image/jpeg&quot;);
header(&quot;Content-Disposition: inline; filename=$image&quot;);

switch (TRUE) {
case stristr($image,&#39;jpg&#39;) :
$photoImage = ImageCreateFromJPEG(&quot;$image&quot;);
break;
case stristr($image,&#39;gif&#39;) :
$photoImage = ImageCreateFromGIF(&quot;$image&quot;);
break;
case stristr($image,&#39;png&#39;) :
$photoImage = ImageCreateFromPNG(&quot;$image&quot;);
break;
}

ImageAlphaBlending($photoImage, true); 

// Same Size PNG Watermark Image with Transparency
$logoImage = ImageCreateFromPNG(&quot;watermark_image.png&quot;); 
$logoW = ImageSX($logoImage); 
$logoH = ImageSY($logoImage); 

// were you see the two 1&#39;s this is the offset from the top-left hand corner!
ImageCopy($photoImage, $logoImage, 1, 1, 0, 0, $logoW, $logoH); 

imagejpeg($photoImage);
// if you want to save add the following line
imagejpeg($photoImage,&quot;images/final.jpg&quot;);

ImageDestroy($photoImage); 
ImageDestroy($logoImage); 

?&amp;gt;
&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbbfke0T4Gg80mYmDOHqC1IhYYDneMKgYI0L_73HSxjJTgddbwQ9YyMpSIYpPX8cirD3RrrBFF6nOhwni81oKtvS8OXqvh3iOvB9HJSi7UhXvGDfKv99A3E-GElkaudpJsX2VYwof2Noc/s1600/original_image.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/9166069704836123226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/add-image-watermark-over-another-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/9166069704836123226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/9166069704836123226'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/add-image-watermark-over-another-image.html' title='Add Image watermark Over another Image PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbbfke0T4Gg80mYmDOHqC1IhYYDneMKgYI0L_73HSxjJTgddbwQ9YyMpSIYpPX8cirD3RrrBFF6nOhwni81oKtvS8OXqvh3iOvB9HJSi7UhXvGDfKv99A3E-GElkaudpJsX2VYwof2Noc/s72-c/original_image.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-7616654822939899497</id><published>2012-09-25T05:54:00.001-07:00</published><updated>2012-09-25T05:54:44.915-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenID"/><category scheme="http://www.blogger.com/atom/ns#" term="Yahoo Login for websites"/><title type='text'>Login with Yahoo Account</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Website login with Yahoo account been posted at :&lt;br /&gt;
&lt;a href=&quot;http://www.w3lessons.com/2011/10/website-login-with-google-account-yahoo.html&quot;&gt;Website Login with Yahoo Account&lt;/a&gt; in my previous post, yahoo openid identify url been changed.&lt;br /&gt;
&lt;br /&gt;
please use the following new OpenID URL for yahoo in order to work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&lt;b&gt;NEW Yahoo OpenID URL:&lt;/b&gt;

&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php session_start();
# Logging in with Google accounts requires setting special identity, so this example shows how to do it.
require &#39;require/openid.php&#39;;

try {
    # Change &#39;localhost&#39; to your domain name.
    $openid = new LightOpenID(&#39;demos.w3lessons.com&#39;);
 
  $openid-&amp;gt;required = array(
  &#39;namePerson&#39;,
  &#39;namePerson/first&#39;,
  &#39;namePerson/last&#39;,
  &#39;contact/email&#39;,
  );

    if(!$openid-&amp;gt;mode) {
  
 if(@$_GET[&#39;auth&#39;]==&quot;google&quot;)
    {
  $_SESSION[&#39;auth&#39;]=&quot;Google&quot;;
        $openid-&amp;gt;identity = &#39;https://www.google.com/accounts/o8/id&#39;;
        header(&#39;Location: &#39; . $openid-&amp;gt;authUrl());
 }elseif(@$_GET[&#39;auth&#39;]==&quot;yahoo&quot;)
 {
  $_SESSION[&#39;auth&#39;]=&quot;Yahoo&quot;;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;$openid-&amp;gt;identity =&#39;http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds&#39;;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;
  header(&quot;Location:&quot;.$openid-&amp;gt;authUrl());
 }

    } elseif($openid-&amp;gt;mode == &#39;cancel&#39;) {
        echo &#39;User has canceled authentication!&#39;;
    } else {
   $external_login=$openid-&amp;gt;getAttributes();
   $_SESSION[&#39;name&#39;]=$external_login[&#39;namePerson/first&#39;].&quot; &quot;.$external_login[&#39;namePerson/last&#39;];
   $_SESSION[&#39;email&#39;]=$external_login[&#39;contact/email&#39;];
   header(&quot;Location:account-home.php&quot;);
   exit();
   
    }
} catch(ErrorException $e) {
    echo $e-&amp;gt;getMessage();
}
?&amp;gt;
&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;View the Updated New Demo &amp;amp; Download&lt;br /&gt;
&lt;br /&gt;

     &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;     &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/open-id-with-google-yahoo/&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;     &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com/subscribe/index.php?sid=a4000f308be5282bb1bba40accd03b3e&quot; target=&quot;_blank&quot;&gt;Download Script&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/7616654822939899497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/login-with-yahoo-account.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/7616654822939899497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/7616654822939899497'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/login-with-yahoo-account.html' title='Login with Yahoo Account'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s72-c/zip.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-4232372200546918834</id><published>2012-09-22T00:26:00.000-07:00</published><updated>2012-09-22T00:31:41.409-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Development Ideas"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Image"/><title type='text'>Water mark in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Processing with image in PHP, Adding watermark is very help full. Add Image Watermark with original image is also help to protect our images here is my solution to Add &lt;b&gt;Water Mark in PHP&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWJDPLd_C0E0T1HVcBHuaskcO8gB0SaCxAhmE1ganTiLR7Goxyv0Vcjnh3C4rP9JcITpvWFgxfm6Z688ghyiqOKSrD3YLO_9Kq4Rf9qN5meBSyfz7oj2WxwQXltLBQknKHuW_37Dh1LYE/s1600/final.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWJDPLd_C0E0T1HVcBHuaskcO8gB0SaCxAhmE1ganTiLR7Goxyv0Vcjnh3C4rP9JcITpvWFgxfm6Z688ghyiqOKSrD3YLO_9Kq4Rf9qN5meBSyfz7oj2WxwQXltLBQknKHuW_37Dh1LYE/s1600/final.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Prepare an transparent image with exact same size of the original image. Transparent PNG with Text by overlap original image to create a final watermark added image.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;?php
// Original Image Path
$image= &quot;images/original_image.jpg&quot;;  

header(&quot;Content-type: image/jpeg&quot;);
header(&quot;Content-Disposition: inline; filename=$image&quot;);

switch (TRUE) {
case stristr($image,&#39;jpg&#39;) :
$photoImage = ImageCreateFromJPEG(&quot;$image&quot;);
break;
case stristr($image,&#39;gif&#39;) :
$photoImage = ImageCreateFromGIF(&quot;$image&quot;);
break;
case stristr($image,&#39;png&#39;) :
$photoImage = ImageCreateFromPNG(&quot;$image&quot;);
break;
}

ImageAlphaBlending($photoImage, true); 

// Same Size PNG Watermark Image with Transparency
$logoImage = ImageCreateFromPNG(&quot;watermark_image.png&quot;); 
$logoW = ImageSX($logoImage); 
$logoH = ImageSY($logoImage); 

// were you see the two 1&#39;s this is the offset from the top-left hand corner!
ImageCopy($photoImage, $logoImage, 1, 1, 0, 0, $logoW, $logoH); 

imagejpeg($photoImage);
// if you want to save add the following line
imagejpeg($photoImage,&quot;images/final.jpg&quot;);

ImageDestroy($photoImage); 
ImageDestroy($logoImage); 

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/4232372200546918834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/water-mark-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/4232372200546918834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/4232372200546918834'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/water-mark-in-php.html' title='Water mark in PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWJDPLd_C0E0T1HVcBHuaskcO8gB0SaCxAhmE1ganTiLR7Goxyv0Vcjnh3C4rP9JcITpvWFgxfm6Z688ghyiqOKSrD3YLO_9Kq4Rf9qN5meBSyfz7oj2WxwQXltLBQknKHuW_37Dh1LYE/s72-c/final.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-5956243906013738849</id><published>2012-09-21T23:06:00.002-07:00</published><updated>2012-09-21T23:10:38.350-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Development Ideas"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Array"/><title type='text'>Convert Text Area to Array PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
Processing multiple records through &lt;b&gt;Text Area&lt;/b&gt;, We may need to convert that text area values into &lt;b&gt;array&lt;/b&gt; from every line of text in that TextArea. here is my solution to &quot;Convert TextArea to Array&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinKhRbJhe2tc-B_C7723gObBXkT6sacTkH_Xny8jgByAs2nEv5_ce1jwYmXLOEi0RxfY0Agfcl6L5ROwY81JV3Js4KR0A9bdBzE6wuabL2O7u7vc0tZIarKWGEMgJFGjVVFiTUqjyNfRM/s1600/Convert-Text+Area+to+Array.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinKhRbJhe2tc-B_C7723gObBXkT6sacTkH_Xny8jgByAs2nEv5_ce1jwYmXLOEi0RxfY0Agfcl6L5ROwY81JV3Js4KR0A9bdBzE6wuabL2O7u7vc0tZIarKWGEMgJFGjVVFiTUqjyNfRM/s1600/Convert-Text+Area+to+Array.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #EEE; border: 2px dashed #F00; margin: 10px; padding: 15px;&quot;&gt;&amp;lt;!DOCTYPE&amp;gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;Text Area to Array&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;?php
// Check Form Submission
if(isset($_POST[&#39;submit&#39;]))
{
 // Capture cities text into variable
 $text = ucwords($_POST[&#39;cities&#39;]);
 // Replace entry new line with Comma(,)
 $cities = preg_replace(&quot;~\s*[\r\n]+~&quot;, &#39;, &#39;, $text);
 // Explode by Comma(,) and trim if any white spaces with array_map
 $cities = array_map(&#39;trim&#39;,explode(&quot;,&quot;,$cities));
 // final output as array
 echo &quot;&amp;lt;pre&amp;gt;&quot;;
 print_r($cities);
 echo &quot;&amp;lt;/pre&amp;gt;&quot;;
}


?&amp;gt;

&amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
  &amp;lt;h2&amp;gt;Convert Text Area to Array&amp;lt;/h2&amp;gt;
  &amp;lt;p&amp;gt;Enter each city every line&amp;lt;br /&amp;gt;
    &amp;lt;textarea name=&quot;cities&quot; cols=&quot;50&quot; rows=&quot;10&quot; id=&quot;keywords&quot;&amp;gt;&amp;lt;/textarea&amp;gt;
    &amp;lt;br /&amp;gt;
    &amp;lt;br /&amp;gt;
    
    &amp;lt;input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Submit Cities&quot; id=&quot;submit&quot; /&amp;gt;
  &amp;lt;/p&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;&lt;img alt=&quot;Download This Script&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoyf36r1FtGJ2bY9wX-crxQozdN_B9QwrsVRUJeW23Jn5n_MqB_5YNcbkDb_xL0cbdkAenbJA7rM493Tgjz_nidKdFZwb_C1fmjIIbY3GO9_jLQ3cuWuOGflQM7Ou0bAEUeGHjCGOwKUY/s1600/zip.png&quot; /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://demos.w3lessons.com//TextArea-to-Array/&quot; target=&quot;_blank&quot;&gt;Live&amp;nbsp;Demo&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/5956243906013738849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/09/convert-text-area-to-array-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5956243906013738849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5956243906013738849'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/09/convert-text-area-to-array-php.html' title='Convert Text Area to Array PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinKhRbJhe2tc-B_C7723gObBXkT6sacTkH_Xny8jgByAs2nEv5_ce1jwYmXLOEi0RxfY0Agfcl6L5ROwY81JV3Js4KR0A9bdBzE6wuabL2O7u7vc0tZIarKWGEMgJFGjVVFiTUqjyNfRM/s72-c/Convert-Text+Area+to+Array.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2593963131891535133.post-5190440750519262007</id><published>2012-08-21T02:43:00.002-07:00</published><updated>2012-08-21T02:43:46.225-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Alexa Rank"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP Functions"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP SEO"/><category scheme="http://www.blogger.com/atom/ns#" term="Website Optimization"/><title type='text'>Alexa Rank Script PHP - Get Alexa Rank in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVoFPs6RJ6wQoTJ692zEcaaSRvO4beZMBarOs_ZhoiHXXDxJNXgnro4___uvpHReSyjQ5SfT4-_QAeB_bsC6Z7GGfky-aWQCNRRrHltmSKkE-8Msm2EuExa9E6xowxCMCav3BB2gstxbs/s320/alexa.jpg&quot; width=&quot;320&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
To Find Alexa Rank in php using following function&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP Script to get Alexa Rank&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;php&quot; name=&quot;code&quot;&gt;&amp;lt;?php

function alexaRank($domain){
    $remote_url = &#39;http://data.alexa.com/data?cli=10&amp;amp;dat=snbamz&amp;amp;url=&#39;.trim($domain);
    $search_for = &#39;&amp;lt;POPULARITY URL&#39;;
 $part = NULL;
    if ($handle = @fopen($remote_url, &quot;r&quot;)) {
        while (!feof($handle)) {
            $part .= fread($handle, 100);
            $pos = strpos($part, $search_for);
            if ($pos === false)
            continue;
            else
            break;
        }
        $part .= fread($handle, 100);
        fclose($handle);
    }
    $str = explode($search_for, $part);
    $str = @array_shift(explode(&#39;&quot; SOURCE=&quot;panel&quot;/&amp;gt;&#39;, $str[1]));
    $str = explode(&#39;TEXT=&quot;&#39;, $str);

    return $str[1];
}


echo alexaRank(&quot;google.co.in&quot;);

?&amp;gt;

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://w3lessons.blogspot.com/feeds/5190440750519262007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://w3lessons.blogspot.com/2012/08/alexa-rank-script-php-get-alexa-rank-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5190440750519262007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2593963131891535133/posts/default/5190440750519262007'/><link rel='alternate' type='text/html' href='http://w3lessons.blogspot.com/2012/08/alexa-rank-script-php-get-alexa-rank-in.html' title='Alexa Rank Script PHP - Get Alexa Rank in PHP'/><author><name>Jailani M</name><uri>http://www.blogger.com/profile/07208204983749606478</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVoFPs6RJ6wQoTJ692zEcaaSRvO4beZMBarOs_ZhoiHXXDxJNXgnro4___uvpHReSyjQ5SfT4-_QAeB_bsC6Z7GGfky-aWQCNRRrHltmSKkE-8Msm2EuExa9E6xowxCMCav3BB2gstxbs/s72-c/alexa.jpg" height="72" width="72"/><thr:total>2</thr:total></entry></feed>