Jump to content
MakeWebGames

Recommended Posts

Posted
if (!empty($error_msg)) {
  header('Location: /error_page.php?msg=1');
}

in your footer or something?

 

<?php

$error_msg = array(
	1 => 'error one', 
	2 => 'error two'
);
	$_GET['msg'] = (isset($_GET['msg']) && array_key_exists($_GET['msg'], $error_msg)) ? $_GET['msg'] : 1 ;
  echo '
<h1>Error!</h1>
'.$error_msg[$_GET['msg']];
?>

in error_msg.php

Posted

Just add this into .htaccess.

 

ErrorDocument 404 /ErrorPage.html

 

I don't fully understand what you want as your post doesn't make sence but If I'm thinking along the right lines it'll work, any time a user goes to a that file that doesnt exist it will re-direct them...

Posted

I don't think you Understand. ^^

What I would like is if a user is on a page e.g header.php directly it sends them to a error page. If there on a page than includes header.php they stay on the page..

Posted

On the file that you include header.php, above the include add this:

define('IN_GAME', true);

On top of header.php, add this:

if (!defined('IN_GAME'))

{

header('Location: error.php');

exit;

}

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.   Paste as plain text instead

  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...