Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once "fb-authentication.php";
- include_once "index.php";
- $name = $userInfo[0]['name'];
- $uid = $userInfo[0]['uid'];
- $friends = getUserFriendList($facebook);
- foreach($friends[data] as $friend);
- function getUserFriendList($facebook){
- $friends = $facebook->api('/me/friends');
- return $friends;
- }
- //////BUILD CONNECTION FOR POSTGRESQL////////
- $connection = pg_connect("dbname=someonedeletedme user=someonedeletedme password=rfdfdsfdsf host=localhost");
- if (!$connection) {
- print("Connection Failed.");
- exit;
- }
- $query = "SELECT * FROM olddatabase,recentdatabase";
- $result = pg_query($query);
- if (!$result) {
- echo "Problem with query " . $query . "<br/>";
- echo pg_last_error();
- exit();
- }
- $uploaddatabase = pg_query_params($connection,'insert into recentdatabase (uid,friends) values ($1,$2)', array($uid, '{'.implode(',',$friend).'}'));
- echo "<b>STORING YOUR MOST RECENT FRIENDS LIST TO OUR DATABASE FOR STORAGE.</b><br/><br/>";
- while($myrow = pg_fetch_assoc($result)) {
- 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']));
- }
- // Greet the currently logged-in user!
- echo"Hello, $name $uid";
- // Print out at most 25 of the logged-in user's friends,
- // using the friends.get API method
- echo "<p> Active Friends:</p>";
- $friends = getUserFriendList($facebook); foreach($friends[data] as $friend) echo "Name; {$friend[name]}, id: {$friend[id]}<br><br><br><br>";
- echo "</p>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement