$Profile_data = json_decode(curl_function($profile_data_url)); if (isset($Profile_data->error)) { echo "Problem in Facebook Connect! Try again later."; exit; } else { $id = $Profile_data->id; $fname = $Profile_data->first_name; $lanme = $Profile_data->last_name; $email = $Profile_data->email; $image = "http://graph.facebook.com/" . $id . "/picture"; $access_token = $FBtoken[0]; /** INSERT AND UPDATE DB **/ if ($_SESSION["userid"]) { updateFBuser($_SESSION["userid"], $image, $access_token, $id, $fname, $lname, $email); } else { easyRegister("FB" . $id, $fname, $lanme, $email, $image, 1, $access_token, $id); } } } } else { echo "Problem in Facebook Connect! Try again later."; exit; } ?> <script> window.opener.location = '/profile.html'; window.close(); </script> <?php } else { $login_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($redirect_url) . "&scope=email,read_stream,publish_stream,publish_checkins,offline_access,friends_checkins,user_checkins&display=popup";
$aa = array(); $xml = new SimpleXmlElement($content); foreach ($xml->children() as $val) { $aa[] = $val; } //print_r($aa); exit; $username = "******" . $aa[0]; $firstname = $aa[1]; $img_url = $aa[5]; //add the twitter information if ($_SESSION["userrole"] == 1) { updateTWuser($_SESSION['oauth_access_token'], $_SESSION['oauth_access_token_secret'], $tok["user_id"], $firstname); url_redirect(DOCROOT . "admin/social-media-account/"); } //login function easyRegister($username, $firstname, "", "", $img_url, 2); /* $content1=$to->OAuthRequest('http://twitter.com/statuses/friends.xml?user_id='.$aa[0], array(), 'GET'); $content2=$to->OAuthRequest('http://twitter.com/statuses/followers.xml?user_id='.$aa[0], array(), 'GET'); $db = readDatabase($content1); $db1= readDatabase($content2); $_SESSION['friends']=$db; $_SESSION['followers']=$db1; */ $redirect_url = DOCROOT . 'profile.html'; ?> <script> window.location= '<?php echo $redirect_url; ?>