Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Código do play.php
- <?php
- $USERNAME = 'admin@filmesonlineuhd.net';
- $PASSWORD = '213546879';
- $COOKIEFILE = 'cookies.txt';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
- curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIEFILE);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIEFILE);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
- curl_setopt($ch, CURLOPT_TIMEOUT, 120);
- curl_setopt($ch, CURLOPT_URL, 'https://accounts.google.com/ServiceLogin');
- $data = curl_exec($ch);
- //echo $data;
- $formFields = getFormFields($data);
- //print_r($formFields);
- $formFields['Email'] = $USERNAME;
- $formFields['Passwd'] = $PASSWORD;
- unset($formFields['PersistentCookie']);
- $post_string = '';
- foreach($formFields as $key => $value) {
- $post_string .= $key . '=' . urlencode($value) . '&';
- }
- $post_string = substr($post_string, 0, -1);
- curl_setopt($ch, CURLOPT_URL, 'https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1<mpl=default<mplcache=2');
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_REFERER, 'https://mail.google.com/');
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
- $result = curl_exec($ch);
- //comentado aqui
- /*
- if (strpos($result, '<title>Redirecting') === false) {
- die("Login failed");
- var_dump($result);
- } else {*/
- curl_setopt($ch, CURLOPT_URL, 'https://mail.google.com/mail/h/jeu23doknfnj/?zy=e&f=1');
- curl_setopt($ch, CURLOPT_POST, 0);
- curl_setopt($ch, CURLOPT_POSTFIELDS, null);
- $result = curl_exec($ch);
- //header('Location:https://mail.google.com/mail/h/jeu23doknfnj/?zy=e&f=1');
- var_dump($result);
- //}
- function getFormFields($data)
- {
- if (preg_match('/(<form.*?id=.?gaia_loginform.*?<\/form>)/is', $data, $matches)) {
- $inputs = getInputs($matches[1]);
- return $inputs;
- } else {
- die('didnt find login form');
- }
- }
- function getInputs($form)
- {
- $inputs = array();
- $elements = preg_match_all('/(<input[^>]+>)/is', $form, $matches);
- if ($elements > 0) {
- for($i = 0; $i < $elements; $i++) {
- $el = preg_replace('/\s{2,}/', ' ', $matches[1][$i]);
- if (preg_match('/name=(?:["\'])?([^"\'\s]*)/i', $el, $name)) {
- $name = $name[1];
- $value = '';
- if (preg_match('/value=(?:["\'])?([^"\'\s]*)/i', $el, $value)) {
- $value = $value[1];
- }
- $inputs[$name] = $value;
- }
- }
- }
- return $inputs;
- }
- ?>
- //Código do index.php
- <?php
- //error_reporting(0);
- require_once 'vendor/autoload.php';
- require_once 'config.php';
- require_once 'libs/curl.php';
- require_once 'libs/gdrive.php';
- require_once 'libs/gphotos.php';
- $client = new Google_Client();
- $client->setClientId(CLIENT_ID);
- $client->setClientSecret(CLIENT_SECRET);
- $client->setRedirectUri(AUTH_REDIRECT_URL);
- $client->setScopes(array('https://www.googleapis.com/auth/drive.metadata.readonly', 'https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.file'));
- $client->setAccessType ("offline");
- $client->setApprovalPrompt ("force");
- if(file_exists("./tokens/accesstoken.txt")) {
- $content = file_get_contents("./tokens/accesstoken.txt");
- $accessToken = json_decode($content, true) ;
- $client->setAccessToken($accessToken);
- if($client->isAccessTokenExpired()) {
- $currentAccessToken = $client->getAccessToken();
- $client->refreshToken($currentAccessToken['refresh_token']);
- $newAccessToken = $client->getAccessToken();
- $newAccessToken['refresh_token'] = $currentAccessToken['refresh_token'];
- file_put_contents("./tokens/accesstoken.txt", json_encode($newAccessToken));
- $accessToken = $currentAccessToken;
- }
- if($_GET && $_GET['url']){
- $md5url = md5($_GET['url']);
- $cachefile = './cached/'.$md5url;
- $cachetime = 3600;
- if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
- include($cachefile);
- exit;
- }
- ob_start();
- $url = $_GET['url'];
- $posGDrive = strpos($url, 'drive.google.com');
- $posDocs = strpos($url, 'docs.google.com');
- $posPhotos = strpos($url, 'photos.google.com');
- $output = "";
- if($posGDrive !== false || $posDocs !== false){
- $output = get_google_drive($url, $accessToken['access_token']);
- }elseif($posPhotos !== false){
- $output = get_google_photos($url);
- }
- echo $output;
- $cached = fopen($cachefile, 'w');
- fwrite($cached, ob_get_contents());
- fclose($cached);
- ob_end_flush();
- }
- } else {
- if(isset($_GET['code'])){
- $client->authenticate($_GET['code']);
- $accessToken = $client->getAccessToken();
- file_put_contents("./tokens/accesstoken.txt", json_encode($accessToken));
- }else{
- $authUrl = $client->createAuthUrl();
- header('Location: ' .$authUrl);
- exit();
- }
- $authUrl = $client->createAuthUrl();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement