อันนี้ คือโคดทั้งหมดที่ผมทำไว้ช่วยดูให้หน่อยฯะครับว่า ต้องแก้ไขตรงไหนอะไรอย่างไรบ้าง...ขอบคุณครับ
<?php
include("fb_connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" xmlns:fb="
http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sample FB Login</title>
</head>
<body>
<?php
//pre($fb_user);
?>
<center><h>ยินดีต้อนรับเข้าสู่ Note Amazon</h></center>
<?php if($fb_user){ // ถ้ามีการล็อกอิน facebook อยู่แล้ว แสดงลิ้งค์สำหรับ logout ?>
<a href="<?=$logoutUrl?>">Logout</a>
<?php }else{ // ถ้ายังไม่ได้ล็อกอิน แสดงลิ้งค์สำหรับ Login ?>
<div>
Login using OAuth 2.0 handled by the PHP SDK:
<a href="<?=$loginUrl?>">Login with Facebook</a>
</div>
<?php } ?>
<?php if($fb_user){ // ถ้ามีการล็อกอิน facebook อยู่แล้ว แสดงข้อมูลของคนๆ นั้น ?>
<p> <img src="
https://graph.facebook.com/<?=$fb_user?>/picture"></p>
<?php
pre($fb_user);
?>
//////
<?
$access_token = $facebook->getAccessToken();
?>
///////
<?php }else{ // ถ้ายังไม่ได้ล็อกอิน ?>
<strong><em>You are not Connected.</em></strong>
<?php } ?>
<form id="form1" name="form1" method="post" action="">
<table width="651" border="1">
<tr>
<td width="118">ID Fanfage </td>
<td width="517"><label>
<input type="text" name="textfield" />
</label></td>
</tr>
<tr>
<td>Title </td>
<td><label>
<input name="textfield2" type="text" size="100" />
</label></td>
</tr>
<tr>
<td height="254">Description</td>
<td><label>
<textarea name="textarea" cols="75" rows="10"></textarea>
</label></td>
</tr>
</table>
<br />
<label>
<input type="submit" name="Submit" value="Post Note" />
</label>
<p> </p>
<p>
<label></label></p>
</form>
<?php
require_once('facebook.php'); //include api
$config = array('appId' => '0000000000000','secret' => '999999999999999999999999');
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
if($user_id) {
try {
$args=array(
"subject"=>$_POST['subject'],
"message"=>$_POST['message']
);
$facebook->api('/me/note', 'POST',$args);
//ส่งผ่านแระ
echo "Success";
}catch(FacebookApiException $e) {
//ส่งไม่ได้อ่ะ
pre($e);
}
}
?>
</body>
</html>
อันนี้ คือโคดทั้งหมดที่ผมทำไว้ช่วยดูให้หน่อยฯะครับว่า ต้องแก้ไขตรงไหนอะไรอย่างไรบ้าง...ขอบคุณครับ
<?php
include("fb_connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sample FB Login</title>
</head>
<body>
<?php
//pre($fb_user);
?>
<center><h>ยินดีต้อนรับเข้าสู่ Note Amazon</h></center>
<?php if($fb_user){ // ถ้ามีการล็อกอิน facebook อยู่แล้ว แสดงลิ้งค์สำหรับ logout ?>
<a href="<?=$logoutUrl?>">Logout</a>
<?php }else{ // ถ้ายังไม่ได้ล็อกอิน แสดงลิ้งค์สำหรับ Login ?>
<div>
Login using OAuth 2.0 handled by the PHP SDK:
<a href="<?=$loginUrl?>">Login with Facebook</a>
</div>
<?php } ?>
<?php if($fb_user){ // ถ้ามีการล็อกอิน facebook อยู่แล้ว แสดงข้อมูลของคนๆ นั้น ?>
<p> <img src="https://graph.facebook.com/<?=$fb_user?>/picture"></p>
<?php
pre($fb_user);
?>
//////
<?
$access_token = $facebook->getAccessToken();
?>
///////
<?php }else{ // ถ้ายังไม่ได้ล็อกอิน ?>
<strong><em>You are not Connected.</em></strong>
<?php } ?>
<form id="form1" name="form1" method="post" action="">
<table width="651" border="1">
<tr>
<td width="118">ID Fanfage </td>
<td width="517"><label>
<input type="text" name="textfield" />
</label></td>
</tr>
<tr>
<td>Title </td>
<td><label>
<input name="textfield2" type="text" size="100" />
</label></td>
</tr>
<tr>
<td height="254">Description</td>
<td><label>
<textarea name="textarea" cols="75" rows="10"></textarea>
</label></td>
</tr>
</table>
<br />
<label>
<input type="submit" name="Submit" value="Post Note" />
</label>
<p> </p>
<p>
<label></label></p>
</form>
<?php
require_once('facebook.php'); //include api
$config = array('appId' => '0000000000000','secret' => '999999999999999999999999');
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
if($user_id) {
try {
$args=array(
"subject"=>$_POST['subject'],
"message"=>$_POST['message']
);
$facebook->api('/me/note', 'POST',$args);
//ส่งผ่านแระ
echo "Success";
}catch(FacebookApiException $e) {
//ส่งไม่ได้อ่ะ
pre($e);
}
}
?>
</body>
</html>