-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
74 lines (61 loc) · 2.1 KB
/
Copy pathindex.php
File metadata and controls
74 lines (61 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/* Home Page
* The home page of the working demo of oauth2 script.
* @author : MarkisDev
* @copyright : https://markis.dev
*/
# Enabling error display
error_reporting(E_ALL);
ini_set('display_errors', 1);
# Including all the required scripts for demo
require __DIR__ . "/includes/functions.php";
require __DIR__ . "/includes/discord.php";
require __DIR__ . "/config.php";
# ALL VALUES ARE STORED IN SESSION!
# RUN `echo var_export([$_SESSION]);` TO DISPLAY ALL THE VARIABLE NAMES AND VALUES.
# FEEL FREE TO JOIN MY SERVER FOR ANY QUERIES - https://join.markis.dev
?>
<html>
<head>
<title>Demo - Discord Oauth</title>
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<header> <span class="logo">Demo - Discord Oauth</span>
<span class="menu">
<?php
$auth_url = url($client_id, $redirect_url, $scopes);
if (isset($_SESSION['user'])) {
echo '<a href="includes/logout.php"><button class="log-in">LOGOUT</button></a>';
} else {
echo "<a href='$auth_url'><button class='log-in'>LOGIN</button></a>";
}
?>
</span>
</header>
<h1 style="text-align: center;">A Simple Working Demo of the Script </h2>
<?php
if (!isset($_SESSION['user'])) {
echo "<h2 style='color:red; font-weight:900; text-align: center;'> LOGIN WITH THE LINK ABOVE TO SEE IT WORK! </h2><br/>";
echo "<h4 style='color:red; font-weight:500; text-align: center;'> IGNORE THE ERRORS IF YOU HAVEN'T LOGGED IN! </h4>";
}
if (isset($_SESSION['user'])) {
?>
<h2> User Details :</h2>
<p> Name : <?php echo $_SESSION['username'] . '#' . $_SESSION['discrim']; ?></p>
<p> ID : <?php echo $_SESSION['user_id']; ?></p>
<?php
if (isset($_SESSION['email'])) {
echo '<p> Email: ' . $_SESSION['email'] . '</p>';
}
?>
<p> Profile Picture : <img src="https://cdn.discordapp.com/avatars/<?php $extention = is_animated($_SESSION['user_avatar']);
echo $_SESSION['user_id'] . "/" . $_SESSION['user_avatar'] . $extention; ?>" /></p>
<br>
<h2>User Response :</h2>
<div class="response-block">
<p><?php echo json_encode($_SESSION['user']); ?></p>
</div>
<?php } ?>
</body>
</html>