PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
// by group
<?php
include_once ("../auth.php");
include_once ("../authconfig.php");
include_once ("../check.php");
if (!($check['team']=='Group 1')
&& !($check['team']=='Group 3')
&&!($check['team'] =='Group 2'))
{
echo 'You are not allowed to access this page.';
exit();
}
?>
// by level
<?php
include_once ("../auth.php");
include_once ("../authconfig.php");
include_once ("../check.php");
if (($check['level'] < 4) || ($check['level'] > 6))
{
echo 'You are not allowed to access this page.';
exit();
}
?>
Meaning you can not send any content to a browser such as:
<html>
<Head>
...
And the ask it to redirect with header("location: page.php");
This is server script redirect which takes place without the user seeing the page. If you want to redirect after showing the user something use javascript or html reload.
more info info in the [php_man=header]manual[/php_man]
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.