Showing posts with label application. Show all posts

Login with Google Account OpenID

Contact Me For Sample File

Database
Sample database users table columns id, email, oauth_uid, oauth_provider and username.
CREATE TABLE users
(
id INT PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(70), 
oauth_uid int(11),
oauth_provider VARCHAR(100),
username VARCHAR(100) 
);

In this tutorial we have the following directory structure
google-open //Google LightOpenID library
config
-- functions.php 
-- dbconfig.php //Database connection
index.php
home.php
getGoogleData.php //The Callback URL file
login-google.php

dbconfig.php
Database configuration file. 
<?php

define('DB_SERVER', 'dbserver');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'database');

define('USERS_TABLE_NAME', 'users_table_name'); //Replace your users table name here
$connection = mysql_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD) ordie(mysql_error());
$database = mysql_select_db(DB_DATABASE) or die(mysql_error());
?>

login-google.php
In root directory find out the below line at login-google.php code and replaceyourdomain.com with your own domain  value. 
define('CALLBACK_URL', 'http://yourdomain.com/getGoogleData.php');

index.php
If you want to modify your web project existing login or index pages, just use following code. 
<?php
session_start();
if (isset($_SESSION['id'])) {
// Redirect to home page as we are already logged in
header("location: home.php");
}
if (array_key_exists("login", $_GET)) 
{
$oauth_provider = $_GET['oauth_provider'];
if ($oauth_provider == 'google')
{
header("Location: login-google.php");
}
}
?>
//HTML Code
<a href="?login&oauth_provider=google">Google Login</a>

home.php
In home page you can display user details by accessing session variables.



Name: <?php $_SESSIONS['username'] >
Email: <?php $_SESSIONS['email'] >
Your are logged in with: <?php $_SESSIONS['oauth_provider'] >
<a href="logout.php?logout">Logout</a> from  <?php $_SESSIONS['oauth_provider'] >

Open Source & Web-Based Personal Information Dashboard: conjoon

conjoon is a web-based open source application, built with the Zend Framework, that focuses on message exchanging.
Currently, it is a full-featured webmail & RSS reader client with contacts management. But the upcoming releases show that it will also have an integrated Twitter client with multiple accounts support.
conjoon
Thanks to Ext JS, the application has a slick desktop-like interface with tabs, drag'n drops & more.
It comes with a web-based installer & requires PHP/MySQL to run.