Advertisement
Guest User

Untitled

a guest
May 7th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. <?php
  2. $user = 'admin';
  3. $pass = '1';
  4.  
  5. if (isset($_POST['btnlogin'])) {
  6. if (isset($_POST['username']) && $_POST['username'] == $user
  7. && isset($_POST['password']) && $_POST['password'] == $pass) {
  8. $_SESSION['eingeloggt'] = true;
  9. }
  10. } else if (isset($_POST['btnlogout'])) {
  11. // Ausloggen
  12. unset($_SESSION['eingeloggt']);
  13. }
  14. ?>
  15.  
  16.  
  17. <head>
  18.  
  19. <meta charset="UTF-8">
  20. <meta name="viewport" content="width=device-width, initial-scale=1">
  21. <meta name="author" content="Animal Crossing Freunde - Team">
  22.  
  23. <link rel="stylesheet" type="text/css" href="../style.css">
  24. <title> NEUER EINTRAG - Bewohner </title>
  25.  
  26. </head>
  27.  
  28.  
  29. <body>
  30.  
  31. <?php include('../header.html'); ?>
  32.  
  33. <div class="hauptteil">
  34.  
  35. <?php include('../navbar.html'); ?>
  36.  
  37. <main>
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. <?php
  61. // Nicht eingeloggt
  62.  
  63. echo "<h1>Admin Login:</h1>";
  64.  
  65. if (!$_SESSION['eingeloggt']) {
  66. ?>
  67. <form name="login_mit_php" method="post">
  68. <h3>Name:</h3>
  69. <input type="text" name="username">
  70. <h3>Passwort:</h3>
  71. <input type="password" name="password">
  72.  
  73. <input type="submit" name="btnlogin" value="Einloggen">
  74. </form>
  75. <?php
  76. } else {
  77. // Eingeloggt
  78. ?>
  79. <form name="logout_mit_php" method="post">
  80. <input type="submit" name="btnlogout" value="Ausloggen">
  81. </form>
  82. <?php>
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. <form action="connect.php" method="post">
  92. Name : <input type="text" name="name"><br><br>
  93. NameEng : <input type="text" name="nameeng"><br><br>
  94. CardNr : <input type="integer" name="cardnr"><br><br>
  95. Spezies : <input type="text" name="spezies"><br><br>
  96. Verhalten : <input type="text" name="verhalten"><br><br>
  97. Geschlecht : <input type="text" name="geschlecht"><br><br>
  98. GebMonat : <input type="integer" name="monat"><br><br>
  99. GebTag : <input type="integer" name="tag"><br><br>
  100. Sternzeichen : <input type="text" name="stern"><br><br>
  101. Sprache : <input type="text" name="sprache"><br><br>
  102. Kaffee : <input type="text" name="kaffee"><br><br>
  103. <input type="submit" value="Submit">
  104. </form>
  105.  
  106. <?php
  107.  
  108. $host = "vweb18.nitrado.net";
  109. $dbusername = "ni2503330_1sql1";
  110. $dbpassword = "562517bc";
  111. $dbname = "ni2503330_1sql1";
  112.  
  113. $db = mysqli_connect ($host, $dbusername, $dbpassword, $dbname);
  114. $res = $db->prepare("SELECT * FROM Bewohner");
  115.  
  116. echo "<table border>";
  117. echo "<tr> <td>Nummer</td> <td>Name</td> </tr>";
  118.  
  119. while ($row = $res->fetch()) {
  120. $nn = $row['Nr'];
  121. $vn = $row['Name'];
  122. echo "<tr> <td>$nn</td> <td>$vn</td> </tr>";
  123. }
  124. echo "</table>";
  125.  
  126. mysqli_close($db);
  127. ?>
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142. }
  143. ?>
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. </main>
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173. </main>
  174.  
  175. <?php include('../sb.html'); ?>
  176.  
  177. </div>
  178.  
  179. <?php include('../footer.html'); ?>
  180.  
  181. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement