网站后台登陆页面admin.php出现几个错误,如下:Warning: Cannot modify header information - headers already sent by (output started at /var/pak/virtual/gms/admin.php:1) in /var/pak/virtual/gms/admin.php on line 5Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/pak/virtual/gms/admin.php:1) in /var/pak/virtual/gms/class/session.class.php on line 64Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/pak/virtual/gms/admin.php:1) in /var/pak/virtual/gms/class/session.class.php on line 64Warning: session_module_name() [function.session-module-name]: A session is active. You cannot change the session module's ini settings at this time in /var/pak/virtual/gms/class/session.class.php on line 66后台管理登录
用户名:
密 码:
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
用户名:
密 码:
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
<?php
ob_start();
$startTime = explode(" ",microtime());
$startTime = $startTime[0] + $startTime[1];
header("Content-type: text/html; charset=utf-8");
require_once("config.php");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
set_magic_quotes_runtime(0);define("PHPOK_SET", TRUE);
$system_time = $systemTime = time();
#[设置读取版本信息]
include_once("version.php");
#[POST,GET等变量管理]
if(PHP_VERSION < "4.1.0")
{
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
$_COOKIE = &$HTTP_COOKIE_VARS;
$_SERVER = &$HTTP_SERVER_VARS;
$_ENV = &$HTTP_ENV_VARS;
$_FILES = &$HTTP_POST_FILES;
}$magic_quotes_gpc = get_magic_quotes_gpc();
@extract(daddslashes($_POST));
@extract(daddslashes($_GET));
if(!$magic_quotes_gpc) {
$_FILES = daddslashes($_FILES);
}
#[加载数据库]
if(!file_exists("./class/".$connectDbType.".db.class.php"))
{
die("File:".$connectDbType.".db.class.php NOT EXISTS");
}require_once("./class/".$connectDbType.".db.class.php");
$DB = new qgSQL($dbHost,$dbData,$dbUser,$dbPass,$dbOpenType);
#[设置Session信息]
include_once("./class/session.class.php");#[加载常用函数]
include_once("./include/admin.func.php");
//die("程序测试探针");
if(!session_is_registered("admin")) session_register("admin");
#[头部信息]
echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
#echo "<Meta http-equiv='Expires' Content='Wed, 26 Feb 1997 08:21:57 GMT'>";
echo "<Meta http-equiv='Pragma' Content='No-cache'>";#[判断会员是否已经登录]
if($_SESSION["admin"]["user"] && $_SESSION["admin"]["pass"] && strpos($act,"login") === false && $act != "logout")
{
echo "<title> 后台管理 </title>";
if(empty($file))
{
echo "</head>";
#[注意,这里使用框架一定要放在<body>之前,不然是不会显示的噢!]
echo "<frameset cols='206,*' border='0'><frame src='admin.php?file=left' name='FLeft' id='FLeft' noresize scrolling='yes' style='overflow-x:hidden'><frame src='admin.php?file=index' noresize border='0' frameborder='0' scrolling='yes' style='overflow-x:hidden' name='main' id='main'></frameset>";
echo "<body></body></html>";
exit();
}
else
{
if($file != "left")
{
include_once("./admin/tpl/css.htm");
echo "</head2><body>";
#[加载头部广告信息及语言选择]
if(strpos($file,"open.") === false)
{
include_once("./admin/right.head.php");
}
}
else
{
echo "</head><body>";
}
if(file_exists("./admin/".$file.".qg.php"))
{
#[加载其他常规操作信息]
if($file != "left")
{
include_once("./class/file.class.php");
$FS = new files();
#[加载系统常规信息配置]
if(file_exists("./data/system_set_".$language.".php"))
{
include_once("./data/system_set_".$language.".php");
}
else
{
$system["timeRevise"] = "0";
$system["timeZone"] = "8";
$system["gdState"] = "1";
$system["gdThumbWidth"] = "160";
$system["gdThumbHeight"] = "120";
$system["gdMarkWidth"] = "640";
$system["gdMarkHeight"] = "480";
$system["gdWords"] = "凌绝顶官方www.feiyiban.cn";
$system["gdFontSize"] = "9";
$system["gdFont"] = "simfang.ttf";
$system["gdPic"] = "";
$system["gdPosition"] = "9";
$system["gdLight"] = "80";
$system["gdMarkView"] = "";
$system["gdMarkLink"] = "";
$system["mailType"] = "gbk";
$system["mailSendType"] = "smtp";
$system["mailServer"] = "smtp.126.com";
$system["mailPort"] = "25";
$system["mailUser"] = "gzjueding";
$system["mailPass"] = "19820421";
$system["mailReplyEmail"] = "[email protected]";
$system["mailAdminer"] = "[email protected]";
$system["tolocal"] = "0";
$system["attachType"] = "jpg,gif,png";
}
$system_time = $systemTime = mktime(gmdate("H")+$system["timeZone"],gmdate("m"),gmdate("s")+$system["timeRevise"],gmdate("m"),gmdate("d"),gmdate("Y"));
include_once("./class/upload.class.php");
$UP = new UPLOAD("./upfiles/".date("Y/m/d/",$system_time),$system["attachType"]);
include_once("./class/gd.class.php");
$GD = new GD("./",$system["gdWords"],$system["gdFont"],$system["gdPic"],$system["gdPosition"],$system["gdLight"]);
}
include_once("./admin/".$file.".qg.php");
#[如果是系统首页,设置显示版本说明]
}
else
{
echo "<br /><br /><div align='center'>网页文件不存在...</div>";
}
if($file == "left")
{
echo "</body></html>";
$DB->qgClose();
ob_end_flush();
}
else
{
if(strpos($file,"open.") === false)
{
Foot();
}
else
{
echo "</body></html>";
$DB->qgClose();
ob_end_flush();
}
}
}
}
else
{
if(strpos($file,"open.") !== false)
{
die("<body style='margin:0px;padding:0px' bgcolor='#f1f1e3'><table width='100%' height='100%'><tr><td align='center' style='color:red;font:normal 12px 宋体,Tahoma,Arial'>只有后台管理员才有权限上传图片!</td><tr></table><body></html>");
}
#[管理员未登录,开启登录页]
if($act == "loginok")
{
if(empty($username) || empty($password))
{
Error("用户名或密码或认证码为空...","admin.php?act=login",2,true);
}
else
{
#[取消认证码功能]
$rows = $DB->qgGetOne("SELECT * FROM ".$prefix."admin WHERE user='".$username."' AND pass='".md5($password)."' LIMIT 0,1");
if($rows)
{
$_SESSION["admin"] = $rows;
Error("管理员 <strong>".$rows["user"]."</strong> 登录后台...","admin.php",2,true);
}
else
{
Error("管理员账号或密码不正确...","admin.php?act=login",2,true);
}
}
}
elseif($act == "logout")
{
session_destroy();
Error("管理员成功退出...","admin.php?act=login",2,true);
}
else
{
echo "<title>管理员登录 </title>";
echo "</head>";
echo "<body>";
include_once("./admin/tpl/admin_login.php");
}
echo "</body></html>";
ob_end_flush();
}function daddslashes($string, $force = 0)
{
if(!$GLOBALS["magic_quotes_gpc"] || $force)
{
if(is_array($string))
{
foreach($string as $key => $val)
{
$string[$key] = daddslashes($val, $force);
}
}
else
{
#[将内容转化成无害信息]
$string = addslashes($string);
}
}
return $string;
}
?>
在调用session_start()创建会话前不能有任何输出。
应该是在文件
include_once("./class/session.class.php");在贴session.class.php的代码:
<?php
#[定义session类信息]
CLASS SESSION
{
var $DB;
var $prefix; Function __construct($DB,$prefix="qinggan_")
{
$this->DB = $DB;
$this->prefix = $prefix;
} #[兼容PHP4]
Function SESSION($DB,$prefix="qinggan_")
{
$this->__construct($DB,$prefix);
} Function qgOpen($save_path,$session_name)
{
return true;
} Function qgClose()
{
return true;
} Function qgRead($sid)
{
$rs = $this->DB->qgGetOne("SELECT * FROM ".$this->prefix."session WHERE id='".$sid."'");
if(!$rs)
{
$this->DB->qgQuery("INSERT INTO ".$this->prefix."session SET id='".$sid."',data='',lasttime='".time()."'");
return false;
}
else
{
if($rs["data"])
{
return $rs["data"];
}
else
{
return false;
}
}
}
function qgDelete($sid)
{
$this->DB->qgQuery("DELETE FROM ".$this->prefix."session WHERE id='".$sid."'");
return true;
} function qgGc()
{
$this->DB->qgQuery("DELETE FROM ".$this->prefix."session WHERE lasttime+1800<'".time()."'");
return true;
}
}
session_start();
$SESSION = new session($DB,$prefix);
session_module_name("user");
session_set_save_handler(
array($SESSION,"qgOpen"),
array($SESSION,"qgClose"),
array($SESSION,"qgRead"),
array($SESSION,"qgWrite"),
array($SESSION,"qgDelete"),
array($SESSION,"qgGc")
);?>
include_once("./class/session.class.php"); //这一行移到admin.php第一行
ob_start();
...
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
检查一下session.save_path指定目录有没有写权限。(UNIX、Linux一般设置为/tmp临时目录)