us登录系统,你只需要在index.php中加载这个文件。<?php require_once ''src/apiClient.php''; require_once ''src/contrib/apiOauth2Service.php''; session_start(); $client = new apiClient(); setApplicationName("Google Account Login"); $oauth2 = new apiOauth2Service($client); if (isset(
Google Oauth登录系统开发示例_网学
浏览:
GET[''code''])) { $client->authenticate();
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''token''] = $client->getAccessToken(); $redirect = ''http://'' .
Google Oauth登录系统开发示例_网学
浏览:
SERVER[''HTTP_HOST''] .
Google Oauth登录系统开发示例_网学
浏览:
SERVER[''PHP_SELF'']; header(''Location: '' . filter_var($redirect, FILTER_SANITIZE_URL)); } if (isset(
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''token''])) { $client->setAccessToken(
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''token'']); } if (isset(
Google Oauth登录系统开发示例_网学
浏览:
REQUEST[''logout''])) { unset(
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''token'']); unset(
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''google_data'']); //Google session data unset $client->revokeToken(); } if ($client->getAccessToken()) { $user = $oauth2->userinfo->get();
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''google_data'']=$user; // Storing Google User Data in Session header("location: home.php");
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''token''] = $client->getAccessToken(); } else { $authUrl = $client->createAuthUrl(); } if(isset($personMarkup)): print $personMarkup; endif if(isset($authUrl)) { echo "<a class="login" href="$authUrl">Google Account Login</a>"; } else { echo "<a class="logout" href="?logout">Logout</a>"; } ?> home.php在这里我们需要向之前创建的user表插入Google plus的session信息。代码如下:<?php session_start(); include(''db.php''); //Database Connection. if (!isset(
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''google_data''])) { // Redirection to application home page. header("location: index.php"); } else { //echo print_r($userdata); $userdata=
Google Oauth登录系统开发示例_网学
浏览:
SESSION[''google_data'']; $email =$userdata[''email'']; $googleid =$userdata[''id'']; $fullName =$userdata[''name'']; $firstName=$userdata[''given_name'']; $lastName=$userdata[''family_name'']; $gplusURL=$userdata[''link'']; $avatar=$userdata[''picture'']; $gender=$userdata[''gender'']; $dob=$userdata[''birthday'']; //Execture query $sql=mysql_query("insert into users(email,fullname,firstname,lastname,google_id,gender,dob,profile_image,gpluslink) values(''$email'',''$fullName'',''$firstName'',''$lastName'',''$googleid'',''$gender'',''$dob'',