Advertisement
Guest User

login.php

a guest
Jan 11th, 2015
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. include_once("/templates/index_lo.tpl");
  6. include_once("/templates/login.tpl");
  7. include_once("db.php");
  8.  
  9.  
  10.  
  11.  
  12. if(isset($_POST['l_button']))
  13. {
  14.  
  15. $nname = $_POST['l_username'];
  16. $query = "SELECT * FROM user WHERE username = '".$nname."'";
  17.  
  18. $result = mysqli_query($db,$query);
  19.  
  20. while ($row = mysqli_fetch_object($result)) {
  21.  
  22. $li_name = $row->username;
  23. $li_pw = $row->password;
  24. }
  25.  
  26. if(mysqli_num_rows($result) == 0)// Kein User vorhanden
  27. {
  28.  
  29. ?>
  30. <html>
  31. <body>
  32.  
  33. <div class="lg-alert" style="padding-left: 50px; padding-right: 50px">
  34. <div class="alert alert-danger alert-error">
  35. <strong>Fehler!</strong> Benutzer wurde nicht gefunden!<br>
  36. </div></div>
  37.  
  38. </body>
  39.  
  40. </html>
  41.  
  42. <?php
  43. return;
  44. }
  45.  
  46. if($_POST['l_password'] != $li_pw)
  47. {
  48. ?>
  49. <html>
  50. <body>
  51.  
  52.  
  53. <div class="lg-alert" style="padding-left: 50px; padding-right: 50px">
  54. <div class="alert alert-danger alert-error">
  55. <strong>Fehler!</strong> Falsches Passwort!<br>
  56. </div></div>
  57. </body>
  58.  
  59. </html>
  60. <?php
  61. }
  62.  
  63. else {
  64. ?><html>
  65. <body>
  66. <div class="alert alert-success">
  67. <a href="#" class="close" data-dismiss="alert">&times;</a>
  68. <strong>Login:</strong> Erfolgreich eingeloggt!
  69. </div>
  70. </body>
  71. </html>
  72. <?php
  73. $_SESSION['loggedin'] = 2;
  74. $_SESSION['loggedname'] = $_POST['l_username'];
  75. ?>
  76. <script language="javascript">
  77. setTimeout ("forwarding()",2000);
  78. function forwarding() {
  79. window.location.href = "index.php?section=index"
  80. }
  81. </script>
  82. <?php
  83. return;
  84. }
  85.  
  86. }
  87.  
  88.  
  89. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement