ErrorException
PHP 8.0.30
Undefined array key "HTTP_REFERER"
central / head_check_referer_and_set_security.php: 35
				the if not already redirected does not work on logout... why does it think it is a differet site?
}
*/

if ($login_http_or_https == 'https') {
	if ($user->state == 'in') { // if the user is logged in
		$redirectto = 'Location: https://'.$config_urlbase.$_SERVER['REQUEST_URI'].'&switchedtosecure=1'.$passOnSecureSwitch;
		// if the page reffered to by the same site
		if ( '//'.$config_urlbase == substr(str_replace(array('http:','https:'),array('',''),$_SERVER["HTTP_REFERER"]),0,2+strlen($config_urlbase))) {
			if (substr($_SERVER["HTTP_REFERER"],0,5) == 'http:') {
				if ($_GET['switchedtosecure'] == 1) $temp = 0; else header( $redirectto );
			}
		} else { //if the page was reffered to by someone else, or was typed in.
			//if the page was already redirected do nothing, otherwise redirect
			if ($_GET['switchedtosecure'] == 1) $temp = 0; else header( $redirectto );
		}
	} else { // if the user is not logged in
		$redirectto = 'Location: http://'.$config_urlbase.$_SERVER['REQUEST_URI'].'&switchedtoregular=1';
		// if the page reffered to by the same site
		if ( '//'.$config_urlbase == substr(str_replace(array('http:','https:'),array('',''),$_SERVER["HTTP_REFERER"]),0,2+strlen($config_urlbase))) {
			if (substr($_SERVER["HTTP_REFERER"],0,5) == 'https') {
				if ($_GET['switchedtoregular'] == 1) $temp = 0; header( $redirectto );
			}
		} /*else { //if the page was reffered to by someone else, or was typed in.
			//if the page was already redirected do nothing, otherwise redirect
			if ($_GET['switchedtoregular'] == 1) $temp = 0; else header( $redirectto );
		} BREAKS ON LOG OUT IF UNCOMMENTED */
	}
}
?>

Request

http://2007.solarteam.org/central/page.php/?id=800
GET
curl "http://2007.solarteam.org/central/page.php/?id=800" \
   -X GET \
   -H 'cf-ray: 9280e2619915e830-ORD' \
   -H 'x-forwarded-for: 18.218.242.4' \
   -H 'host: 2007.solarteam.org' \
   -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
   -H 'accept-encoding: gzip' \
   -H 'cf-ipcountry: US' \
   -H 'x-forwarded-proto: http' \
   -H 'user-agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)' \
   -H 'upgrade-insecure-requests: 1' \
   -H 'cf-visitor: {"scheme":"http"}' \
   -H 'cache-control: no-cache' \
   -H 'pragma: no-cache' \
   -H 'cf-connecting-ip: 18.218.242.4' \
   -H 'cdn-loop: cloudflare; loops=1' \
   -H 'connection: Keep-Alive';

Browser

Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)

Headers

cf-ray
9280e2619915e830-ORD
x-forwarded-for
18.218.242.4
host
2007.solarteam.org
accept
text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
accept-encoding
gzip
cf-ipcountry
US
x-forwarded-proto
http
user-agent
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
upgrade-insecure-requests
1
cf-visitor
{"scheme":"http"}
cache-control
no-cache
pragma
no-cache
cf-connecting-ip
18.218.242.4
cdn-loop
cloudflare; loops=1
connection
Keep-Alive

Query String

id
800

Body

[]

Context

Versions

Php Version
8.0.30