Thursday, October 20, 2011

Introduction to Website Login with Google, Yahoo

When we are working with Website Account Registration / Account Login Page, We have to present a Signup form based on our website requirement. In case we are provide a simple signup form with Email, password, Confirm password. In this case we can use External website Login from OAuth Providers among most familiar  services among web. Such this think , Google, Yahoo, Facebook, Twitter all major services are provide OAuth to accept web developer/Website owners are use their credential to accept users on their websites.

Let us create a Login Page for our website to accept the visitors those who already have a account with Google or yahoo.



Let us Create Website login with Google account or Yahoo Account

Website Login with Google Account, Yahoo Account with Oauth

Website registration and Login 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 Login from google, yahoo, facebook, twitter.


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 Login with OpenID OAuth Login with Google Accounts and Yahoo Accounts.

let us create How to make people login into your website with their Google account and Yahoo
Google and Yahoo provides Federated Login for Account Users with OAuth.

Step: 1
Download LightOpenID Class from
https://nodeload.github.com/brice/LightOpenId/zipball/master


Step: 2: Write a Following Code and design a Form to Handle Login

<?php session_start();
# Logging in with Google accounts requires setting special identity, so this example shows how to do it.
require 'require/openid.php';

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

    if(!$openid->mode) {
  
 if(@$_GET['auth']=="google")
    {
  $_SESSION['auth']="Google";
        $openid->identity = 'https://www.google.com/accounts/o8/id';
        header('Location: ' . $openid->authUrl());
 }elseif(@$_GET['auth']=="yahoo")
 {
  $_SESSION['auth']="Yahoo";
  $openid->identity ='yahoo.com';
  header("Location:".$openid->authUrl());
 }

    } elseif($openid->mode == 'cancel') {
        echo 'User has canceled authentication!';
    } else {
   $external_login=$openid->getAttributes();
   $_SESSION['name']=$external_login['namePerson/first']." ".$external_login['namePerson/last'];
   $_SESSION['email']=$external_login['contact/email'];
   header("Location:account-home.php");
   exit();
   
    }
} catch(ErrorException $e) {
    echo $e->getMessage();
}
?>


Download This Script     Live Demo     Download Script

Monday, October 10, 2011

HTML code for an image

Embedded HTML Code for an Image is an advanced technique for Modern Web. Standard HTML Images are map with <IMG> tag using src attribute src attribute is to be an URL of an Image.

Traditional Image Tag Example:
<img src="pathof-image.jpg" />

HTML code for an image
In Modern Image tag  Image Soruce Placed It self with in the SRC using Image Tag Data URI Scheme

Click Here to View how to create  Image Tag Data URI Scheme

Following PHP Function we can build the HTML Code for an Image.


<?php
// Funtion to prepare Data URI:
// @ parm: Image filepath, Image Size
// reutn : data_uri string
function thumbnail_data_uri($filename,$width=0,$height=0) 
{
 
 // Get Image Header Type
      $image_info = getimagesize($filename);
      $image_type = $image_info[2];

 // Check the Size is Specified
 if($width!=0 and $height!=0)
 {
      if( $image_type == IMAGETYPE_JPEG ) {
         $image = imagecreatefromjpeg($filename);
      } elseif( $image_type == IMAGETYPE_GIF ) {
         $image = imagecreatefromgif($filename);
      } elseif( $image_type == IMAGETYPE_PNG ) {
         $image = imagecreatefrompng($filename);
   imagealphablending($image, true);

      } 

 $new_image = imagecreatetruecolor($width, $height);
 imagealphablending($new_image, false);
 imagesavealpha($new_image, true);     
      imagecopyresampled($new_image, $image, 0, 0, 0, 0, $width, $height, imagesx($image),imagesy($image));
      $image = $new_image; 
   
 ob_start();
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($image);
      } elseif( $image_type == IMAGETYPE_GIF ) {
         imagegif($image);         
      } elseif( $image_type == IMAGETYPE_PNG ) {
         imagepng($image);
      } 
 $content=ob_get_clean();   
   
   
 }else
 $content=file_get_contents($filename,true);
 
 
 
 $base64 = base64_encode($content); 
 return "data:$image_type;base64,$base64";
}

?>

Simple captcha with PHP

Simple captcha with PHP, We seen how to create a Simple captcha . Now we look how to integrate that simple Captcha with HTML Form. Now I am going to show you a Newsletter Subscriber with our Simple Captcha.

Simple captcha with PHP and Live Example with Newsletter
  • Show an image Captcha without any dependancies, such as Class, Function etc.,
  • Customizable code length, character sets, and Unicode support
  • TTF font support
  • Easily  customization: Background and Foreground colors
Kindly view  How to Create a Simple Captcha in PHP before the Newsletter Integration of this Capcha

Let me create a HTML form look like this
 

Saturday, October 8, 2011

Google PageRank Script New Updated toolbar query url

Due to the problem on PR Finding script. When we identify the problem of this script, I have found that query URL been changed by Google which we fetch PR problematically. Here is the updated Google PageRank Script New Updated toolbar query URL

The Old URL Was This -
http://toolbarqueries.google.com/search?client=navclient-auto&features=Rank&ch=SITECHECKSUM&q=info:SITENAME.com