[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: страница регистрации
maruo
Notice: Undefined index: message in Z:\home\test.local\www\lib\modules_class.php on line 114

Notice: Undefined index: _TEXT in Z:\home\test.local\www\lib\globalmessage_class.php on line 18

Notice: Undefined index: login in Z:\home\test.local\www\lib\regcontent_class.php on line 24

modules_class.php

protected function getMessage() {
114 $message = $_SESSION["message"];
unset($_SESSION["message"]);
$sr["message"] = $this->message->getText($message);
return $this->getReplaceTemplate($sr, "message_string");
}


GlobalMessage.php

<?php
require_once "config_class.php";

abstract class GlobalMessage {

private $data;

public function __construct($file) {
$config = new Config();
$this->data = parse_ini_file($config->dir_text.$file.".ini");
}

public function getTitle($name) {
return $this->data[$name."_TITLE"];
}

public function getText($name) {
18 return $this->data[$name."_TEXT"];
}

}



?>


RegContent.php

<?php
require_once "modules_class.php";

class RegContent extends Modules {

public function __construct($db) {
parent::__construct($db);
}

protected function getTitle() {
return "Регистрация на сайте";
}

protected function getDescription() {
return "Регистрация пользователя на сайте";
}

protected function getKeyWords() {
return "регистрация сайт, регистрация";
}

protected function getMiddle() {
$sr["message"] = $this->getMessage();
24 $sr["login"] = $_SESSION["login"];
return $this->getReplaceTemplate($sr, "form_reg");

}

}

?>



И при отправки данных в БД выводят такие ошибки

Warning: Missing argument 1 for User::__construct(), called in Z:\home\test.local\www\lib\manage_class.php on line 14 and defined in Z:\home\test.local\www\lib\user_class.php on line 6

Notice: Undefined variable: db in Z:\home\test.local\www\lib\user_class.php on line 7

Notice: Undefined index: captcha in Z:\home\test.local\www\lib\manage_class.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at Z:\home\test.local\www\lib\user_class.php:6) in Z:\home\test.local\www\lib\manage_class.php on line 27

<?php
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();
$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->isExsistsUser($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;
}
}



?>


<?php
require_once "global_class.php";

class User extends GlobalClass {

public function __construct($db) {
parent::__construct("users", $db);
}

public function addUser($login, $password, $regdate) {
if (!$this->checkValid($login, $password, $regdate))return false;
return $this->add(array("login" => $login, "password" => $password, "regdate" => $regdate));
}

public function editUser($id, $login, $password, $regdate) {
if (!$this->checkValid($login, $password, $regdate))return false;
return $this->edit($id, array("login" => $login, "password" => $password, "regdate" => $regdate));
}

public function isExistsUser($login) {
return $this->isExists("login", $login);
}

public function getUserOnLogin($login) {
$id = $this->getField("id", "login", $login);
return $this->get($id);
}

private function checkValid($login, $password, $regdate) {
if (!$this->valid->validLogin($login)) return false;
if (!$this->valid->validHash($password)) return false;
if (!$this->valid->validTimeStamp($regdate))return false;
return true;
}

}


?>


Сколько не старался открывать учебник, Ошибки решить самостоятельно не смог
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.