Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $servername = "localhost";
- $dbusername = "root";
- $dbpassword = "";
- $dbname = "d4n13ls";
- $conn = mysqli_connect($servername, $dbusername, $dbpassword, $dbname);
- if(!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- if($_SERVER["REQUEST_METHOD"] == "POST"){
- if(isset($_POST["username"])) {
- $username = $_POST["username"];
- $password = $_POST["password"];
- $password = password_hash($password, PASSWORD_DEFAULT);
- $query = "SELECT username and password FROM members WHERE username=$username AND password=$password";
- if($result = mysqli_query($conn, $query)) {
- $rows = mysqli_num_rows($result);
- if($rows["username"] == $username && $rows["password"] == $password) {
- $_SESSION["username"] = $username;
- $_SESSION["user_id"] = $rows["id"];
- header("location: home.php");
- }
- }
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8"/>
- <title>D4N13LS</title>
- <style>
- * {
- -webkit-user-select:none;
- -moz-user-select:none;
- -ms-user-select:none;
- user-select:none;
- font-family:monospace;
- color:#d5ddf7;
- }
- html {
- height:100%;
- margin:0;
- padding:0;
- }
- body {
- max-height: 100%;
- height:100%;
- margin:0;
- padding:0;
- background-image:url("https://ak1.picdn.net/shutterstock/videos/25061711/thumb/11.jpg");
- background-size:100% 100%;
- background-repeat: no-repeat;
- }
- h2 {
- position:absolute;
- top:31%;
- left:7%;
- }
- #Validate {
- font-weight:bold;
- font-size:140%;
- position: absolute;
- top:34%;
- left:10%;
- }
- input[type="text"], input[type="password"], textarea {
- outline: none;
- border: none;
- background-color: rgba(0, 0, 0, 0);
- border-bottom: 0.5px solid #d5ddf7;
- color:#d5ddf7;
- }
- #username {
- position: absolute;
- top:42%;
- left:13%;
- width:15%;
- height:3%;
- }
- #password {
- position: absolute;
- top:46.5%;
- left:13%;
- width:15%;
- height:3%;
- }
- button {
- color:black;
- background-color:#53aee6;
- border:none;
- font-weight: bold;
- font-family:monospace;
- -webkit-box-shadow: -1px -1px 19px 2px rgba(83,174,230,1);
- -moz-box-shadow: -1px -1px 19px 2px rgba(83,174,230,1);
- -ms-box-shadow: -1px -1px 19px 2px rgba(83,174,230,1);
- box-shadow: -1px -1px 19px 2px rgba(83,174,230,1);
- font-size:1em;
- position: absolute;
- top:52%;
- left:23.5%;
- }
- button:hover {
- cursor:pointer;
- }
- h2 {
- font-size:150%;
- }
- </style>
- </head>
- <body>
- <div id="label">
- <h2>D4N13LS</h2>
- <p id="Validate">Validation</p>
- </div>
- <form action="<?php htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
- <input name="username" type="text" class="input" placeholder="Username" id="username" />
- <input name="password" type="password" class="input" placeholder="Password" id="password" />
- <button type="submit">Connect</button>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement