From be843e7074e31b8fe13fcac62d2dc1653389dcc6 Mon Sep 17 00:00:00 2001 From: surillya Date: Fri, 16 May 2025 13:58:39 -0400 Subject: [PATCH] Initial Commit --- cb.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ index.php | 40 ++++++++++++++++++++++++++++++++++++++++ logout.php | 9 +++++++++ profile.php | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 cb.php create mode 100644 index.php create mode 100644 logout.php create mode 100644 profile.php diff --git a/cb.php b/cb.php new file mode 100644 index 0000000..367d7a6 --- /dev/null +++ b/cb.php @@ -0,0 +1,48 @@ + $client_id, + 'client_secret' => $client_secret, + 'code' => $code +])); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +$response = curl_exec($ch); +curl_close($ch); + +$data = json_decode($response, true); +if (isset($data['access_token'])) { + $_SESSION['access_token'] = $data['access_token']; + + setcookie("access_token", $data['access_token'], time() + 7*24*60*60, "/", "", true, true); + + header("Location: profile.php"); + exit; +} else { + echo "Failed to log in!"; +} +?> + + +Welcome! + + +

Logged in as ()

+ +

Something went wrong logging you in :(

+ + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..6468dd7 --- /dev/null +++ b/index.php @@ -0,0 +1,40 @@ + + + + + + Login with Surillya + + + + +
+

Welcome to CoolClient

+

Login using your Surillya account

+ + + + + + +
+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..9757a12 --- /dev/null +++ b/logout.php @@ -0,0 +1,9 @@ + + + +Welcome, <?= htmlspecialchars($user['name']) ?>! + +

Hello, !

+

Email:

+ + +