Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2. include_once 'DatabaseController.php';
  3. include_once 'SessionController.php';
  4. include_once 'DisplayEngine.php';
  5. $display = new DisplayEngine("../template/friends.html");
  6. $session = new SessionController();
  7. $id = $session->getSessionID();
  8. $db = new DatabaseController();
  9. $search = $_POST['search'];
  10. $ergebnisse = $db->searchFriend($search);
  11. //echo '<pre>'; print_r($ergebnisse); echo '</pre>';
  12. $replaceString ;
  13.  
  14. foreach ( $ergebnisse as $key =>$value){
  15.     $profil = $db->getProfil($value);
  16.     //echo '<pre>'; print_r($profil); echo '</pre>';
  17.     if($id != $profil["ProfilID"]){
  18.      
  19.        
  20.        
  21.         $isfriend ;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.         $link = (string)$profil["Vorname"].' '.(string)$profil["Nachname"];
  28.         $link2;
  29.         $pid = ''.$value;
  30.       if($isfriend){
  31.           $link2 =$link.'<form action="FriendDelete.php?id='.$pid.'" method="get">
  32.                     <p><input name="'.$pid.'" type="submit" value="Delete"></p>
  33.                    </form>';
  34.        }else {
  35.              $link2 = $link.'<form action="FriendAdd.php?id='.$pid.'" method="get">
  36.                     <p><input name="'.$pid.'" type="submit" value="Add"></p>
  37.                    </form>';
  38.         }
  39.      $replaceString = $replaceString.$link2.'<br>';
  40.     }
  41. }
  42.  
  43.  
  44.  
  45. $display->replace('<!--##SEARCH##-->', $replaceString);
  46. echo $display->render();
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement