Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "../config.php";
- try {
- $db = new PDO('mysql:host=' . $settings['db']['host'] . ';dbname=' . $settings['db']['dbname'], $settings['db']['user'], $settings['db']['password']);
- } catch (PDOException $e) {
- echo '<b>Ошибка с соединении с бд</b>: ' . $e->getMessage();
- }
- if (isset($_POST['login'])) {
- $login = $_POST['login'];
- if ($login == '') {
- unset($login);
- exit ("<script>
- toastr.error('Введите пожалуйста логин!')</script><br>");
- }
- }
- if (isset($_POST['password'])) {
- $password=$_POST['password'];
- if ($password =='') {
- unset($password);
- exit ("<script>
- toastr.error('Введите пароль')</script><br>");
- }
- }
- $login = stripslashes($login);
- $login = htmlspecialchars($login);
- $password = stripslashes($password);
- $password = htmlspecialchars($password);
- $login = trim($login);
- $password = trim($password);
- $user = $db->query('SELECT * from users WHERE `login` = '.$login.' AND password='.$password.' AND activation=1');
- $login = "" . $row['login'] ."";
- if (empty($login)){
- exit ("<script>
- toastr.danger('not', {timeOut: 5000})</script><br>");
- }
- //else {
- // $_SESSION['password']=$password;
- //$_SESSION['login']=$login;
- // $_SESSION['id']=$id_user['id'];
- //}
- //echo "<meta http-equiv='Refresh' content='0; URL=/'>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement