forked from SWU-Petranaki/SWUOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfilePage.php
More file actions
136 lines (113 loc) · 4.34 KB
/
ProfilePage.php
File metadata and controls
136 lines (113 loc) · 4.34 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="./jsInclude.js"></script>
<?php
require "MenuBar.php";
if (!isset($_SESSION['userid'])) {
header('Location: ./MainMenu.php');
die();
}
include_once "CardDictionary.php";
include_once "./Libraries/UILibraries2.php";
include_once "./APIKeys/APIKeys.php";
/*
$badges = LoadBadges($_SESSION['userid']);
echo ("<div class='ContentWindow' style='position:relative; width:50%; left:20px; top:20px; height:200px;'>");
echo ("<h1>Your Badges</h1>");
for ($i = 0; $i < count($badges); $i += 7) {
$bottomText = str_replace("{0}", $badges[$i + 2], $badges[$i + 4]);
$fullText = $badges[$i + 3] . "<br><br>" . $bottomText;
if ($badges[$i + 6] != "") echo ("<a href='" . $badges[$i + 6] . "'>");
echo ("<img style='margin:3px; width:120px; height:120px; object-fit: cover;' src='" . $badges[$i + 5] . "'></img>");
if ($badges[$i + 6] != "") echo ("</a>");
}
echo ("</div>");
*/
// Calculate default dates
$startDate = date('Y-m-d', strtotime('-1 month'));
$endDate = date('Y-m-d');
?>
<script>
$(document).on('click', '#filterButton', function() {
console.log("Filter button clicked!"); // Debugging line
$.ajax({
url: 'zzGameStats.php',
type: 'GET',
data: $('#filterForm').serialize(),
success: function(data) {
console.log("AJAX Response:", data); // Log the response data
$('#statsContainer').html(data);
},
error: function(xhr, status, error) {
console.error('AJAX Error: ' + status + ' ' + error);
}
});
});
</script>
<?php
include_once 'Header.php';
?>
<div id="cardDetail" style="z-index:100000; display:none; position:fixed;"></div>
<div class="core-wrapper">
<div class='fav-decks container bg-black'>
<h2>Welcome <?php echo $_SESSION['useruid'] ?>!</h2>
<?php
DisplayPatreon();
echo ("<h2>Favorite Decks</h2>");
$favoriteDecks = LoadFavoriteDecks($_SESSION["userid"]);
if (count($favoriteDecks) > 0) {
echo ("<table>");
echo ("<tr><td>Hero</td><td>Deck Name</td><td>Delete</td></tr>");
for ($i = 0; $i < count($favoriteDecks); $i += 4) {
echo ("<tr>");
echo ("<td>" . CardLink($favoriteDecks[$i + 2], $favoriteDecks[$i + 2], true) . "</td>");
echo ("<td>" . $favoriteDecks[$i + 1] . "</td>");
echo ("<td><a style='text-underline-offset:5px;' href='./MenuFiles/DeleteDeck.php?decklink=" . $favoriteDecks[$i] . "'>Delete</a></td>");
echo ("</tr>");
}
echo ("</table>");
}
?>
<h2>Block List</h2>
<form class="form-resetpwd" action="includes/BlockUser.php" method="post">
<input class="block-input" type="text" name="userToBlock" placeholder="User to block">
<button type="submit" name="block-user-submit">Block</button>
</form>
</div>
<div class='stats container bg-black'>
<form id="filterForm">
<input type="date" name="startDate" value="<?php echo $startDate; ?>">
<input type="date" name="endDate" value="<?php echo $endDate; ?>">
<button type="button" id="filterButton">Filter Stats</button>
</form>
<?php
echo ("<h2>Your Record</h2>");
$forIndividual = true; ?>
<div id="statsContainer">
<p id="loadingMessage" style="display:none;">Loading stats...</p>
<?php include "zzGameStats.php"; ?>
</div>
</div>
</div>
<?php
function DisplayPatreon() {
global $patreonClientID, $patreonClientSecret;
$client_id = $patreonClientID;
$client_secret = $patreonClientSecret;
$redirect_uri = "https://www.karabast.net/SWUOnline/PatreonLogin.php";
$href = 'https://www.patreon.com/oauth2/authorize?response_type=code&client_id=' . $client_id . '&redirect_uri=' . urlencode($redirect_uri);
$state = array();
$state['final_page'] = 'https://karabast.net/SWUOnline/MainMenu.php';
$state_parameters = '&state=' . urlencode(base64_encode(json_encode($state)));
$href .= $state_parameters;
$scope_parameters = '&scope=identity%20identity.memberships';
$href .= $scope_parameters;
if (!isset($_SESSION["patreonAuthenticated"])) {
echo '<a class="containerPatreon" href="' . $href . '">';
echo ("<img class='imgPatreon' src='./Assets/patreon-php-master/assets/images/login_with_patreon.png' alt='Login via Patreon'>");
echo '</a>';
} else {
include './zzPatreonDebug.php';
}
}
require "Disclaimer.php";
?>