Skip to content

Commit 1eaeb0d

Browse files
authored
Update index.php
1 parent 4c8334a commit 1eaeb0d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

index.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@
2020
*
2121
* index.php
2222
*
23-
* Bugzilla PHP Wrapper description of the file.
23+
* Bugzilla PHP Wrapper.
2424
*
2525
* @author Daniele Bonini <my25mb@aol.com>
2626
* @copyrights (c) 2016, 2024, 5 Mode
2727
*/
2828

29+
// Variables and constants
30+
define('BZ_WR_TIMEZONE', "Europe/Rome");
31+
define('BZ_WR_WEBSERVER', "nginx");
32+
define('BZ_WR_COOKIE_PATH', "/");
33+
define('BZ_WR_COOKIE_DOMAIN', "bugs.5mode.com");
34+
2935
// SCRIPT_NAME
3036
$f = filter_input(INPUT_GET, 'perl_script');
3137
if ($f === "" || $f === "/") {
@@ -52,15 +58,15 @@
5258

5359
// SERVER VARIABLES
5460
putenv("QUERY_STRING=$s");
55-
putenv("local_timezone=Europe/Rome");
56-
putenv("SERVER_SOFTWARE=nginx");
61+
putenv("local_timezone=".BZ_WR_TIMEZONE);
62+
putenv("SERVER_SOFTWARE=".BZ_WR_WEBSERVER);
5763
putenv("SERVER_NAME=" . $_SERVER['SERVER_NAME']);
5864
putenv("REQUEST_METHOD=" . $_SERVER['REQUEST_METHOD']);
59-
//putenv("REMOTE_ADDR=".$_SERVER['REMOTE_ADDR']);
65+
putenv("REMOTE_ADDR=" . $_SERVER['REMOTE_ADDR']);
6066
// Rebuilding the rest of $_SERVER variables environment..
6167
$serverEnvs = $_SERVER;
6268
foreach($serverEnvs as $key=>$val) {
63-
if (($key !== "QUERY_STRING") && ($key !== "SERVER_SOFTWARE") && ($key !== "SERVER_NAME") && ($key !== "REQUEST_METHOD")) {
69+
if (($key !== "QUERY_STRING") && ($key !== "SERVER_SOFTWARE") && ($key !== "SERVER_NAME") && ($key !== "REQUEST_METHOD") && ($key !== "REMOTE_ADDR")) {
6470
putenv("$key=".$val);
6571
}
6672
}
@@ -101,7 +107,7 @@
101107
// Parsing for the UserID on the Cookie request
102108
$userID = explode("=", explode(";", $row)[0])[1];
103109
// Creating the login cookie..
104-
setcookie("Bugzilla_login", $userID, time() + 999999999, "/", "bugs.5mode.com", true, true);
110+
setcookie("Bugzilla_login", $userID, time() + 999999999, BZ_WR_COOKIE_PATH, BZ_WR_COOKIE_DOMAIN, true, true);
105111
} else {
106112
if ((mb_strpos($row, "--------- =") === false) && (mb_strpos($row, "WARNING:") === false)) {
107113
header($row);

0 commit comments

Comments
 (0)