<?
require 'config.php';
if(isset($_POST['login']))
{
$name = $_POST['nick'];
$password = $_POST['password'];
$search = mysqli_query("SELECT * FROM `".$account['table']."` WHERE `".$account['name']."`='$name'");
if(mysqli_num_rows($search)!=0)
{
$user = mysqli_fetch_array($search);
if($user["".$account['pass'].""]==$password)
{
setcookie("pass", md5(md5($password)).":".$name, time() + 60*100, "/");
header("Location: ./index.php");
}
else
{
$info_pass="<div class=\"alert alert-danger\">
<strong>Ошибка!</strong> Пароль не правильный.
</div>";
}
}
else
{
$info_user = "<div class=\"alert alert-danger\">
<strong>Ошибка!</strong> Игрок не найден.
</div>";
}
}
if($_GET["access"]=="exit"){
setcookie("pass", "", "0", "/");
header("Location: ./login.php");
}
?>
<?php
require '../engine/function.php';
require '../engine/authorization.php';
if(!(empty($_COOKIE["pass"]) || $_COOKIE["pass"]=="")) return header("Location: ./");
$template =
str_replace(array(
'{%isclass%}'
),
array(
),
file_get_contents('../templates/header.tpl')) .
str_replace(array(
'{%isclass%}'
),
array(
),
file_get_contents('../templates/login.tpl')) .
str_replace(array(
'{%footer%}',
),
array(
),
file_get_contents('../templates/footer.tpl'));
exit($template);
?>
<?php
session_start();
require '../engine/function.php';
require '../engine/authorization.php';
$template =
str_replace(array(
'{%isclass%}'
),
array(
),
file_get_contents('../templates/header.tpl')) .
str_replace(array(
'{%isclass%}'
),
array(
),
file_get_contents('../templates/login.tpl')) .
str_replace(array(
'{%footer%}',
),
array(
),
file_get_contents('../templates/footer.tpl'));
exit($template);
?>
<?
session_start();
require_once 'config.php';
if(isset($_POST['login']))
{
$name = $_POST['nick'];
$password = $_POST['password'];
$search = mysqli_query($_MS, "SELECT * FROM `".$account['table']."` WHERE `".$account['name']."`='$name'");
if(mysqli_num_rows($search) > 0)
{
$user = mysqli_fetch_assoc($search);
if($user[$account['pass']]==$password)
{
header("Location: ../cp/index.php");
} else {
$_SESSION['message'] = 'Не верный логин или пароль';
header('Location: ../cp/index.php');
}
}
}
if(isset($_GET["access"])=="exit") {
setcookie("pass", "", "0", "/");
header("Location: ./login.php");
}
?>
<?
session_start();
include '../engine/config.php';
if(empty($_SESSION["pass"]) || $_SESSION["pass"]==""){
header("Location: login.php");
}
else{
$per = explode(":", $_SESSION["pass"]);
$pass_md5 = $per[0];
$login = $per[1];
$search = mysqli_query("SELECT * From ".$account['table']." WHERE ".$account['name']."='$login'");
$user = mysqli_fetch_assoc($search);
if($pass_md5 != md5(md5($user["".$account['pass'].""]))){
setcookie("pass", "", 0, "/");
header("Location: login.php");
}
}
?>
$account = array (
'table' => 'account',
'pass' => 'Password',
'name' => 'Name',
'level' => 'Level',
'exp' => 'Exp',
'cash' => 'Cash',
'bank' => 'Bank',
'id' => 'id'
);
?>