���� 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/img.123vid.top/upanh2/ |
<?php define('ADMIN_USERNAME','admin'); // Admin Username define('ADMIN_PASSWORD','iSchool!23'); // Admin Password if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME ||$_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) { header("WWW-Authenticate: Basic realm=\"Login\""); header("HTTP/1.0 401 Unauthorized"); echo '<html><body> <h1>Rejected!</h1> <big>Wrong Username or Password!</big> </body></html>'; exit(); } 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('giangnn15.nhatrang.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 = 'token/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/0AZEOvhVa0OmHYS8wd87Vyl9w1Ib8yBCNH9xi1VZ3rYK0311ExmChfn4IWfz6JM61vfTk4g'; //$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(); ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Ajax File Upload with jQuery and PHP - Demo</title> <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="js/jquery.form.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var options = { target: '#output', // target element(s) to be updated with server response beforeSubmit: beforeSubmit, // pre-submit callback success: afterSuccess, // post-submit callback uploadProgress: OnProgress, //upload progress callback resetForm: true // reset the form after successful submit }; $('#MyUploadForm').submit(function() { $(this).ajaxSubmit(options); // always return false to prevent standard browser submit and page navigation return false; }); //function after succesful file upload (when server response) function afterSuccess() { $('#submit-btn').show(); //hide submit button $('#loading-img').hide(); //hide submit button $('#progressbox').delay( 1000 ).fadeOut(); //hide progress bar } //function to check file size before uploading. function beforeSubmit(){ //check whether browser fully supports all File API if (window.File && window.FileReader && window.FileList && window.Blob) { if( !$('#FileInput').val()) //check empty input filed { $("#output").html("Are you kidding me?"); return false; } var fsize = $('#FileInput')[0].files[0].size; //get file size var ftype = $('#FileInput')[0].files[0].type; // get file type //allow file types switch(ftype) { case 'image/png': case 'image/gif': case 'image/jpeg': case 'image/pjpeg': /*case 'text/plain': case 'text/html': case 'application/x-zip-compressed': case 'application/pdf': case 'application/msword': case 'application/vnd.ms-excel': case 'video/mp4':*/ break; default: $("#output").html("<b>"+ftype+"</b> Unsupported file type!"); return false } //Allowed file size is less than 5 MB (1048576) /*if(fsize>5242880) { $("#output").html("<b>"+bytesToSize(fsize) +"</b> Too big file! <br />File is too big, it should be less than 5 MB."); return false }*/ $('#submit-btn').hide(); //hide submit button $('#loading-img').show(); //hide submit button $("#output").html(""); } else { //Output error to older unsupported browsers that doesn't support HTML5 File API $("#output").html("Please upgrade your browser, because your current browser lacks some new features we need!"); return false; } } //progress bar function function OnProgress(event, position, total, percentComplete) { //Progress bar $('#progressbox').show(); $('#progressbar').width(percentComplete + '%') //update progressbar percent complete $('#statustxt').html(percentComplete + '%'); //update status text if(percentComplete>50) { $('#statustxt').css('color','#000'); //change status text to white after 50% } } //function to format bites bit.ly/19yoIPO function bytesToSize(bytes) { var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (bytes == 0) return '0 Bytes'; var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; } }); </script> <link href="style/style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="upload-wrapper"> <div align="center"> <h3>Ajax File Uploader</h3> <form action="processupload.php" method="post" enctype="multipart/form-data" id="MyUploadForm"> <input name="FileInput" id="FileInput" type="file" /> <input type="submit" id="submit-btn" value="Upload" /> <img src="images/ajax-loader.gif" id="loading-img" style="display:none;" alt="Please Wait"/> </form> <div id="progressbox" ><div id="progressbar"></div ><div id="statustxt">0%</div></div> <div id="output"></div> </div> </div> </body> </html>