Skip to content

Instantly share code, notes, and snippets.

@angeloped
Forked from jordanduncan221/Facebook Like Script
Created August 25, 2018 13:59
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 angeloped/8e9ac7114149d5bb0f75d84996cf5fa2 to your computer and use it in GitHub Desktop.
Save angeloped/8e9ac7114149d5bb0f75d84996cf5fa2 to your computer and use it in GitHub Desktop.
Very clean and simple Facebook like script
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
<head>
<title><?php $quote = strip_tags($_GET['p']); print stripslashes($quote) ?></title>
<style type="text/css">
body {
background: #45A2D0;
color: #333;
font-family: "Myriad Pro";
text-align: center;
}
#main {
margin: 20px auto 0 auto;
width: 805px;
font-size: 38px;
text-shadow: #98CCE5 0px 1px 0px;
}
#like {
margin: 10px auto 0 auto;
padding: 5px;
width: 460px;
background: #327A9D;
border: 1px solid #246B8F;
border-radius: 3px;
}
#input {
margin: 0 auto 0 auto;
font-size: 22px;
width: inherit;
}
TEXTAREA {
width: 350px;
height: 150px;
background: #F5F5F5;
border: 1px solid #CCC;
border-radius: 5px;
font-family: "Myriad Pro";
font-size: 16px;
margin: 10px 0 0 0;
}
</style>
</head>
<body>
<div id="main">
<?php
$quote = strip_tags($_GET['p']);
print stripslashes($quote);
?>
<div id="like">
<?php
if(isset($_GET['p'])){
print '<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="'.curPageURL().'" layout="standard" show_faces="true" width="450"></fb:like>';
}
?>
</div>
<div id="input">
<form action="like.php" method="GET">
What Do You Like?<br />
<textarea id="quoteinput" name="p"></textarea><br />
<input type="submit" width="120" value="I Like It!">
</form>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment