घर-घर से दो जनों का "खाना" भूखे को सुख देगा मनमाना | देश का सबसे बड़ा Food Donation Campaign..

  • Phone: +91 99 903 04275
  • Email: info@ekdaana.com

Food Donors

google

Register Now

EkDaana Poster
fetchAccessTokenWithAuthCode($_GET["code"]); //This condition will check there is any error occur during geting authentication token. If there is no any error occur then it will execute if block of code/ if(!isset($token['error'])) { //Set the access token used for requests $google_client->setAccessToken($token['access_token']); //Store "access_token" value in $_SESSION variable for future use. $_SESSION['access_token'] = $token['access_token']; //Create Object of Google Service OAuth 2 class $google_service = new Google_Service_Oauth2($google_client); //Get user profile data from google $data = $google_service->userinfo->get(); //Below you can find Get profile data and store into $_SESSION variable if(!empty($data['given_name'])) { $_SESSION['user_first_name'] = $data['name']; $name = $_SESSION['user_first_name'] ; } if(!empty($data['email'])) { echo $name; $_SESSION['user_email_address'] = $data['email']; $q ="insert into donordb (name) values ('$name')"; $r =mysqli_query($conn,$q); if($r) { echo "ok"; } else{ echo "not got"; } } } } //This is for check user has login into system by using Google account, if User not login into system then it will execute if block of code and make code for display Login link for Login using Google account. if(!isset($_SESSION['access_token'])) { //Create a URL to obtain user authorization $login_button = 'google'; } ?>

Login using Google Account


'; echo '
Welcome User
'; } else { echo '
'.$login_button . '
'; } ?>