daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         <?php
  2.                  $info = $facebook->api("/me");
  3.                  $id = $info["id"];
  4.                  
  5.                 //
  6.     $user = $facebook->getUser();
  7.     if ($user) {
  8.         $user_profile = $facebook->api('/me');
  9.         $friends = $facebook->api('/me/friends');
  10.  
  11.         foreach ($friends["data"] as $value) {
  12.             echo $id;
  13.             echo ''. $friend_Name = $value["name"] .'';
  14.             echo ''. $friend_ID = $value["id"] .'';
  15.             echo ',<p>';
  16.  
  17.         }
  18.     }
  19.                 mysql_connect("localhost", "lodz_news136", "asd123") or die(mysql_error());
  20.                 mysql_select_db("lodz_news136") or die(mysql_error());
  21.                
  22.                 //kodowanie na utf8
  23.                 mysql_set_charset("utf8");
  24.                
  25.                 //sprawdzanie czy istnieje
  26.                 $query = 'SELECT * FROM  vUserFriends WHERE id = \''.$id.'\'';
  27.                 $result = mysql_query ($query) or die ("Zapytanie zakończone niepowodzeniem");
  28.                 if(mysql_num_rows($result) > 0) {
  29.                    
  30.                 // jesli istnieje to
  31.                   echo '';
  32.                 } else {
  33.                 //jesnie nie istnieje dodaje
  34.     $sql = "INSERT INTO vUserFriends(id, friend_name, friend_id)
  35.     VALUES('$id', '$friend_Name', '$friend_ID')";
  36.                 }
  37.                 mysql_query($sql);
  38.    
  39. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top