Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(!$_SESSION["testlogin"])
- {
- header("Location: index.php");
- }
- $dbc= @new mysqli("localhost", "root", "", "login") or die("No connection");
- $username = $_SESSION["testlogin"];
- $used = false;
- $user_id = "SELECT U_id FROM user WHERE U_name = '$username'";
- $result = mysqli_query($dbc, $user_id);
- if($result) {
- $row = $result -> fetch_assoc();
- $u_id = $row['U_id'];
- }
- $sql_abfrage = "SELECT user_applikation, user_password FROM apps NATURAL JOIN passwoerter NATURAL JOIN user WHERE U_id = '$u_id'";
- if ($_POST == true)
- {
- $suchtext = $_POST["suchtext"];
- $used = true;
- }
- if($used == true)
- {
- $sql_abfrage .= " AND user_applikation or user_password LIKE '%" . $suchtext . "%'";
- }
- $sql_ergebnis = mysqli_query($dbc, $sql_abfrage);
- ?>
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="ProjektCSS.css" >
- <title>
- A APP PASSWORD
- </title>
- </head>
- <body class="body">
- <form action="main.php" method="post">
- <h1 class="header"> Welcome on your Database </h1>
- <input class="form2" type="text" name="suchtext" placeholder="Suchtext"/>
- <input class="submit2" type="submit" placeholder="Suchen" name="used" />
- </form>
- <table class="table">
- <tr>
- <th>
- <a href="mypage.php?sort=user_applikation" class="theader"> Applikationen </a>
- </th>
- <th>
- <a href="mypage.php?sort=user_password" class="theader"> Passwoerter </a>
- </th>
- <tr>
- <?php
- while ($zeile = $sql_ergebnis -> fetch_assoc()) {
- ?>
- <td> <?php print $zeile-> user_applikation;?> </td>
- <td> <?php print $zeile-> user_password;?> </td>
- </tr>
- <?php
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement