Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $login = htmlspecialchars($_POST['login']);
- $password = htmlspecialchars($_POST['password']);
- $captcha = htmlspecialchars($POST['lcaptcha']);
- if ($_POST['login_enter']) {
- @session_start();
- $code = $_SESSION['cap_code'];
- $user = $_POST['lcaptcha'];
- if ($code == $user) {
- $mysqli = new mysqli("localhost", "root", "", "users") or die("Ошибка подключения к ДБ!");
- mysqli_set_charset ($mysqli, "utf8");
- $mysqli->query("SET NAMES 'utf8'");
- if(mysql_result("SELECT login, password FROM users WHERE login = `login` and password = `password` LIMIT 1"), 0) == 1){
- exit (header ('Location: /profile.php'));
- } else return 'Неправильный логин или пароль!';
- $mysqli->close();
- } else if ($code != $user) {
- echo '<br><b>Неправильно введена капча!</b></br>';
- }
- }
- if (!$login or ! $password) {
- echo '<br> <b>Заполнены не все поля!</b></br>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement