I have this code as shown bellow:
session_start();
require_once 'classes/cookie.class.php';
if(!isset($_SESSION['logged']) && !Cookie::checkCookie($_COOKIE['smt_auth']))
{
header('Location: login.php');
exit;
}
?>
It's working right in localhost, as it redirects always to login.php if the user is not logged, neither has a cookie. But the problem comes when I try to put these files in the host, it stops working.
The two files using this are index.php and temario.php, when I try to introduce the url of index.php it redirects me to login.php but, in temario.php, the screen just gets blank and doesn't redirect.
Both files have the same PHP block (there are no white spaces as I copy&pasted from index.php to temario.php), so does somebody know why this could not be working in the host, but it does on localhost with xampp?
It's throwing the error:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /homepages/3/d507876316/htdocs/new/usuario/temario.php:1) in /homepages/3/d507876316/htdocs/new/usuario/temario.php on line 4
Also if I make a copy of index.php and rename it, it also works as intended.
Thanks in advance.
No comments:
Post a Comment