View file bolcms-3.0.1./users/auth.php

File size: 1.23Kb
<?php 
$title = 'Вход';
require("../system/core.php");

switch($_GET['act']){

default:

echo '<div class="phdr">' .$lng ['aut'] . ' </div><div class="bmenu">';
echo '<form action="?act=do" method="post" name="form">';
echo ' ' .$lng ['log'] . ' :<br/><input name="login" type="text" maxlength="20" /><br/>';
echo ' ' .$lng ['pass'] . ' :<br/><input name="pass" type="password" maxlength="20" /><br/>';
echo '<input name="submit" type="submit" value=" ' .$lng ['login'] . ' " /></form></div>';
nav();

break;

case 'do':

$login = sec($_POST['login']);
$pass = md5(sec($_POST['pass']));

$user = mysql_fetch_assoc(mysql_query("SELECT (`id`) FROM `users` WHERE `login` = '$login' && `pass` = '$pass'"));
$correct_lp = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `login` = '$login' && `pass` = '$pass'"), 0);
if($correct_lp > 0){
	$_SESSION['login'] = $login;
	$_SESSION['id'] = $user['id'];
echo '<div class="phdr"> ' .$lng ['login'] . ' </div><div class="bmenu">'.$_SESSION['login'].', ' .$lng ['suc'] . ' <br/>';
echo '<a href="../?">&lt;--  ' .$lng ['login'] . ' </a>';
	echo '</div>';
	nav();
}else{
error(' ' .$lng ['erlogin'] . ' !');
nav2('auth.php', ' ' .$lng ['nd'] . ' ');
}

break;

}

require("../system/end.php");
?>