Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?session_start();?>
- <html lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf8">
- <title>Авторизация</title>
- <link rel="stylesheet" href="style/style.css" type="text/css" />
- <?require_once "config.php";?>
- </head>
- <body>
- <?
- if(isset($_POST['enter']))
- {
- $login = $_POST['Login'];
- $pass = $_POST['Password'];
- $result = mysql_query("SELECT * FROM ".user_table." WHERE ".user_name." = '$login'");
- if(mysql_num_rows($result) > 0)
- {
- $row = mysql_fetch_array($result);
- if(strlen($login) && strlen($pass))
- {
- if($login === $row[user_name] && $pass === $row[user_pass])
- {
- unset($_SESSION['wrong_login']);
- setcookie("Login",$login);
- }
- else
- {
- echo "Логин или пароль неверен.";
- $_SESSION['wrong_login'] = $login;
- }
- }
- }
- else
- {
- echo "Логин или пароль неверен.";
- $_SESSION['wrong_login'] = $login;
- }
- }
- ?>
- <div id="wrapper">
- <div class="header">
- <!-- <a href="index.php"><img src="img/logo.png" alt="Logotip" /></a> -->
- <div class="navbar-center">
- <ul class="navbar">
- <br/>
- <br/>
- <a href="index.php" class="main-buttom">Главная</a>
- <a href="#" class="registration-buttom">Регистрация</a>
- <a href="login.php" class="login-buttom">Вход</a>
- <a href="information.php" class="information-buttom">Информация</a>
- <a href="#" class="forum-buttom">Форум</a>
- <a href="#" class="chat-buttom">Чат</a>
- </ul>
- <?
- if(!isset($_COOKIE['Login']))
- {
- ?>
- <div class="text-login"><b>Авторизация персонажа</b></div>
- <div class="login">
- <form method="POST">
- <input name="Login" type="text" placeholder="| Введите ваш логин" value="<?echo $_SESSION['wrong_login'];?>" /><br/><br/>
- <input name="Password" type="password" placeholder="| Введите ваш пароль" /><br/><br/>
- <input name="enter" type="submit" value="Войти"/><br/><br/>
- </form>
- </div>
- <?
- }
- else
- {
- echo "<h3> ".$_COOKIE['Login']." </h3>";
- }
- ?>
- <div class="footer">
- <p>© by Dmitry Shabunin. Все права защищены!</p>
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment