inital commit

This commit is contained in:
2026-06-19 20:08:01 +06:00
commit 8a5abeeae4
13128 changed files with 3192007 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
<script>
function myFunction() {
var copyText = document.getElementById("myInput");
if(copyText.value != ""){
copyText.select();
document.execCommand("copy");
alert("Token copied")
}
}
</script>
<?php
session_start();
require __DIR__.'/Staff/vendor_onedrive/autoload.php';
//require '../Automation_Script/vendor/autoload.php';
use GuzzleHttp\Client as GuzzleHttpClient;
use Krizalys\Onedrive\Client;
use Microsoft\Graph\Graph;
if(isset($_GET['client_id'])){
$client_id = $_GET['client_id'];
$_SESSION['onedrive_client_id'] = $client_id;
}else{
$client_id = $_SESSION['onedrive_client_id'];
}
if(isset($_GET['client_secret'])){
$client_secret = $_GET['client_secret'];
$_SESSION['onedrive_client_secret'] = $client_secret;
}else{
$client_secret = $_SESSION['onedrive_client_secret'];
}
$redirect_url = 'https://readytogoletters.com/one_drive_key_generator.php';
//$redirect_url = 'http://localhost/onedrive/one_drive_key_generator.php';
if(isset($_GET['code'])) {
$code = $_GET['code'];
try{
$client = new Client(
$client_id,
new Graph(),
new GuzzleHttpClient(),
[
'state' => (object) [
'redirect_uri' => $redirect_url,
'token' => null
]]
);
//echo "<pre>";print_r($client);exit;
//$client->setState(stdClass Object ([redirect_uri] => $key_generator));
$client->obtainAccessToken($client_secret, $code);
$state = $client->getState();
$access_token = $state->token->data->access_token;
$refresh_token = $state->token->data->refresh_token;
} catch (\Exception $e){
}
echo "Token : <br/><textarea id='myInput' rows='10' cols='120' readonly>".$refresh_token."</textarea><br/><button onclick='myFunction()'>Copy Token</button>";exit;
}
// index.php
// Instantiates a OneDrive client bound to your OneDrive application.
$client = new Client(
$client_id,
new Graph(),
new GuzzleHttpClient()
);
// Gets a log in URL with sufficient privileges from the OneDrive API.
$url = $client->getLogInUrl([
'files.read',
'files.read.all',
'files.readwrite',
'files.readwrite.all',
'offline_access',
], $redirect_url);
//print_r($client->getState());exit;
// Redirect the user to the log in URL.
header('HTTP/1.1 302 Found', true, 302);
header("Location: $url");