mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-23 11:37:14 +00:00
addTroops and addABTroops are POSTed to directly, bypassing admin.php's central csrf_verify(). Add csrf_verify() (after the admin access check, via the shared GameEngine/Admin/csrf.php) and csrf_field() in their forms. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,7 @@ if(isset($id)){
|
|||||||
|
|
||||||
<div class="ab-wrap">
|
<div class="ab-wrap">
|
||||||
<form action="../GameEngine/Admin/Mods/addABTroops.php" method="POST">
|
<form action="../GameEngine/Admin/Mods/addABTroops.php" method="POST">
|
||||||
|
<?php echo csrf_field(); ?>
|
||||||
<input type="hidden" name="id" value="<?php echo $_GET['did']; ?>">
|
<input type="hidden" name="id" value="<?php echo $_GET['did']; ?>">
|
||||||
<input type="hidden" name="admid" value="<?php echo $_SESSION['id']; ?>">
|
<input type="hidden" name="admid" value="<?php echo $_SESSION['id']; ?>">
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ if(isset($id)){
|
|||||||
|
|
||||||
<div class="addtroops-wrap">
|
<div class="addtroops-wrap">
|
||||||
<form action="../GameEngine/Admin/Mods/addTroops.php" method="POST">
|
<form action="../GameEngine/Admin/Mods/addTroops.php" method="POST">
|
||||||
|
<?php echo csrf_field(); ?>
|
||||||
<input type="hidden" name="id" value="<?php echo $_GET['did']; ?>">
|
<input type="hidden" name="id" value="<?php echo $_GET['did']; ?>">
|
||||||
<input type="hidden" name="admid" value="<?php echo $_SESSION['id']; ?>">
|
<input type="hidden" name="admid" value="<?php echo $_SESSION['id']; ?>">
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
|||||||
die("Access Denied: You are not Admin!");
|
die("Access Denied: You are not Admin!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue #139: this Mod is POSTed to directly, so it must verify the CSRF token
|
||||||
|
// itself (it does not go through admin.php's central csrf_verify()).
|
||||||
|
require_once(__DIR__ . '/../csrf.php');
|
||||||
|
csrf_verify();
|
||||||
|
|
||||||
include_once __DIR__ . "/../../Database.php";
|
include_once __DIR__ . "/../../Database.php";
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ if (empty($_SESSION['access']) || $_SESSION['access'] < 9) {
|
|||||||
die(defined('ACCESS_DENIED_ADMIN') ? ACCESS_DENIED_ADMIN : 'Access Denied: You are not Admin!');
|
die(defined('ACCESS_DENIED_ADMIN') ? ACCESS_DENIED_ADMIN : 'Access Denied: You are not Admin!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue #139: this Mod is POSTed to directly, so it must verify the CSRF token
|
||||||
|
// itself (it does not go through admin.php's central csrf_verify()).
|
||||||
|
require_once(__DIR__ . '/../csrf.php');
|
||||||
|
csrf_verify();
|
||||||
|
|
||||||
include_once __DIR__ . "/../../Database.php";
|
include_once __DIR__ . "/../../Database.php";
|
||||||
include_once __DIR__ . "/../../Technology.php";
|
include_once __DIR__ . "/../../Technology.php";
|
||||||
include_once __DIR__ . "/../../Data/unitdata.php";
|
include_once __DIR__ . "/../../Data/unitdata.php";
|
||||||
|
|||||||
Reference in New Issue
Block a user