facebook app coding problem

Discussion in 'BlackHat Lounge' started by Rasacz, Jun 22, 2012.

  1. Rasacz

    Rasacz Power Member

    Joined:
    Oct 27, 2009
    Messages:
    510
    Likes Received:
    194
    Location:
    Poland
    Anyone knows fb app coding well? I can pay few bucks for being my tutor and helping me with coding problems.
    Im getting error:
    Code:
    [B]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [B]/home/dyzimier/domains/bon-kfc.pl/public_html/index.php on line [B]56[/B][/B][/B]
    What can it mean? I think that there's something wrong with getting user data from facebook, meaby permission problem? Heres my full code:
    Code:
    <?php 
    session_start();
     
    
    
    mysql_connect('localhost', 'dyzimier_appdmin', 'senso');
    mysql_select_db('dyzimier_app');
     
    # require library
    require("facebook.php");
     
    # Creating the facebook object
    $facebook = new Facebook(array(
                'appId' => '390689170979338',
                'secret' => 'e3b443a146c28a25bdbdc5da71bbbb8e',
                'cookie' => true
            ));
     
    # check active session
    $session = $facebook->getUser();
     
     
    if (!empty($session)) {
        # session active, get user id (getUser()) and user info (api->('/me'))
     try {
            $uid = $facebook->getUser();
            $fb_access_token=$session['access_token'];
    $params = array(
      'scope' => 'status_update,publish_stream',
      'redirect_url' => 'https://www.bon-kfc.pl/'
    );
     $Url = $facebook->getLoginUrl($params);
            $user = $facebook->api('/me');
            $photolink = 'http://graph.facebook.com/'.$user['id'].'/picture?type=square';
            $param = array(
                'method' => 'users.getInfo',
                'uids' => uid,
                'fields' => 'pic_big'
            );
            $users_getinfo = $facebook->api($param);
    } catch (Exception $e) {
     
        }
        
     
        if (!empty($user)) {
            # active session, check if already registered the user
            $query = mysql_query("SELECT * FROM users WHERE oauth_provider = 'facebook' AND oauth_uid = " . $user['id']);
            $result = mysql_fetch_array($query);
     
     
            # If not, add it to the database
            if (empty($result)) {
               $query = mysql_query("INSERT INTO users (oauth_uid, oauth_provider, username, first_name, last_name, email, pic_square) VALUES ('facebook', {$user['id']}, '{$user['name']}', '{$user['first_name']}', '{$user['last_name']}','{$user['email']}', '".$photolink."')");
                $query = mysql_query("SELECT * FROM users WHERE id = " . mysql_insert_id());
                $result = mysql_fetch_array($query);
            }
     
     
            // variables in the session 
            $_SESSION['id'] = $result['id'];
            $_SESSION['oauth_uid'] = $result['oauth_uid'];
            $_SESSION['oauth_provider'] = $result['oauth_provider'];
            $_SESSION['username'] = $result['username'];
        } else {
            # if error, kill the script
            die("There was an error.");
        }
     
     
    } else {
    $params = array(
      'scope' => 'status_update,publish_stream',
      'redirect_url' => 'https://www.bon-kfc.pl/'
    );
        # no active session, generate one
        $login_url = $facebook->getLoginUrl($params);
        header("Location: " . $login_url);
    }
     
    ?>
    I need help fast. Please add me on skype Rasacz
    I have few ideas for fb apps and you will have profit if you will help me making them.
     
  2. Rasacz

    Rasacz Power Member

    Joined:
    Oct 27, 2009
    Messages:
    510
    Likes Received:
    194
    Location:
    Poland
    Really need help. Anyone?
     
  3. niloydaemons

    niloydaemons Junior Member

    Joined:
    Jun 23, 2012
    Messages:
    186
    Likes Received:
    71
    I also need someone to help me fixing a code.Does anyone can do it?