Вход Регистрация
Файл: New_top/Modules/authentication.php
Строк: 46
<?php
ob_start
();
$str 'authentication';
$title 'Аутентификация пользователя';
require_once(
'Sys/head.php');
switch (
$act)
    {
        default:
                
unreg();
            echo 
'<div class="block">Авторизация</div>';    
                if(!isset(
$_POST['ok']))
                    {
                        echo 
'<div class="l1">';
                        echo
'
                        <form action="" method="POST">
                        Логин: <br/>
                        <input type="text" class="form" class="input" name="login" maxlength="30" value="" size="20" maxlength="50" /><br/>
                        Пароль: <br/>
                        <input type="password" class="form" class="input" name="password" maxlength="30" value="" size="20" maxlength="50" /><br/>
                        <input name="ok" type="submit" class="button" value="Войти" /><br/>
                        '
;
                        echo 
'</div>';
                        
////////////////
                       
$path $_SERVER['DOCUMENT_ROOT'];
                       
$path .= "/Sys/in/rekl_stat.php";
                       include_once(
$path);
                        
////////////////////
                        
                        
echo '<div class="li">';
                        echo 
'- <a href="http://'.$_SERVER['HTTP_HOST'].'/m/recoveryPassword">Восстановление пароля</a><br/>';
                        echo 
'- <a href="http://'.$_SERVER['HTTP_HOST'].'/m/registration">Регистрация</a>';
                        echo 
'</div>';
                    }
                else
                    {    
                        
$error '';
                        if(empty(
$_POST['login']) OR empty($_POST['password']))
                            {
                                
$error .= 'Одно из полей не было заполнено.';
                            }
                        if(
mb_strlen($_POST['login']) > 30 OR mb_strlen($_POST['login']) < 5)
                            {
                                
$error .= 'Поле "Логин" должно быть не меньше 5 и не больше 30 символов.<br/>';
                            }
                        if(
mb_strlen($_POST['password']) > 30 OR mb_strlen($_POST['password']) < 5)
                            {
                                
$error .= 'Поле "Пароль" должно быть не меньше 5 и не больше 30 символов.<br/>';
                            }
                        if(!empty(
$error))
                            {
                                echo 
'<div class="li">';
                                echo 
'В результате заполнения полей , выявились ошибки:<br/>';
                                echo 
$error;
                                echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/m/authentication">Повторить<a/><br/>';
                                echo 
'</div>';        
                            }
                        else
                            {
                                
$login filter($_POST['login']);
                                
$password filter($_POST['password']);
                                
$userIsset $mysqli->query("SELECT `id` FROM `".$prefix."users` WHERE `login` = '".$login."' AND `password` = '".md5($password)."'");
                                if(
$userIsset->num_rows 0)
                                    {
                                        
SetCookie('login',$login,$time+3600*24*365'/');
                                        
SetCookie('password',md5($password),$time+3600*24*365'/');
                                        
header('Location: http://'.$_SERVER['HTTP_HOST'].'/m/office');
                                    }
                                else
                                    {
                                        echo 
'<div class="li">';
                                        echo 
'Авторизация не прошла , возможно данные введены не верно.<br/>';
                                        echo 
'<a href="http://'.$_SERVER['HTTP_HOST'].'/m/authentication">Повторить<a/><br/>';
                                        echo 
'</div>';
                                    }
                            }
                    }
        break;
        case 
'exit':
                    
reg();
                    echo 
'<div class="block">Выход</div>';
                    
                    if(isset(
$_COOKIE['login']) AND isset($_COOKIE['password']))
                        {
                            
SetCookie('login','',$time'/');
                            
SetCookie('password','',$time'/');
                        
header('Location: http://'.$_SERVER['HTTP_HOST'].'');
                        }
                    else
                        {
                            echo 
'<div class="l1">';
                            echo 
'Авторизуйтесь , чтобы выходить.<br/>';
                            echo 
'</div>';
                        }
        break;
    }
?>
Онлайн: 0
Реклама