kalyan
Продвинутый
Дата регистрации:
22.07.2012 17:02:42
Сообщений: 61
Михаил помоги ааа разобраться с СЕССИЕЙ почему она у меня так настойчиво выдает все те же ошибки из данного куска.
Ошибка:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at Z:\home\k.ru\www\lib\user_class.php:1) in Z:\home\k.ru\www\lib\manage_class.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at Z:\home\k.ru\www\lib\user_class.php:1) in Z:\home\k.ru\www\lib\manage_class.php on line 28
ФАЙЛ Manage:
require_once "config_class.php";
require_once "user_class.php";
class Manage {
private $config;
private $user;
private $data;
public function __construct($db){
session_start();
$this->config = new Config();
$this->user = new User($db);
$this->data = $this->secureData(array_merge($_POST, $_GET));
}
private function secureData($data){
foreach ($data as $key => $value){
if (is_array($value)) $this->secureData($value);
else $data[$key] = htmlspecialchars($value);
}
return $data;
}
public function redirect($link){
header("Location: $link"
;
exit;
}
public function regUser(){
$link_reg = $this->config->address."?view=reg";
$captcha = $this->data["captcha"];
if(($_SESSION["rand"] != $captcha) && ($_SESSION["rand"] != ""
){
return $this->returnMessage("ERROR_CAPTCHA", $link_reg);
}
$login = $this->data["login"];
if ($this->user->isExistsUser($login)) return $this->returnMessage("EXISTS_LOGIN", $link_reg);
$password = $this->data["password"];
if($password == ""
return $this->unknownError($link_reg);
$password = $this->hashPassword($password);
$result = $this->user->addUser ($login, $password, time());
if ($result) return $this->returnPageMessage ("SUCCESS_REG", $this->config->address."?view=message"
;
else return $this->unknownError($link_reg);
}
private function hashPassword($password){
return md5 ($password.$this->config->secret);
}
private function unknownError($r){
return $this->returnMessage("UNKNOWN_ERROR", $r);
}
private function returnMessage ($message, $r){
$_SESSION ["message"] = $message;
return $r;
}
private function returnPageMessage ($message, $r){
$_SESSION ["page_message"] = $message;
return $r;
}
}