Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $conn = new mysqli("localhost", "root", "", "phptut");
- if(!$conn){
- die("Fatal Error: Connection Faileds");
- }
- ?>
- The Main Interface
- This is the where the database connection, just simple copy/paste the provided code below then save it as 'index.php'.
- <!DOCTYPE html>
- <html lang = "en">
- <head>
- <meta charset = "UTF-8" name = "viewport" content = "width=device-width"/>
- <link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css"/>
- </head>
- <body>
- <nav class = "navbar navbar-default">
- <div class = "container-fluid">
- <a class = "navbar-brand" href = "<a href="https://sourcecodester.com">Sourcecodester</a>
- " rel="nofollow">https://sourcecodester.com">Sourcecodester</a>
- </a> </div>
- </nav>
- <div class = "col-md-3"></div>
- <div class = "col-md-6 well">
- <h3 class = "text-primary">PHP - Simple Login With Remember me Script</h3>
- <hr style = "border-top:1px dotted #000;"/>
- <div class = "col-md-1"></div>
- <div class = "col-md-10" style = "box-shadow:0px 0px 1px 0.5px #000; border-radius:1px;">
- <h4>Login Here...</h4><br />
- <form>
- <div class = "form-group">
- <label>Username:</label>
- <input type = "text" id = "username" name = "username" value = "<?php if(ISSET($_COOKIE['username'])){echo $_COOKIE['username'];}?>" class = "form-control"/>
- </div>
- <div class = "form-group">
- <label>Password:</label>
- <input type = "password" id = "password" name = "password" value = "<?php if(ISSET($_COOKIE['password'])){echo $_COOKIE['password'];}?>" class = "form-control"/>
- </div>
- <div class = "form-group">
- <input type = "checkbox" id = "remember" name = "remember" <?php if(ISSET($_COOKIE['username'])){echo 'checked';}?> /><label>Remember me</label>
- </div>
- <br />
- <br />
- <div class = "form-group">
- <button type = "button" id = "login" class = "btn btn-primary form-control" name = "login" >LOGIN</button>
- </div>
- <br />
- </form>
- </div>
- </div>
- </body>
- <script src = "js/jquery-3.2.1.js"></script>
- <script src = "js/script.js"></script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement