已经发送的标题

时间:2014-02-25 06:44:04

标签: php html session header hosting

我刚刚切换主机。一切都习以为常。我现在已经将所有文件复制到新的ftp服务器上,设置了数据库等等。但是我在每一页都收到了这些消息:

警告:session_start()[function.session-start]:无法发送会话cookie - 已在/ home /中发送的输出(/home/pesterlo/public_html/core/init.inc.php:15中的输出)第23行的pesterlo / public_html / core / init.inc.php

警告:session_start()[function.session-start]:无法发送会话缓存限制器 - 已在/ home /中发送的报头(输出从/home/pesterlo/public_html/core/init.inc.php:15开始)第23行的pesterlo / public_html / core / init.inc.php

警告:无法修改标题信息 - 已经发送的标题(/home/pesterlo/public_html/core/init.inc.php:15中的输出开始)/home/pesterlo/public_html/core/init.inc.php在第36行

这是init.inc.php文件(-database connection):

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="ext/css/main.css" />
<title>PesterLog</title>
 <link rel="icon" type="image/x-icon" href="favicon.ico" />
  <link rel="shortcut icon" href="images/favicon.ico" />
    <link rel="apple-touch-icon" href="apple-touch-icon.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72.png" />
    <link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114x114.png" />
    <script type="text/javascript" src="http://pesterlog.tk/core/pages/js/jquery_1.5.2.js"></script>
<script type="text/javascript" src="http://pesterlog.tk/core/pages/js/loaded_contents.js"></script>
    </head>

<?php
date_default_timezone_set('Europe/London');
$core_path = dirname(__FILE__);
if (empty($_GET['page']) || in_array("{$_GET['page']}.page.inc.php", scandir("{$core_path}/pages")) == false){
header('HTTP/1.1 404 Not Found');
header('Location: index.php?page=inbox');
die();
}
session_start();
echo mysql_error();

//connects to database

include("{$core_path}/inc/user.inc.php");
include("{$core_path}/inc/private_message.inc.php");

if (isset($_POST['user_name'], $_POST['user_password'])){
    if (($user_id = validate_credentials($_POST['user_name'], $_POST['user_password'])) !== false){
        $_SESSION['user_id'] = $user_id;

        header('Location: index.php?page=inbox');

        die();
    }
}

if (empty($_SESSION['user_id']) && $_GET['page'] !== 'login'){
    header('http/1.1 403 Forbidden');
    header('location: index.php?page=login');

    die();
}

$include_file = "{$core_path}/pages/{$_GET['page']}.page.inc.php";

?>

请帮帮我。

提前谢谢

1 个答案:

答案 0 :(得分:0)

删除mysql_error()。使用ob_start();在date_default_timezone_set();

之前
相关问题