I found a securtity script online and i wanna combine it with my shoppingcart system. the security script requires me to put one php include as the first line of every page i wanna secure, as simple as it gets. Unless you get these damn header problems.
I think the problem is caused by the fact i try to submit the headers twice. Once in the main file and once in the file i included. So in one page hes trying to send the headers twice. If i delete the headers line in the include file the security system doesn't work anymore, if i delete the headers lines in the mail file the cart doesn't work anymore. Does anyone have a clue how to solve this? I posted the includefile and the errormsg below.
Thanks
==================================
Here is the includefile and the complete errorline:
<?php
// Variables
// Path to the config file.
$config = "conf.php";
// End Variables
// Load config file.
require($config);
// Start session, get vars.
session_start("pageprotect");
session_register('valid');
session_register('username');
session_register('name');
if($valid!=strrev(soundex(name).md5($username))) {
// Redirect if not authorised.
header("location: $login_page?cmd=unauth&".SID);
exit;
}
else {
// Otherwise display page:
header ("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header ("Pragma: no-cache");
echo "<!-- Page Protected By: PHPPageProtect V$version: [url]http://php.warpedweb.net/[/url] -->\n";
}
// User functions:
function print_name() {
echo $GLOBALS[name];
}
function print_username() {
echo $GLOBALS[username];
}
function print_logout_url() {
echo $GLOBALS[login_page]."?cmd=logout&".SID;
}
function print_first_page_url() {
echo $GLOBALS[first_page]."?".SID;
}
?>
Errormsg: Warning: Cannot add header information - headers already sent by (output started at /home/httpd/vhosts/verticaldot.com/httpdocs/boutsen/cart2/protect.php:61)