{% else-1 %}
(14 сен 2014, 01:34) (0/0) [0]
<?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($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;
}

}
?>
(30 авг 2014, 11:57) (0/0) [0]
Islamfon, 5000 к. эран ма ца дел *
(30 авг 2014, 11:55) (0/0) [0]
Kuznetsov, Дк,я научился*
(30 авг 2014, 11:54) (0/0) [0]
Islamfon, Делдахь волкх)
(30 авг 2014, 11:49) (0/0) [0]
Как та так *
Прикрепленные файлы:
* PROFIWM_COM_273_910883_C360_2014-08-30-11-47-43-013.jpg (344.94 кб)
(29 авг 2014, 00:15) (0/0) [0]
schastlivii, 2 ни хочиш ? *
(29 авг 2014, 00:09) (1/0) [1]
ЗЕЛЁНЫЙ ШЕРШЕНЬ, гк *
(29 авг 2014, 00:08) (0/1) [-1]
я всегда код украшиваю *
  • 1 из 1