Guest User

Untitled

a guest
Jan 10th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <?session_start();?>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf8">
  5. <title>Авторизация</title>
  6. <link rel="stylesheet" href="style/style.css" type="text/css" />
  7. <?require_once "config.php";?>
  8.  
  9. </head>
  10. <body>
  11. <?
  12. if(isset($_POST['enter']))
  13. {
  14. $login = $_POST['Login'];
  15. $pass = $_POST['Password'];
  16. $result = mysql_query("SELECT * FROM ".user_table." WHERE ".user_name." = '$login'");
  17. if(mysql_num_rows($result) > 0)
  18. {
  19. $row = mysql_fetch_array($result);
  20. if(strlen($login) && strlen($pass))
  21. {
  22. if($login === $row[user_name] && $pass === $row[user_pass])
  23. {
  24. unset($_SESSION['wrong_login']);
  25. setcookie("Login",$login);
  26. }
  27. else
  28. {
  29. echo "Логин или пароль неверен.";
  30. $_SESSION['wrong_login'] = $login;
  31. }
  32.  
  33. }
  34. }
  35. else
  36. {
  37. echo "Логин или пароль неверен.";
  38. $_SESSION['wrong_login'] = $login;
  39. }
  40. }
  41. ?>
  42. <div id="wrapper">
  43. <div class="header">
  44. <!-- <a href="index.php"><img src="img/logo.png" alt="Logotip" /></a> -->
  45. <div class="navbar-center">
  46. <ul class="navbar">
  47. <br/>
  48. <br/>
  49. <a href="index.php" class="main-buttom">Главная</a>
  50. <a href="#" class="registration-buttom">Регистрация</a>
  51. <a href="login.php" class="login-buttom">Вход</a>
  52. <a href="information.php" class="information-buttom">Информация</a>
  53. <a href="#" class="forum-buttom">Форум</a>
  54. <a href="#" class="chat-buttom">Чат</a>
  55. </ul>
  56. <?
  57. if(!isset($_COOKIE['Login']))
  58. {
  59. ?>
  60. <div class="text-login"><b>Авторизация персонажа</b></div>
  61. <div class="login">
  62. <form method="POST">
  63. <input name="Login" type="text" placeholder="| Введите ваш логин" value="<?echo $_SESSION['wrong_login'];?>" /><br/><br/>
  64. <input name="Password" type="password" placeholder="| Введите ваш пароль" /><br/><br/>
  65. <input name="enter" type="submit" value="Войти"/><br/><br/>
  66. </form>
  67. </div>
  68. <?
  69. }
  70. else
  71. {
  72. echo "<h3> ".$_COOKIE['Login']." </h3>";
  73. }
  74. ?>
  75. <div class="footer">
  76. <p>&copy by Dmitry Shabunin. Все права защищены!</p>
  77. </div>
  78. </div>
  79.  
  80. </div>
  81. </div>
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment