Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <?php
  2. include_once "fb-authentication.php";
  3. include_once "index.php";
  4.  
  5.  
  6. $name = $userInfo[0]['name'];
  7.  
  8. $uid = $userInfo[0]['uid'];
  9.  
  10. $friends = getUserFriendList($facebook);
  11. foreach($friends[data] as $friend);
  12.  
  13. function getUserFriendList($facebook){
  14. $friends = $facebook->api('/me/friends');
  15. return $friends;
  16. }
  17.  
  18.  
  19. //////BUILD CONNECTION FOR POSTGRESQL////////
  20.  
  21. $connection = pg_connect("dbname=someonedeletedme user=someonedeletedme password=rfdfdsfdsf host=localhost");
  22. if (!$connection) {
  23. print("Connection Failed.");
  24. exit;
  25. }
  26.  
  27. $query = "SELECT * FROM olddatabase,recentdatabase";
  28.  
  29. $result = pg_query($query);
  30. if (!$result) {
  31. echo "Problem with query " . $query . "<br/>";
  32. echo pg_last_error();
  33. exit();
  34. }
  35.  
  36.  
  37. $uploaddatabase = pg_query_params($connection,'insert into recentdatabase (uid,friends) values ($1,$2)', array($uid, '{'.implode(',',$friend).'}'));
  38.  
  39.  
  40.  
  41. echo "<b>STORING YOUR MOST RECENT FRIENDS LIST TO OUR DATABASE FOR STORAGE.</b><br/><br/>";
  42.  
  43.  
  44. while($myrow = pg_fetch_assoc($result)) {
  45. printf ("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", $myrow['id'], htmlspecialchars($myrow['firstname']), htmlspecialchars($myrow['surname']), htmlspecialchars($myrow['emailaddress']));
  46. }
  47.  
  48.  
  49. // Greet the currently logged-in user!
  50. echo"Hello, $name $uid";
  51. // Print out at most 25 of the logged-in user's friends,
  52. // using the friends.get API method
  53. echo "<p> Active Friends:</p>";
  54. $friends = getUserFriendList($facebook); foreach($friends[data] as $friend) echo "Name; {$friend[name]}, id: {$friend[id]}<br><br><br><br>";
  55. echo "</p>";
  56.  
  57.  
  58.  
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement