📍 /home/diasdiamonds/public_html/google
📝 Editando: index.php
<?php @session_start(); require('../adminarea/conn.php'); require_once 'vendor/autoload.php'; // init configuration $clientID = '315876661940-ttm9ceg8aplgdooe34oqfpdj7tt43i5p.apps.googleusercontent.com'; $clientSecret = 'ngzbZQX9DGJ6ygH4c9MLm9J9'; $redirectUri = 'https://www.chakradhari.com/google/'; // create Client Request to access Google API $client = new Google_Client(); $client->setClientId($clientID); $client->setClientSecret($clientSecret); $client->setRedirectUri($redirectUri); $client->addScope("email"); $client->addScope("profile"); // authenticate code from Google OAuth Flow if (isset($_GET['code'])) { $token = $client->fetchAccessTokenWithAuthCode($_GET['code']); $client->setAccessToken($token['access_token']); // get profile info $google_oauth = new Google_Service_Oauth2($client); $google_account_info = $google_oauth->userinfo->get(); $email = $google_account_info->email; $name = $google_account_info->name; $query="select * from users where email='".$email."'"; $result=mysqli_query($c,$query); { $row = mysqli_num_rows($result); $platformid=hash('gost', $email.'Pr*87hbt.0jyt+ty'); if ($row) { $query="update users set name='".$name."',email='".$email."',platform='Google',platformid='".$platformid."',date='".date('Y-m-d')."' where email='".$email."'"; $result=mysqli_query($c,$query); } else{ $query="insert into users set name='".$name."',email='".$email."',password='".rand('11111','99999')."',platform='Google',platformid='".$platformid."',date='".date('Y-m-d')."'"; $result=mysqli_query($c,$query); } } header("location:https://www.chakradhari.com/users/tokenvalidate/$platformid"); // now you can use this profile info to create account in your website and make user logged in. } else { echo "<a href='".$client->createAuthUrl()."'>Google Login</a>"; } ?>
[ Cancelar ]
Nome
Permissões
Ações
[ .. Voltar ]
📄 .htaccess
0644
[ EDITAR/VER ]
📄 composer.json
0644
[ EDITAR/VER ]
📄 composer.lock
0644
[ EDITAR/VER ]
📄 index.php
0644
[ EDITAR/VER ]
📁
vendor/
0755