$global['app_id'] , 'secret' => $global['secret_key'], 'cookie' => true, 'fileUpload' => true, 'domain' => $global['domain'] )); $login_url = array( 'canvas' => 1, 'fbconnect' => 0, 'redirect_uri' => $global['app_link'], 'scope' => $global['app_perms'] ); $loginUrl = $facebook->getLoginUrl($login_url); //$session = $_SESSION; $userId = $facebook->getUser(); } $facebook->getAccessToken(); //$IMG_UPLOAD_PATH=dirname(__FILE__).'/uploads/'; try { //$accounts = $facebook->api('/me/accounts','GET' , array('access_token' => $facebook->getAccessToken())); $userData = $facebook->api('/me'); $token_status="1"; } catch(Exception $e) { //print_r($e); $token_status="0"; } //echo $token_status; if(isset($_GET['showtime'])) { echo date('d-m-Y H-i-s').'
'; echo date('H').'=='.strtotime('+13 hours').'
'; echo $time = date('Y-m-d H:i:'.'00', strtotime('+9 hours')); } /* $accountsInfo = array(); if($accounts && isset($accounts['data']) && count($accounts['data']) > 0) { $accountsInfo = parseAccounts($accounts['data']); $accountsInfo[$userData['id']] = $userData['name']; } if($userData) { $userDbData = user::userExist($userData['id']); if(! $userDbData) user::createUser($userData, $facebook->getAccessToken()); else { $option['access_token'] = $facebook->getAccessToken(); user::updateUser($option, $userDbData[0]['id']); } } */ /* echo "HI"; echo "Login-status-->".$token_status; echo "
";
*/
//print_r($userDbData);
//exit;
//if (!$session){											  
 // }else
  //{
	//$accessToken=$session['access_token'];
	try{
	$signed_request = $facebook->getSignedRequest(); 	
	//echo "ANAS";
	//print_r($signed_request);

	$showentry= $signed_request["app_data"];
	//$pagid = $signed_request['page']['id'];
	//$islike= $signed_request['page']['liked'];
		
			$user = $facebook->getUser();  
			
			$uid = $facebook->getUser(); 
			$fbme = $facebook->api('/me');			
			//print_r($fbme);
			$fb_email=$fbme["email"];
			$fbid=$fbme["id"];
			if($fb_email=='')
			{
				$fb_email = $fbid.'@facebook.com';
			}

			$name=$fbme['name'];
			$dob=$fbme["birthday"];
			$location=$fbme["location"]["name"];
			$gender=ucfirst($fbme["gender"]);

			$regi_dt=date('Y-m-d H:i:s');	
			$udob=explode("/",$dob);
		
		$sql="select * from gems_bling_users  where fb_id = '".$fbid."'";
		$query=mysql_query($sql);
		$num=mysql_num_rows($query);
		$line=mysql_fetch_array($query);
		$db_email=$line['user_email'];	
		if($num <= 0)
		{
				$sql_ins ="insert into gems_bling_users
						set
							fb_id = '".$fbid."',
							user_name ='".$name."',
							user_email = '".$fb_email."',
							dob = '".$dob."',
							location = '".$location."',
							gender = '".$gender."'";
				$res_sel = mysql_query($sql_ins);
		} 
		else{
			  $sql_up ="update gems_bling_users
						 set 
							user_name ='".$name."',
							user_email = '".$fb_email."',
							dob = '".$dob."',
							location = '".$location."',
							gender = '".$gender."'
							where fb_id = '".$fbid."'";
					$res = mysql_query($sql_up);
				}
		 $token_status="1";
       }catch(Exception $e){
			$token_status="0";
		}	
  //}
?>


Gemstone Universe Community
Community Chat