Jump to content

Recommended Posts

I am getting an Illegal Redirection error trying to redirect to an absolutely valid URL. I can't seem to fix this problem, and I know that there is no whitespace causing this issue to fail.

 

<?php
	if (!array_key_exists('token', $_SESSION) || !isset($_POST['token']) || is_null($_POST['token']) ||  $_SESSION['token'] !== $_POST['token']) {
   		$msg = ERROR_MESSAGE . ' tokencheck.php ' . date('Y-m-d H:i:s') . ' Illegal redirection from "' . $_SERVER['HTTP_REFERER'] . '"';
		toLogDB($msg);
		error_log($msg);
		header('Location: ' . ERROR_FULL_URL);
		die();
	}
?>
<?php

	ini_set('session.gc_maxlifetime', 60 * 10);
	session_start();
	require('./globals/constants.php');
	require('./globals/functions.php');
	require('./globals/crypto.php');
	require('./feedback/includes/constants.php');
	require('./feedback/includes/globals.php');
	require('./feedback/includes/functions.php');
	require('./feedback/includes/delivery.php');
	require('./feedback/includes/validation.php');
	require('./feedback/includes/tokencheck.php');

	// REST OF THE CODE
?>

 

Link to comment
https://forums.phpfreaks.com/topic/330151-illegal-redirection-using-header/
Share on other sites

are you getting an error from the browser about redirecting (it would be a http xxx error number) or is this your - ' Illegal redirection from ...' message?

note: require is not a function. the () around the path/filename do nothing and should be removed.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.