I need a script to work as a "likethis" script for Facebook
There's been several sites popping up everywhere where you can submit a sentence or phrase, and people can "like" it on Facebook. I need a script that will work like that with a like button for each submission. Is there a script like that anywhere? Any help would be appreciated.
I don't know very much about php.. but I can't seem to get this script working right. It won't show the ID and Site Name within the Facebook like script. Does anyone know how to edit it to get it to work right?
At the moment it shows up as liking the site title rather than the "likes" element. I changed the table name from "title" to "likes" because the Title was interfering. But it's still showing up as the site title. And I can't figure it out.
Code:
<?php
$url = urlencode("http://like.rambling-theory.com/?like=" . $id);
$data = <<< _HTML
_HTML;
$msg = preg_replace("/\n/", " ", $msg);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<html>
<title>Like Theory - Rambling Theory FBLike</title>
<meta name="description" content="Want to share anything with your Friends on FACEBOOK? We have this site for you. Come Share the Likes. We also have Many Top liked, Proverbs, Funny Quotes to be Liked." />
<meta name="keywords" content="like on facebook,forex,banking, likefb, likeylike, likeportal, facebook like, fblike, like things on facebook, like my things, like, like my views, facebooked likes, thefacebook, google, like on facebook"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet"
href="files/style.css" type="text/css">
<link rel="shortcut icon" href="/images/sitelogo.png" type="image/x-icon">
<meta property="og:site_name" content="Like Theory"/>
<meta property="og:url" content="http://like.rambling-theory.com/"/>
<meta property="og:title" content="<?php '.$fetch[likes].'?>"/>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript" src="files/TyntLite.js"></script></head><body><div
id="container">
<?PHP
if($_GET['add']){
if($_POST['aa'] == ""){
echo'<script type="text/javascript">window.location = "?"; </script>';
}else{
$posted = mysql_real_escape_string($_POST[aa]);
mysql_query("INSERT INTO `likes` (`likes`, `numLikes`) VALUES ('$posted', '0')");
$select = mysql_query("SELECT * FROM `likes` WHERE `likes`='$_POST[aa]' AND `numLikes`='0'ORDER BY `id` DESC LIMIT 1 ");
$fetch = mysql_fetch_array($select);
echo'<script type="text/javascript">window.location = "?id='.$fetch[id].'"; </script>';
}
}else if($_GET['id']){
$select = mysql_query("SELECT * FROM `likes` WHERE `id`='$_GET[id]' LIMIT 1");
$count = mysql_num_rows($select);
if($count == 0){
echo'<script type="text/javascript"> window.location = "?"; </script>';
}else{
$fetch = mysql_fetch_array($select);
$count = $fetch[numLikes] + 1;
$valm = $_GET[id] - 1;
$valp = $_GET[id] + 1;
mysql_query("UPDATE `likes` SET `numLikes`='$count' WHERE `id`='$_GET[id]'");
echo'<meta property="og:title" content="'.$fetch[likes].'"/>
<div id="box_0">
<div id="head_0">
</div>
<div id="content_0">
<table width=100%><td align="left"><p class="big"><a href="http://like.rambling-theory.com"><font color="white">Like Theory</font></a></td><td align="right"><font size="5"><a href="?id='.$valm.'">Previous Page</a> | <a href="?id='.$valp.'">Next Page</a></font></td></table></p><BR>
<center>
<script type="text/javascript"><!--
google_ad_client = "pub-4111169165033977";
/* 468x60, created 6/11/10 */
google_ad_slot = "2533550869";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
<center>
<b> <p><font size="5"><font color="#e71818">'.$fetch[likes].'</font></font></p></b>
<img src="http://like.rambling-theory.com/images/arrow2.png"><font size="2">Click on Like to Show this On Your Facebook WALL</font>
<p><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Flike.rambling-theory.com%2F%3Fid%3D%27.%24_GET%5Bid%5D.%27&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe></p>
</center>
<center>
<script type="text/javascript"><!--
google_ad_client = "pub-3805657647131319";
google_ad_slot = "8300161717";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
<center>
<BR><a href="http://like.rambling-theory.com/"><font size="2"><u>Want to Share Anything with your friends to LIKE on FACEBOOK? CLICK HERE</u></font></a></p>
</center>
</div>
</div>
<img src="/images/motionspace.png" alt="Spacer" border="0">';
}
}else{
?>
</center><img src="/logo.png"></center>
<div id="commentsparent">
<div id="comments">
<form method="POST" action="?add=new" name="formLike">
<textarea cols="50" rows="4" name="aa" class="comments"></textarea>
</div>
</div>
</form>
<div align="right">
<a href="#" onClick="javascript:document.formLike.submit();"><img src="files/like1.png" alt="Like" width="291" height="110" border="0"
type="image"></a> </div>
<? } ?>
<div id="bottomboxes">
<div id="box_1">
<div id="head_1">
<font size="48px"><p class="big">Top Likes</p></font>
</div>
<div id="content_1">
<?PHP
$select = mysql_query("SELECT * FROM `likes` ORDER BY `numLikes` DESC LIMIT 15");
$count = mysql_num_rows($select);
if($count == 0){
echo'<font size="2px">• Currently no top likes<br></font>';
}else{
while($fetch = mysql_fetch_array($select)){
echo'<font size="2px">•<a href="?id='.$fetch[id].'">'.$fetch[likes].'</a><br></font>';
}
}
?>
</div>
</div>
<div id="box_2">
<div id="head_2">
<font size="48px"><p class="big">Recent Likes</p></font>
</div>
<div id="content_2">
<?PHP
$select = mysql_query("SELECT * FROM `likes` ORDER BY `id` DESC LIMIT 15");
$count = mysql_num_rows($select);
if($count == 0){
echo'<font size="2px">• Currently no likes<br></font>';
}else{
while($fetch = mysql_fetch_array($select)){
echo'<font size="2px">• <a href="?id='.$fetch[id].'">'.$fetch[likes].'</a><br></font>';
}
}
?>
</div>
</div>
</div>
</div>
</body></html>