Skip to content

Commit

Permalink
Users: Prevent ladder tour accounts from resetting W/L
Browse files Browse the repository at this point in the history
  • Loading branch information
Marty-D authored Jul 27, 2024
1 parent dd392d9 commit d3bd677
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pokemonshowdown.com/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@

// Ladder

if ($user['userid'] === $curuser['userid']) {
$ladderTourID = str_starts_with($user['userid'], 'lt11');
if ($user['userid'] === $curuser['userid'] && !$ladderTourID) {
if ($users->csrfCheck() && @$_POST['resetLadder']) {
$formatLadder = new NTBBLadder(@$_POST['resetLadder']);
if (substr($formatLadder->formatid, -7) !== 'current' && substr($formatLadder->formatid, -11) !== 'suspecttest') {
Expand All @@ -492,7 +493,7 @@
} else {
$bufs[$buftype] .= '<td style="text-align:center" colspan="2"><small style="color:#777">(more games needed)</small>';
}
if ($user['userid'] === $curuser['userid']) {
if ($user['userid'] === $curuser['userid'] && !$ladderTourID) {
$bufs[$buftype] .= '</td><td style="text-align:center"><small>' . $row['w'] . '</small></td><td style="text-align:center"><small>' . $row['l'] . '</small></td>';
if (substr($row['formatid'], -7) !== 'current' && substr($row['formatid'], -11) !== 'suspecttest') {
$bufs[$buftype] .= '<td><button name="openReset" value="'.htmlspecialchars($row['formatid']).'"><small>Reset</small></button></td>';
Expand Down Expand Up @@ -546,7 +547,7 @@
}
?>
<?php
if ($user['userid'] === $curuser['userid']) {
if ($user['userid'] === $curuser['userid'] && !$ladderTourID) {
?>
<tr style="display:none" class="ladderresetform">
<td colspan="7">
Expand Down

0 comments on commit d3bd677

Please sign in to comment.