Wednesday, October 12, 2011

Facebook developers application Facebook Api PhP - Index.php

Index.Php Code :

<?php
require("config.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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Testing</title>
</head>
<style>
html,
body {
margin:0;
padding:0;
height:auto;
background-color:#000066;
}
#container {
min-height:100%;
position:relative;
}
#header {
background:#0033FF;
padding:10px;
}
#body {
padding:10px;
padding-bottom:60px; /* Height of the footer */
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:73px; /* Height of the footer */
background:#0033FF;
}
.style2 {
font-weight: bold;
color: #0000CC;
font-size: 36px;
}
.style3 {
color: #0000CC;
font-size: 18px;
}
</style>
<body>
<div id="container">
<div id="header">
<div align="center" class="style2">Testing</div>
</div>
<div id="body"><?php
# Let's see if we have an active session
$session = $facebook->getuser();
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
$accesstoken=$session['access_token'];
} catch (FacebookApiException $e) {
error_log($e);
}
}
if($me)
{
// do what you have to do
echo "hello user";
echo "<p></p>";
echo "<p></p>";
echo "<p></p>";
}else {
$loginUrl = $facebook->getLoginUrl(
array(
'canvas' => 1,
'fbconnect' => 0,
'req_perms' => 'user_about_me,user_activities'
)
);
echo '<script>top.location="'.$loginUrl.'";</script>';
//echo '<fb:redirect url="' . $loginUrl . '" />';
//header('Location: '.$loginUrl);
}
?>
<a href="http://apps.facebook.com/ahmedsamir"><strong>Back</strong></a></div><p align="center">&nbsp;</p>
<div id="footer"> <hr align="center" color="#0000CC">
<p align="center" class="style14 style3"><strong>Copy Right &copy; Evry1falls </strong></p>
</div>
</div>
</body>
</html>
view raw gistfile1.phtml hosted with ❤ by GitHub

Main.php <=Previous || Next => Config.php