File size: 5.18Kb
<?
include_once 'sys/inc/start.php';
include_once 'sys/inc/compress.php';
include_once 'sys/inc/sess.php';
include_once 'sys/inc/home.php';
include_once 'sys/inc/settings.php';
include_once 'sys/inc/db_connect.php';
include_once 'sys/inc/ipua.php';
include_once 'sys/inc/fnc.php';
include_once 'sys/inc/user.php';
if(isset($user)){
include_once 'sys/inc/thead.php';
header ("Location: /feed");
exit;
}
else{
include_once 'sys/inc/shif.php';
$show_all = true; // показ для всех
$input_page = true;
only_unreg();
include_once 'sys/inc/thead.php';
?>
<style>
.fit_box.new_form .social_button {
padding: 7px 0;
margin-top: 12px;
display: block;
line-height: 24px;
border: 1px solid #e5e6e8;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
text-align: center;
box-shadow: 0 0 6px 4px #fcfcfc,0 2px 4px 0 #fcfcfc;
font-weight: 600;
width: 247px;
}
</style>
<div style="margin-top: 12px;"></div>
<div class="pcont fit_box bl_cont new_form">
<div class="form_item">
<div class="login_header">
Введите Ваш никнейм и пароль для входа на сайт.
</div>
<?
if (isset($_POST['nick']) && isset($_POST['pass']))
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `nick` = '".my_esc($_POST['nick'])."' AND `pass` = '".shif($_POST['pass'])."' LIMIT 1"), 0))
{
$user = mysql_fetch_assoc(mysql_query("SELECT `id` FROM `user` WHERE `nick` = '".my_esc($_POST['nick'])."' AND `pass` = '".shif($_POST['pass'])."' LIMIT 1"));
$_SESSION['id_user'] = $user['id'];
$user = get_user($user['id']);
// сохранение данных в COOKIE
setcookie('id_user', $user['id'], time()+60*60*24*365);
setcookie('pass', cookie_encrypt($_POST['pass'],$user['id']), time()+60*60*24*365);
// Пишем ip пользователя
if (isset($ip2['add']))mysql_query("UPDATE `user` SET `ip` = ".ip2long($ip2['add'])." WHERE `id` = '$user[id]' LIMIT 1");
else mysql_query("UPDATE `user` SET `ip` = null WHERE `id` = '$user[id]' LIMIT 1");
if (isset($ip2['cl']))mysql_query("UPDATE `user` SET `ip_cl` = ".ip2long($ip2['cl'])." WHERE `id` = '$user[id]' LIMIT 1");
else mysql_query("UPDATE `user` SET `ip_cl` = null WHERE `id` = '$user[id]' LIMIT 1");
if (isset($ip2['xff']))mysql_query("UPDATE `user` SET `ip_xff` = ".ip2long($ip2['xff'])." WHERE `id` = '$user[id]' LIMIT 1");
else mysql_query("UPDATE `user` SET `ip_xff` = null WHERE `id` = '$user[id]' LIMIT 1");
if ($ua)mysql_query("UPDATE `user` SET `ua` = '".my_esc($ua)."' WHERE `id` = '$user[id]' LIMIT 1");
// Непонятная сессия
mysql_query("UPDATE `user` SET `sess` = '$sess' WHERE `id` = '$user[id]' LIMIT 1");
// Тип браузера
mysql_query("UPDATE `user` SET `browser` = '" . ($webbrowser == true ? "wap" : "web") . "' WHERE `id` = '$user[id]' LIMIT 1");
// Проверяем на схожие ники
$collision_q = mysql_query("SELECT * FROM `user` WHERE `ip` = '$iplong' AND `ua` = '".my_esc($ua)."' AND `date_last` > '".(time()-600)."' AND `id` <> '$user[id]'");
while ($collision = mysql_fetch_assoc($collision_q))
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user_collision` WHERE `id_user` = '$user[id]' AND `id_user2` = '$collision[id]' OR `id_user2` = '$user[id]' AND `id_user` = '$collision[id]'"), 0) == 0)
mysql_query("INSERT INTO `user_collision` (`id_user`, `id_user2`, `type`) values('$user[id]', '$collision[id]', 'ip_ua_time')");
}
mysql_query("UPDATE `user` SET `date_aut` = '$time', `date_last` = '$time' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `user_log` (`id_user`, `time`, `ua`, `ip`, `method`) values('$user[id]', '$time', '$user[ua]' , '$user[ip]', '1')");
header ("Location: /feed");
exit;
}
else $err = '<b>Не удаётся войти.</b><br>Пожалуйста, проверьте правильность введённых данных.';
}
err();
?>
<form method="post" data-noajax="" action="/">
<dl class="fi_row">
<dd>
<input class="textfield" name="nick" value="" placeholder="Никнейм" type="text">
</dd>
</dl>
<dl class="fi_row">
<dd>
<input class="textfield" name="pass" placeholder="Пароль" type="password">
</dd>
</dl>
<div class="fi_row_new">
<input class="button wide_button" value="Войти" type="submit">
</div>
<div class="fi_row">
<div class="near_btn wide_button login_restore"><a href="/restore">Забыли пароль?</a></div>
</div>
<div class="login_new_user">
<div class="fi_header fi_header_light">Впервые ВКонтакте?</div>
</div>
<div class="fi_row">
<a class="button wide_button success" href="/join">Зарегистрироваться</a>
</div>
<div class="socials">
<?
include_once 'auth/inc/func.php';
?>
<a href="/auth/?m=vkontakte" class="social_button" style="margin-top: 10px;"><i class="social_icon" style="margin-right: 10px;padding: 3px 12px;font-size: 15px;background-size: 90%;background-position: center;background-repeat: no-repeat;background-image: url(/auth/img/vkontakte.png);"></i>Войти через VK</a>
</div>
</form>
</div>
</div>
<?
}
include_once 'sys/inc/tfoot.php';
?>