PHP include
Jeg har et problem med PHP include.Jeg får denne fejlmeddelelse:
Warning: Cannot add header information - headers already sent by (output started at /customers/sjovert.dk/sjovert.dk/httpd.www/download/pafiledb.php:11) in /customers/sjovert.dk/sjovert.dk/httpd.www/download/includes/download.php on line 15
Jeg bruger dette skelet:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Sjovert</title>
</head>
<body>
<table align="center" cellpadding="0">
<tr>
<td colspan="2" height="19"><div align="center">
<?php
require("top.php");
?>
</div></td></tr>
<tr height"100%"><td valign="top" height="100%"><div>
<?php
require("menu.php");?></div></td>
<td valign="top" class="midten">
/*indholdet kommer her*/
</td></tr>
<tr><td height="40"> <div align="center"> <br>
</div></td>
<td height="40"><div align="center">
<?php
require("bund.php");
?>
</div></td>
</tr>
</table>
</body>
</html>
Det er gået fint indtil jeg satte dette indhold ind:
<?php
if (file_exists("./install.php")) { die("Error: The file install.php (paFileDB installer) still exists on the server! This is a security risk! Please delete the file to continue using paFileDB."); }
$starttime = microtime();
$starttime = explode(" ",$starttime);
$starttime = $starttime[1] + $starttime[0];
$authmethod = "cookies"; //Set this to 'cookies' to use cookies to log you in (recommended.) If you're having problems with cookies, set this to 'sessions' and make sure a 'sessions' directory exists and is CHMODed to 777 (on *nix servers)
if ($authmethod == "sessions") {
session_save_path("./sessions");
session_start();
}
require "./includes/mysql.php";
require "./includes/functions.php";
$pafiledb_sql->connect($db);
$config = $pafiledb_sql->query($db,"SELECT * FROM $db[prefix]_settings",1);
require "./lang/$config[13].php";
if ($login == "do") { include "./includes/$action/login.php"; exit; }
if ($ad == "logout") { include "./includes/admin/logout.php"; exit; }
if ($tm == "logout") { include "./includes/team/logout.php"; exit; }
$logged = "";
require "./includes/admin/auth.php";
require "./includes/team/auth.php";
if ($action == "download") {
include "./includes/download.php";
exit();
}
if ($logged == 1 && $ad == "backupdb") {
include "includes/admin/backupdb.php";
exit();
}
?>
<html>
<head>
<title>Sjoverts Downloads</title>
<style type="text/css">
<?php include "./styles/$config[11]/style.css"; ?>
</style>
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<center>
<!--Begin main table-->
<table width="100%" height="99%" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF" class="table">
<tr>
<td width="100%" height="100%" valign="top">
<!--Begin header table-->
<table width="100%" height="100" border="0" cellpadding="2" cellspacing="0" class="table">
<tr>
<td width="25%" valign="center" align="center">
<a href="pafiledb.php"><font size="5">Start</font></a>
</td><td width="75%" valign="center" align="right">
<font size="5">
<a href="pafiledb.php?action=search">Søg</a> <a href="pafiledb.php?action=stats">Statestik</a> <a href="<?php echo $config[5]; ?>">Sjovert</a>
</font>
</td></tr></table>
<!--End header table-->
<!--Begin page table-->
<?php
if ($logged == 1 && $ad != "logout") {
$width = 100;
} else {
$width = 80;
}
?>
<table width="<?php echo $width; ?>%" height="30" border="0" cellpadding="2" cellspacing="0" class="table" align="center">
<tr>
<td width="100%" valign="top" align="left" colspan="2">
<?php
$disable = $config[16];
if ($logged)
$disable = 0;
if ($action == "admin")
$disable = 0;
if ($teamlogged == 1 && $action !== "team")
tmlocbar("",$tuser,$str);
if ($teamlogged == 1 && $action == "team")
tmlocbar("<a href=\"pafiledb.php\" class=\"small\">$config[1]</a> :: $str[teamcenter]",$tuser, $str);
if (!$disable) {
switch ($action) {
case category:
include "./includes/category.php";
break;
case file:
include "./includes/file.php";
break;
case viewall:
include "./includes/viewall.php";
break;
case search:
include "./includes/search.php";
break;
case license:
include "./includes/license.php";
break;
case rate:
include "./includes/rate.php";
break;
case admin:
include "./includes/admin.php";
break;
case team:
include "./includes/team.php";
break;
case email:
include "./includes/email.php";
break;
case stats:
include "./includes/stats.php";
break;
default:
include "./includes/main.php";
break;
}
} else {
?>
<table width="100%" border="1" cellpadding="2" cellspacing="0" class="headertable" bordercolor="#000000">
<tr><td width="100%" colspan="2" class="headercell"><center><b>paFileDB</b></center></td></tr>
<tr><td width="5%" class="datacell" align="center" valign="middle"><img src="styles/<?php echo $config[11]; ?>/images/error.gif" border="0"></td><td width="95%" class="datacell"><?php echo $str[isdisabled]; ?>
</td></tr></table>
<?php
}
?>
</td></tr>
<tr>
<td width="50%" align="left">
<?php jumpmenu($db,$HTTP_SERVER_VARS['REQUEST_URI'],$pafiledb_sql,$str); ?>
</td><td width="50%" align="right"><?php echo "$str[time] $config[8]"; ?></td></tr></table>
<!--End page table-->
<!--Begin footer table-->
<table width="100%" height="30" border="0" cellpadding="2" cellspacing="0" class="footer">
<tr>
<td width="100%" valign="center" align="center">
</td></tr>
<tr><td width="100%" valign="center" align="center">
<?php
$endtime = microtime();
$endtime = explode(" ",$endtime);
$endtime = $endtime[1] + $endtime[0];
$stime = $endtime - $starttime;
if ($config[12] == 1) {
?>
<table width="30%" border="1" cellpadding="2" class="stats" bordercolor="#000000">
<tr><td width="50%" align="left"><?php echo $str[exectime]; ?>:</td><td width="50%" align="right"><?php echo round($stime,4); ?> Seconds</td></tr>
<tr><td width="50%" align="left"><?php echo $str[numqueries]; ?>:</td><td width="50%" align="right"><?php echo $query_count; ?> Queries</td></tr>
</table>
<?php
if ($showqueries == 1) {
?>
<p>
<table width="100%" border="1" cellpadding="2" class="headertable" bordercolor="#000000">
<tr><td width="100%" class="headercell" align="center"><b>Queries Used</b></td></tr>
<?php echo $queries_used; ?>
</table>
<?php
}
}
?>
Ved godt at det er noget med at det også bruger includes, men kan ikke løse det.
