Advertisement
akbarnss

index.php membuat form login remember me

Jul 10th, 2017
1,017
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. <?php
  2. $conn = new mysqli("localhost", "root", "", "phptut");
  3.  
  4. if(!$conn){
  5. die("Fatal Error: Connection Faileds");
  6. }
  7. ?>
  8. The Main Interface
  9. This is the where the database connection, just simple copy/paste the provided code below then save it as 'index.php'.
  10.  
  11. <!DOCTYPE html>
  12.  
  13. <html lang = "en">
  14. <head>
  15. <meta charset = "UTF-8" name = "viewport" content = "width=device-width"/>
  16. <link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css"/>
  17. </head>
  18. <body>
  19. <nav class = "navbar navbar-default">
  20. <div class = "container-fluid">
  21. <a class = "navbar-brand" href = "<a href="https://sourcecodester.com">Sourcecodester</a>
  22. " rel="nofollow">https://sourcecodester.com">Sourcecodester</a>
  23. </a> </div>
  24. </nav>
  25. <div class = "col-md-3"></div>
  26. <div class = "col-md-6 well">
  27. <h3 class = "text-primary">PHP - Simple Login With Remember me Script</h3>
  28. <hr style = "border-top:1px dotted #000;"/>
  29. <div class = "col-md-1"></div>
  30. <div class = "col-md-10" style = "box-shadow:0px 0px 1px 0.5px #000; border-radius:1px;">
  31. <h4>Login Here...</h4><br />
  32. <form>
  33. <div class = "form-group">
  34. <label>Username:</label>
  35. <input type = "text" id = "username" name = "username" value = "<?php if(ISSET($_COOKIE['username'])){echo $_COOKIE['username'];}?>" class = "form-control"/>
  36. </div>
  37. <div class = "form-group">
  38. <label>Password:</label>
  39. <input type = "password" id = "password" name = "password" value = "<?php if(ISSET($_COOKIE['password'])){echo $_COOKIE['password'];}?>" class = "form-control"/>
  40. </div>
  41. <div class = "form-group">
  42. <input type = "checkbox" id = "remember" name = "remember" <?php if(ISSET($_COOKIE['username'])){echo 'checked';}?> /><label>Remember me</label>
  43. </div>
  44. <br />
  45. <br />
  46. <div class = "form-group">
  47. <button type = "button" id = "login" class = "btn btn-primary form-control" name = "login" >LOGIN</button>
  48. </div>
  49. <br />
  50. </form>
  51. </div>
  52. </div>
  53. </body>
  54. <script src = "js/jquery-3.2.1.js"></script>
  55. <script src = "js/script.js"></script>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement