403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/clients/client1/seaside.pacim.de/web/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client1/seaside.pacim.de/web/gdrive_quick.php
<?php
/**
 * gdrive_quick.php – OAuth-Callback für den Google-Drive-Zugriff der Monatsabrechnung.
 *
 * Diese URL ist beim OAuth-Client als Redirect-URI registriert. Google leitet nach der
 * Zustimmung mit ?code hierher zurück; der Code wird gegen ein Token getauscht und
 * (inkl. refresh_token) in includes/certs/token-...-pacim-gdrive.json gespeichert.
 *
 * Start der Autorisierung erfolgt über gdrive_auth.php.
 */
require_once( __DIR__ . '/includes/config.inc.php' );
ini_set( 'display_errors', '0' );
error_reporting( 0 );

if ( ! isset( $_SESSION['user'] ) || $_SESSION['user'] != LOGIN_USER ) {
    http_response_code( 403 );
    echo 'Nicht angemeldet.';
    exit();
}

require_once( PATH_SYSTEM . '/includes/accounting.drive.php' );
$credentialsPath = accounting_drive_token_path();
$secretPath      = accounting_drive_secret_path();

// Registrierte Redirect-URI verwenden (muss exakt mit der Konsole übereinstimmen).
$secret   = json_decode( file_get_contents( $secretPath ), true );
$secretK  = is_array( $secret ) ? array_key_first( $secret ) : null;
$redirect = ( $secretK && ! empty( $secret[ $secretK ]['redirect_uris'][0] ) ) ? $secret[ $secretK ]['redirect_uris'][0] : null;

function gq_page( $body ) {
    echo '<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">';
    echo '<title>Google Drive verbinden</title>';
    echo '<style>body{font-family:system-ui,Segoe UI,Roboto,Arial,sans-serif;max-width:640px;margin:48px auto;padding:0 20px;color:#1f2937;line-height:1.55}';
    echo '.btn{display:inline-block;background:#2563eb;color:#fff;padding:10px 18px;border-radius:8px;text-decoration:none;font-weight:600}';
    echo 'code{background:#f3f4f6;padding:2px 6px;border-radius:4px;font-size:13px;word-break:break-all}';
    echo '.ok{color:#15803d;font-weight:600}.err{color:#b91c1c;font-weight:600}.muted{color:#6b7280;font-size:14px}</style></head><body>';
    echo $body . '</body></html>';
    exit();
}

$client = new Google_Client();
$client->setApplicationName( 'PaCIM Monatsabrechnung' );
$client->setAuthConfig( $secretPath );
$client->addScope( 'https://www.googleapis.com/auth/drive' );
if ( $redirect ) $client->setRedirectUri( $redirect );
$client->setAccessType( 'offline' );
$client->setPrompt( 'consent' );

if ( ! isset( $_GET['code'] ) ) {
    gq_page( '<h1>Google Drive verbinden</h1><p>Diese Seite ist der OAuth-Callback. Bitte starte die Autorisierung über <a href="/gdrive_auth.php">gdrive_auth.php</a>.</p>' );
}

$token = $client->fetchAccessTokenWithAuthCode( $_GET['code'] );

if ( isset( $token['error'] ) ) {
    gq_page( '<h1 class="err">Autorisierung fehlgeschlagen</h1><p><code>' . htmlspecialchars( $token['error'] . ' – ' . ( $token['error_description'] ?? '' ) ) . '</code></p><p><a class="btn" href="/gdrive_auth.php">Erneut versuchen</a></p>' );
}

// refresh_token erhalten/übernehmen.
if ( empty( $token['refresh_token'] ) && file_exists( $credentialsPath ) ) {
    $old = json_decode( file_get_contents( $credentialsPath ), true );
    if ( is_array( $old ) && ! empty( $old['refresh_token'] ) ) $token['refresh_token'] = $old['refresh_token'];
}
$hasRefresh = ! empty( $token['refresh_token'] );
@file_put_contents( $credentialsPath, json_encode( $token ) );

gq_page(
    '<h1 class="ok">Google Drive verbunden ✓</h1>' .
    '<p>Das Zugriffstoken wurde gespeichert.' . ( $hasRefresh ? ' Ein <strong>refresh_token</strong> ist vorhanden – die Übertragung funktioniert dauerhaft.' : ' <span class="err">Achtung: kein refresh_token erhalten.</span> Bitte den Zugriff im Google-Konto (Sicherheit → Drittanbieter-Apps) entfernen und erneut verbinden.' ) . '</p>' .
    '<p class="muted">Du kannst dieses Fenster schließen und in der Buchhaltung „In Google Drive" übertragen.</p>'
);

Youez - 2016 - github.com/yon3zu
LinuXploit