Skip to content

Commit 47af30e

Browse files
committed
Include common settings and xssClean output
inlcude_once the settings-common.php file so we have the xssClean function Set $req to the xssClean'd value or blank Also xssClean other strings that are output
1 parent 277dc67 commit 47af30e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/headers.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
<?php
2-
// Start a session if we haven't already
3-
if(!isset($_SESSION)) {@session_start();}
2+
// Load common functions
3+
include_once(dirname(__FILE__)."/settings-common.php");
44

55
// CSRF synchronizer token pattern, 32 chars
66
if (!isset($_SESSION["csrf"])) {
77
$_SESSION["csrf"] = md5(uniqid(mt_rand(), true));
88
}
99

1010
if (($_GET || $_POST) && (!isset($_REQUEST["csrf"]) || $_REQUEST["csrf"] !== $_SESSION["csrf"])) {
11+
$req = isset($_REQUEST["csrf"]) ? xssClean($_REQUEST["csrf"],"html") : "";
1112
die("Bad CSRF token. Please report the error info at https://github.com/mattpass/ICEcoder so it can be fixed.<br><br>
1213
CSRF issue:<br>
13-
REQUEST: ".$_REQUEST["csrf"]."<br>
14-
SESSION: ".$_SESSION["csrf"]."<br>
15-
FILE: ".$_SERVER["SCRIPT_NAME"]."<br>
16-
GET: ".var_export($_GET, true)."<br>
17-
POST: ".var_export($_POST, true)."<br>
14+
REQUEST: ".$req."<br>
15+
SESSION: ".xssClean($_SESSION["csrf"],"html")."<br>
16+
FILE: ".xssClean($_SERVER["SCRIPT_NAME"],"html")."<br>
17+
GET: ".xssClean(var_export($_GET, true),"html")."<br>
18+
POST: ".xssClean(var_export($_POST, true),"html")."<br>
1819
<br>Many thanks!");
1920
}
2021

0 commit comments

Comments
 (0)