Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.72 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: GLaDDOS
  5.  * Date: 28.09.2017
  6.  * Time: 19:28
  7.  */
  8. require_once( 'mysqli.php');
  9.  
  10. $connection = new sql();
  11. $connection->connect();
  12.  
  13. if (!isset($_GET['login']) and (!isset($_GET['pass']))){
  14.     $header = 'VButilke';
  15.  
  16. }
  17. else{
  18.     if (empty($_GET['login']) and (empty($_GET['pass']))) {
  19.         $header = 'ОШИБКА! ПОЛЯ НЕ МОГУТ БЫТЬ ПУСТЫМИ';
  20.     }else{
  21.         $header = 'VButilke';
  22.         session_start();
  23.         $login = htmlspecialchars($_GET['login']);
  24.         $password = md5(htmlspecialchars($_GET['pass']));
  25.         $query= "SELECT *  FROM `auth` WHERE `login`='{$login}'";
  26.         $result = mysqli_query($connection->myconn, $query);
  27.         $row = mysqli_fetch_array($result);
  28.         if (empty($row['login'])) {
  29.             $query = "INSERT INTO `auth`(`login`, `pass`) VALUES ('{$login}','{$password}')";
  30.             mysqli_query($connection->myconn, $query);
  31.             $_SESSION['login'] = $row['login'];
  32.             $_SESSION['password'] = $row['pass'];
  33.             $text = "Дароува, {$login} , это еще ничерта не готово, по этому просто закрой вкладку.";
  34.             mkdir("users/$login");
  35.             $fp = fopen("users/{$login}/index.php", "w");
  36.             fwrite($fp, $text);
  37.             fclose($fp);
  38.             header("Location: users/${login}");
  39.         }
  40.             if ($password == $row['pass']){
  41.  
  42.                 $_SESSION['login'] = $row['login'];
  43.                 $_SESSION['password'] = $row['pass'];
  44.                 header( "Location: users/${login}" );
  45.             }else{
  46.                 if ($password !== $row['pass']){
  47.                     $header = "ПАРОЛЬ НЕ ВЕРЕН!";
  48.                 }else{
  49.                     header( "Location: users/${login}" );
  50.  
  51.                 }
  52.             }
  53.     }}
  54.  
  55. echo <<<HTML
  56. <!DOCTYPE html>
  57. <head>
  58.     <meta charset="UTF-8">
  59.     <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  60.                          <meta http-equiv="X-UA-Compatible" content="ie=edge">
  61.     <title>Document</title>
  62.     <link rel="stylesheet" type="text/css" href="Semantic-UI-CSS-master/semantic.min.css">
  63.     <style>
  64.     body{
  65.         background: url("bg.jpg") no-repeat;
  66.         background-size: auto auto;
  67.     background-size: cover;
  68.     height: 100%;
  69. }
  70. </style>
  71. </head>
  72. <body>
  73.  
  74. <div class="ui basic modal">
  75.   <div class="ui icon header">
  76.     <i class="coffee icon"></i>
  77.     <h1>{$header}</h1>
  78. <form class="ui form">
  79.         <p>The blue bus is calling us</p>
  80.     <button  type="submit" class="ui purple basic button">Регистрация</button>
  81.     <button  type="submit" class="ui pink basic button">Войти</button>
  82.    
  83.   <div class="ui two column centered grid">
  84.   <div class="column"></div>
  85.   <div class="four column centered row">
  86.     <div class="column">
  87.         <div class="field">
  88.             <center><p>Логин</p></center><br/>
  89.             <input name="login" placeholder="First Name" type="text">
  90.         </div>
  91. </div>
  92.     <div class="column">
  93.         <div class="field">
  94.             <center><p>Пароль</p></center><br/>
  95.             <input name="pass" placeholder="Last Name" type="text">
  96.         </div>
  97.   </div>
  98.   </div></div>
  99. </form>
  100. </div>
  101. </div>
  102. </div>
  103.     <script
  104.   src="https://code.jquery.com/jquery-3.1.1.min.js"
  105.   integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
  106.   crossorigin="anonymous"></script>
  107.     <script src="Semantic-UI-CSS-master/semantic.min.js"></script>
  108.     <script >
  109.  
  110.     $('.ui.modale')
  111.   .modal('show')
  112. ;
  113.       $('.ui.modal')
  114.   .modal('show')
  115. ;
  116. </script>
  117. </body>
  118. </html>
  119. HTML;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement