I've two pages: index.php and register.php.
If the user is guest, he can click on register.php-->go to that page-->register a form and login. Upon logging in, he is redirected to index.php. Now if he/she tries to access signup.php-->they are automatically redirected to index.php.
I'm using:
<?php
if(!isset($_SESSION['id']))
{
//show the form
....
}
else
{
header("Location: index.php");
exit;
}
?>
How ever, I'm getting a Cannot modify header information error.
How else can I make the code to redirect when index.php and register.php are two separate pages.