กรุณารอสักครู่ ... 
               
               
               
              
	
	include("scs_short_detail.php");
	
// Remember to copy files from the SDK's src/ directory to a
// directory in your application on the server, such as php-sdk/
require_once('fb_sdk/facebook.php'); 
$facebook = new Facebook(array(
  'appId'  => '176156765887394',
  'secret' => '2678ab6bbc808b73df16c56d0f53bf78',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
  try {
    // Get the user profile data you have permission to view
    $user_profile = $facebook->api('/me');
    //echo "";
    //print_r($user_profile);
    //echo "";
	
  } catch (FacebookApiException $e) {
    $user = null;
  }
} else {
die('');
}
$img = file_get_contents('https://graph.facebook.com/'.$user_profile['id'].'/picture?type=large');
$file = dirname(__file__).'/fbprofile/'.$user_profile['id'].'.jpg';
file_put_contents($file, $img);
$fb_image="fbprofile/".$user_profile['id'].".jpg";
//echo  $user_profile[id]." ";
echo "
";
//echo $user_profile[link];
//echo "
  
  ";
//echo  "Hi, ".$user_profile['name'].". Welcome to ShortChargeShock.com.";
 
 // insert FB detail to DB
include("config.inc.php");
mysql_connect($host,$user,$passwd);
mysql_select_db($dbname);
mysql_query("SET CHARACTER SET UTF8");
$nowyear=date("Y");
$nowtime=date("Y-m-d H:i:s"); 
/*
echo $user_profile[link]." ";
echo $user_profile[username]." ";
echo $user_profile[id]." ";
echo $fb_image;
*/
//echo $user_profile[name];
// Check FB_ID in DB
$sql_fb_check="SELECT fb_id FROM smf_member WHERE fb_id='".$user_profile['id']."' ";
$result_fb_check=mysql_query($sql_fb_check);
mysql_query("SET NAMES TIS-620");
$result_Nrow=mysql_num_rows($result_fb_check);
if ($result_Nrow==0) {
$sql_fb="INSERT INTO smf_member  
(Facebook, fb_name, fb_id, fb_user, fb_image) VALUES 
('".addslashes($user_profile['link'])."', '".addslashes($user_profile['name'])."', '".addslashes($user_profile['id'])."', '".addslashes($user_profile['username'])."', '".addslashes($fb_image)."') ";
mysql_query("SET NAMES UTF8");
$result_fb=mysql_query($sql_fb); 
//$_SESSION['s_ID']=$user_profile['id'];
//$_SESSION['s_User']=$user_profile['name'];
if ($result_fb) {
}
} else {
$sql_fb="UPDATE smf_member  
SET Facebook='".addslashes($user_profile['link'])."', fb_name='".addslashes($user_profile['name'])."', fb_id='".addslashes($user_profile['id'])."', fb_user='".addslashes($user_profile['username'])."', fb_image='".addslashes($fb_image)."' WHERE fb_id='".$user_profile['id']."' ";
mysql_query("SET NAMES UTF8");
$result_fb=mysql_query($sql_fb); 
//$_SESSION['s_ID']=$user_profile['id'];
//$_SESSION['s_User']=$user_profile['name'];
}
$sql="SELECT fb_name, fb_id FROM smf_member WHERE fb_id='".$user_profile['id']."' ";
//mysql_query("SET NAMES UTF8");
mysql_query("SET CHARACTER SET tis620");
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if ($row) {
$_SESSION['s_ID']=$row['fb_id']; 
$_SESSION['s_User']=$row['fb_name'];
}
echo "
  
  ";
echo  "Hi, ".$user_profile['name'].". Welcome to ShortChargeShock.com.";
/*
if ($_POST['action']=="new") {
header("location:postq.php");  
}elseif ($No && $page)  {
header("location:show.php?No=$No&page=$page"); 
} else {
header("location:index.php");
}
*/
echo "";
echo "SESSION_User = ".$_SESSION['s_User'];
$_SESSION['s_ID']=$user_profile['id'];
/*
if ($result_fb) {
echo "ok";
} else {
echo "not ok"; 
}
*/
?>
                | 
           
         
         
           
 
		  include("scs_short_detail.php");
		  ?>           
           
           
           
            
        
         |