shahin
Новичок
Дата регистрации:
03.03.2014 21:44:01
Сообщений: 9
Помогите решить проблемму с авторизацией
она вообще не проходит или выдает ошибку
Parse error: syntax error, unexpected '$login' (T_VARIABLE) in D:\OpenServer\domains\mysite\auth.php on line 3
вот файл aut.php
<?php
require_once "includes/include.php"
$login = htmlspecialchars($_POST["login"]);
$password = htmlspecialchars($_POST["password"]);
$password = md5($password);
if (checkUser($login, $password)) {
$_SESSION["login"] = $login;
$_SESSION["password"] = $password;
}
else $_SESSION["error_auth"] = 1;
header("Location: ".$_SERVER["HTTP_REFERER"]);
exit;
?>
Вот файл страницы авторизации
<?php require_once "includes/lib/header.php" ?>
<table width="1120" border="0" cellpadding="0" cellspacing="0">
</tr>
<td width="80%" id="main" align="center"><h1><?php echo $Lang['auth']; ?></h1><hr />
<?php
if (checkUser($_SESSION["login"], $_SESSION["password"])) require_once "user_panel.php";
//else require_once "index.php";
?>
<?php
if (checkUser($_SESSION["login"], $_SESSION["password"]))
{ echo "Вы вошли как <b>".$_SESSION['login']."</b>";}
?>
<form name = "auth" action = "auth.php" method = "post">
<table>
<tr>
<td><?php echo $Lang['login'] ?></td>
<td>
<input type = "text" name = "login" />
</td>
</tr>
<td><?php echo $Lang['you-pass'] ?></td>
<td>
<input type = "password" name = "password" />
</td>
</tr>
<tr>
<td colspan="2">
<input type = "submit" name = "button_auth" value = "<?php echo $Lang['in_ok']; ?>" />
</td>
</tr>
</table>
</form>
</tr>
</table>
<table width="1120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="0" align="center" id="footer"><?php include('includes/lib/footer.php');?></td>
</tr>
</table>
</div>
И вот фaйл function.php
function checkUser($login, $password) {
global $mysqli;
connectDB();
$result_set = $mysqli->query("SELECT * FROM `users` WHERE `login`='$login' AND `password`='$password'"
closeDB();
if ($result_set->fetch_assoc()) return true;
else return false;
}