Files
Surillya-Login/index.php
surillya 386451b2d5 Reddirect handler
Included a handler to show how you could get session data. In this case, if user is logged in, they get shown the profile page, instead of the sign-in page. You can customize this to anything, for example removing the login button, and replacing it with the profile picture of Gravatar or something.
2025-05-17 15:39:46 -04:00

49 lines
1.4 KiB
PHP

<?php
$token = $_SESSION['access_token'] ?? $_COOKIE['access_token'] ?? null;
if ($token) {
header("Location: profile.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login with Surillya</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
background: #1a1a2e;
}
.sparkle:hover {
animation: sparkle 0.8s infinite;
}
@keyframes sparkle {
0% { filter: brightness(1); }
50% { filter: brightness(1.4); }
100% { filter: brightness(1); }
}
</style>
</head>
<body class="flex items-center justify-center min-h-screen text-white">
<div class="bg-[#2d2d44] p-10 rounded-2xl shadow-2xl w-full max-w-md text-center">
<h1 class="text-3xl font-bold text-pink-300 mb-6">Welcome to CoolClient</h1>
<p class="mb-4 text-gray-300">Login using your Surillya account</p>
<?php
$client_id = 'your_client_id';
$redirect_uri = urlencode('your_full_callback_script_url.php');
$auth_url = "https://surillya.com/id/authorize.php?response_type=code&client_id=$client_id&redirect_uri=$redirect_uri";
?>
<a href="<?= $auth_url ?>">
<center>
<img src="https://surillya.com/id/button.svg" alt="Continue with SurillyaID" />
</center>
</a>
</div>
</body>
</html>