ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/sharefilefree/ |
<?php require 'vendor/autoload.php'; function getClient() { $client = new Google_Client(); $client->setApplicationName('Google Drive API PHP Quickstart'); $client->setScopes(Google_Service_Drive::DRIVE); $client->setAuthConfig('giangnn30.json'); $client->setAccessType('offline'); $client->setPrompt('select_account consent'); // Load previously authorized token from a file, if it exists. // The file token.json stores the user's access and refresh tokens, and is // created automatically when the authorization flow completes for the first // time. $tokenPath = 'data/token.json'; if (file_exists($tokenPath)) { $accessToken = json_decode(file_get_contents($tokenPath), true); $client->setAccessToken($accessToken); } // If there is no previous token or it's expired. if ($client->isAccessTokenExpired()) { // Refresh the token if possible, else fetch a new one. if ($client->getRefreshToken()) { $client->fetchAccessTokenWithRefreshToken($client->getRefreshToken()); } else { // Request authorization from the user. /*$authUrl = $client->createAuthUrl(); printf("Open the following link in your browser:\n%s\n", $authUrl); print 'Enter verification code: '; exit();*/ //$authCode = trim(fgets(STDIN)); $authCode = '4/0AX4XfWg5Mx2kEr55X7P77sd_upRb0MVZoyIQdaHMyk3g5TiP7xIgvk5V1UiM4mezBuEjoQ'; //$authCode = $_GET['code']; // Exchange authorization code for an access token. $accessToken = $client->fetchAccessTokenWithAuthCode($authCode); $client->setAccessToken($accessToken); // Check to see if there was an error. if (array_key_exists('error', $accessToken)) { throw new Exception(join(', ', $accessToken)); } } // Save the token to a file. if (!file_exists(dirname($tokenPath))) { mkdir(dirname($tokenPath), 0777, true); } file_put_contents($tokenPath, json_encode($client->getAccessToken())); } return $client; } $client = getClient(); $service = new Google_Service_Drive($client); //Insert a file $file = new Google_Service_Drive_DriveFile(); include_once("config.php"); include("classes/sfs.class.php"); $SFS = new SFS($config); $config = $SFS->config; if (!preg_match("|^" . $config->instUrl . '/|', $_SERVER["HTTP_REFERER"])) { exit("illegal access"); } if(!isset($_SESSION['openid_type']) or $_SESSION['openid_type']=='') {//check login include("notfound.php"); } if(isset($_GET['key']) && $_GET['key']!='') { $key = $_GET['key']; $row_check = $SFS->fetch_row($SFS->query_my("SELECT * FROM SFS355_files WHERE shortkey='$key' AND uid='".$_SESSION['uid']."' ")); if(!$row_check){ header('Location: filemanager.php'); exit(); } $sql = "delete from `" . $config->tablePrefix . "files` where id = '" . $row_check['id'] . "' and uid = '".$_SESSION['uid']."'"; $SFS->dbquery($sql); $service->files->delete($row_check['drive_id']); header('Location: filemanager.php'); exit(); }else{ include("notfound.php"); } ?>