Advertisement
Guest User

Untitled

a guest
Mar 11th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <?php
  2. $login = htmlspecialchars($_POST['login']);
  3. $password = htmlspecialchars($_POST['password']);
  4. $captcha = htmlspecialchars($POST['lcaptcha']);
  5.  
  6. if ($_POST['login_enter']) {
  7.     @session_start();
  8.     $code = $_SESSION['cap_code'];
  9.     $user = $_POST['lcaptcha'];
  10.     if ($code == $user) {
  11.     $mysqli = new mysqli("localhost", "root", "", "users") or die("Ошибка подключения к ДБ!");
  12.     mysqli_set_charset ($mysqli, "utf8");
  13.     $mysqli->query("SET NAMES 'utf8'");
  14.     if(mysql_result("SELECT login, password FROM users WHERE login = `login` and password = `password` LIMIT 1"), 0) == 1){
  15.   exit (header ('Location: /profile.php'));
  16. } else return 'Неправильный логин или пароль!';
  17.         $mysqli->close();
  18.     } else if ($code != $user) {
  19.         echo '<br><b>Неправильно введена капча!</b></br>';
  20.     }
  21. }
  22.  
  23.  
  24. if (!$login or ! $password) {
  25.     echo '<br> <b>Заполнены не все поля!</b></br>';
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement