Skip to content

Instantly share code, notes, and snippets.

@hkulekci
Created June 15, 2011 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkulekci/1027684 to your computer and use it in GitHub Desktop.
Save hkulekci/1027684 to your computer and use it in GitHub Desktop.
Facebook Application for Fan Page
<?php
if ($_POST['contact_form_posted']){
echo 'posts';
}
?>
<html>
<head>
<title>My Facebook Page</title>
<style>
span.title{
width:200px;
display:block;
float:left;
}
div.contact_from input, div.contact_from textarea{
border:1px dashed #ccc;
background:#f2f2f2;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
<script src="http://connect.facebook.net/en_US/all.js"> </script>
<script>
$(document).ready(function(){
var logined = false;
var ApplicationID = '224822447546493';
FB.init({
appId:ApplicationID,
cookie:true,
status:true,
xfbml:true
});
FB.login(function(response) {
if (response.session) {
logined = true;
return;
} else {
logined = false;
$("#as").html('You not not login and maybe not Like me. Please login and like me!');
$("#res2").css({'display':'block'});
}
});
if (logined){
FB.api(
{
method: "pages.isFan",
page_id: ApplicationID,
},
function(response) {
//console.log(response);
if(response){
$("#sa").html('You Like me. Thank you!');
$("#res2").css({'display':'block'});
} else {
document.getElementById("sa").innerHTML = 'You do not Likey :( Please Like Me --------------^';
$("#res1").css({'display':'block'});
}
}
);
$('.contact_form_').submit(function() {
alert($('.contact_form_').serialize());
return false;
});
}
});
</script>
</head>
<body>
<div id="fb-root"></div>
<div id="as"></div>
<div id="sa"></div>
<div class="contact_from"><form name="contact_form_posted" class="contact_form_">
<div><label><span class="title">Full Name</span><span class="dot">:</span><input type="text" value="" class="name"></label></div>
<div><label><span class="title">Email</span><span class="dot">:</span><input type="text" value="" class="email"></label></div>
<div><label><span class="title">Phone</span><span class="dot">:</span><input type="text" value="" class="phone"></label></div>
<div><label><span class="title">Message</span><span class="dot">:</span><textarea></textarea></label></div>
<div align="right"><input type="submit" name="save" class="save" value="Beni Kaydet"></div></form>
</div>
<img src="erkin-koray.jpg" alt="Erkin KORAY" id="res1" style="display:none;"/>
<img src="erkin.jpg" alt="Erkin KORAY" id="res2" style="display:none;"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment