Guest User

Untitled

a guest
Mar 18th, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. error_reporting(0);
  5.  
  6. if (file_exists("install.php"))
  7. {
  8. header("Location: install.php");
  9. exit();
  10. }
  11.  
  12. if (isset($_GET['cmd']))
  13. {
  14. session_start();
  15. session_destroy();
  16. header('Location: index.php');
  17. exit();
  18. }
  19.  
  20. require_once('inc/config.php');
  21.  
  22. if ($_SESSION['login'])
  23. {
  24. header('Location: home.php');
  25. exit();
  26. }
  27.  
  28. $user = $_POST[user];
  29. $pass = md5($_POST[pass]);
  30. if (isset($_POST['login']))
  31. {
  32. if ($user == $correctuser && $pass == $correctpass)
  33. {
  34. $_SESSION['login'] = true;
  35. $_SESSION['username'] = $user;
  36. header('Location: home.php');
  37. }
  38. else
  39. {
  40.  
  41. $error = '<center><img src="img/error.gif" height="170" weight="300"/></center><br>';
  42. $alert = '<div id="wrong" style="width:100%; padding: 10px; background:#a52a2a"><a><center><font color="white">&nbsp;Неправильный пароль!</font></center></a></div>';
  43. }
  44. }
  45.  
  46. $n = rand(1,6);
  47.  
  48. ?>
  49.  
  50. <html>
  51.  
  52. <head>
  53.  
  54. <meta charset="UTF-8">
  55.  
  56. <title>
  57. вход
  58. </title>
  59.  
  60. <script src="js/prefixfree.min.js">
  61. </script>
  62. <link rel="stylesheet" href="css/normalize.css"/>
  63. <link rel="stylesheet" href="css/style-login.css"/>
  64.  
  65. </head>
  66.  
  67. <body>
  68.  
  69. <?
  70. echo $alert;
  71. ?>
  72.  
  73. <div class="login">
  74.  
  75. <center>
  76. <?php
  77. if($error == '')
  78. {
  79. echo '<img src="img/kartoxa'; echo $n.'.png" height="200" weight="200"/>';
  80. }
  81. else
  82. {
  83. echo $error;
  84. }
  85. ?>
  86. </center>
  87. <form action="index.php" method="post">
  88. <input type="text" name="user" placeholder="логин" required="required" />
  89. <input type="password" name="pass" placeholder="пароль" required="required" />
  90. <button type="submit" name="login" class="btn btn-primary btn-block btn-large">
  91. Войти
  92. </button>
  93. </form>
  94. </div>
  95.  
  96.  
  97. </body>
  98.  
  99. </html>
Add Comment
Please, Sign In to add comment