Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     if(!$_SESSION["testlogin"])
  4.     {
  5.         header("Location: index.php");
  6.     }
  7.     $dbc= @new mysqli("localhost", "root", "", "login") or die("No connection");
  8.     $username = $_SESSION["testlogin"];
  9.     $used = false;
  10.     $user_id = "SELECT U_id FROM user WHERE U_name = '$username'";
  11.     $result = mysqli_query($dbc, $user_id);
  12.     if($result) {
  13.         $row = $result -> fetch_assoc();
  14.         $u_id = $row['U_id'];
  15.     }
  16.     $sql_abfrage = "SELECT user_applikation, user_password FROM apps NATURAL JOIN passwoerter NATURAL JOIN user WHERE U_id = '$u_id'";
  17.     if ($_POST == true)
  18.     {
  19.         $suchtext = $_POST["suchtext"];
  20.         $used = true;
  21.     }
  22.     if($used == true)
  23.     {
  24.         $sql_abfrage .= " AND user_applikation or user_password LIKE '%" . $suchtext . "%'";  
  25.     }
  26.     $sql_ergebnis = mysqli_query($dbc, $sql_abfrage);      
  27. ?>
  28. <html>
  29.     <head>
  30.         <link rel="stylesheet" type="text/css" href="ProjektCSS.css"  >
  31.         <title>
  32.             A APP PASSWORD
  33.         </title>
  34.     </head>
  35.     <body class="body">
  36.         <form action="main.php" method="post">
  37.             <h1 class="header"> Welcome on your Database </h1>
  38.             <input class="form2" type="text" name="suchtext" placeholder="Suchtext"/>  
  39.             <input class="submit2" type="submit" placeholder="Suchen" name="used" />
  40.         </form>
  41.         <table class="table">
  42.         <tr>
  43.             <th>
  44.                 <a href="mypage.php?sort=user_applikation" class="theader"> Applikationen </a>             
  45.             </th>
  46.             <th>
  47.                 <a href="mypage.php?sort=user_password" class="theader"> Passwoerter </a>
  48.             </th>
  49.        
  50.         <tr>
  51.         <?php
  52.         while ($zeile = $sql_ergebnis -> fetch_assoc()) {
  53.         ?>
  54.        
  55.             <td> <?php print $zeile-> user_applikation;?> </td>
  56.             <td> <?php print $zeile-> user_password;?> </td>
  57.         </tr>
  58.        
  59.         <?php  
  60.             }
  61.         ?>
  62.         </table>
  63.        
  64.     </body>
  65. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement