Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: GLaDDOS
- * Date: 28.09.2017
- * Time: 19:28
- */
- require_once( 'mysqli.php');
- $connection = new sql();
- $connection->connect();
- if (!isset($_GET['login']) and (!isset($_GET['pass']))){
- $header = 'VButilke';
- }
- else{
- if (empty($_GET['login']) and (empty($_GET['pass']))) {
- $header = 'ОШИБКА! ПОЛЯ НЕ МОГУТ БЫТЬ ПУСТЫМИ';
- }else{
- $header = 'VButilke';
- session_start();
- $login = htmlspecialchars($_GET['login']);
- $password = md5(htmlspecialchars($_GET['pass']));
- $query= "SELECT * FROM `auth` WHERE `login`='{$login}'";
- $result = mysqli_query($connection->myconn, $query);
- $row = mysqli_fetch_array($result);
- if (empty($row['login'])) {
- $query = "INSERT INTO `auth`(`login`, `pass`) VALUES ('{$login}','{$password}')";
- mysqli_query($connection->myconn, $query);
- $_SESSION['login'] = $row['login'];
- $_SESSION['password'] = $row['pass'];
- $text = "Дароува, {$login} , это еще ничерта не готово, по этому просто закрой вкладку.";
- mkdir("users/$login");
- $fp = fopen("users/{$login}/index.php", "w");
- fwrite($fp, $text);
- fclose($fp);
- header("Location: users/${login}");
- }
- if ($password == $row['pass']){
- $_SESSION['login'] = $row['login'];
- $_SESSION['password'] = $row['pass'];
- header( "Location: users/${login}" );
- }else{
- if ($password !== $row['pass']){
- $header = "ПАРОЛЬ НЕ ВЕРЕН!";
- }else{
- header( "Location: users/${login}" );
- }
- }
- }}
- echo <<<HTML
- <!DOCTYPE html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- <link rel="stylesheet" type="text/css" href="Semantic-UI-CSS-master/semantic.min.css">
- <style>
- body{
- background: url("bg.jpg") no-repeat;
- background-size: auto auto;
- background-size: cover;
- height: 100%;
- }
- </style>
- </head>
- <body>
- <div class="ui basic modal">
- <div class="ui icon header">
- <i class="coffee icon"></i>
- <h1>{$header}</h1>
- <form class="ui form">
- <p>The blue bus is calling us</p>
- <button type="submit" class="ui purple basic button">Регистрация</button>
- <button type="submit" class="ui pink basic button">Войти</button>
- <div class="ui two column centered grid">
- <div class="column"></div>
- <div class="four column centered row">
- <div class="column">
- <div class="field">
- <center><p>Логин</p></center><br/>
- <input name="login" placeholder="First Name" type="text">
- </div>
- </div>
- <div class="column">
- <div class="field">
- <center><p>Пароль</p></center><br/>
- <input name="pass" placeholder="Last Name" type="text">
- </div>
- </div>
- </div></div>
- </form>
- </div>
- </div>
- </div>
- <script
- src="https://code.jquery.com/jquery-3.1.1.min.js"
- integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
- crossorigin="anonymous"></script>
- <script src="Semantic-UI-CSS-master/semantic.min.js"></script>
- <script >
- $('.ui.modale')
- .modal('show')
- ;
- $('.ui.modal')
- .modal('show')
- ;
- </script>
- </body>
- </html>
- HTML;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement