jameshm26 Posted January 24, 2008 Share Posted January 24, 2008 Hi! Im having some problems with getting a redirect to work and for the life of me i have no idea why. Ive got a function been pulled in from a separate php page, and ive also got a session page all set up. What i want to happen is for the page to redirect to login if you try to get to a page that you have got to by logging in. Basically when i clear cookies and refresh staff.php i get this message: Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\widget_corp\includes\header.php:10) in C:\wamp\www\widget_corp\includes\functions.php on line 23 Here are the function and staff page code: function.php: function redirect_to( $location = NULL ) { if ($location != NULL) { header("Location: {$location}"); exit; } } staff.php: <?php require_once("includes/session.php"); ?> <?php require_once("includes/functions.php"); ?> <?php include("includes/header.php"); ?> <?php if (!isset($_SESSION['user_id'])){ redirect_to("login.php"); } ?> Be great if anyone could shed some light on this. Thanks! Link to comment https://forums.phpfreaks.com/topic/87535-redriect-problems/ Share on other sites More sharing options...
trq Posted January 24, 2008 Share Posted January 24, 2008 Did you read the big HEADER ERRORS sticky at the top of this forum? Link to comment https://forums.phpfreaks.com/topic/87535-redriect-problems/#findComment-447712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.