<?php
include("head.php");
?>
<p id="send"><a href="send.php">I WANT YO YELL !</a></p>
<?php
if(!is_numeric($_GET['id'])){
$sqlyell = "SELECT * FROM iyell WHERE id = (select MAX(id) FROM iyell);";
$comment = false;
}else{
$sqlyell = "SELECT * FROM iyell WHERE id = ". mysql_real_escape_string($_GET['id']) .";";
$comment = true;
}
$req = mysql_query($sqlyell);
if($yell = @mysql_fetch_array($req)){
$text = htmlentities($yell["text"],ENT_QUOTES,"UTF-8");
$author = htmlentities($yell["author"],ENT_QUOTES,"UTF-8");
$link = htmlentities($yell["link"],ENT_QUOTES,"UTF-8");
$id = $yell["id"];
if(strtolower(substr($link,-3)) == "jpg" || strtolower(substr($link,-3)) == "png" || strtolower(substr($link,-3)) == "gif" || strtolower(substr($link,-3)) == "bmp"){
$linktype = "img";
}else{
$linktype = "a";
}
if(substr($link,0,7) != "mailto:" && substr($link,0,7) != "http://" && substr($link,0,8) != "https://" && substr($link,0,6) != "ftp://" && $link != ""){
$link = "http://" . $link;
}
if($link == ""){
$link = $url.$id;
}
}else{
echo("Unknowed yell");
include("foot.php");
die();
}
echo("<div id='yell' onclick=\"document.location.href='send.php';\">");
if($linktype == "img"){
echo("<img src=\"". $link ."\" alt=\"". $text ."\">");
}
if($text == ""){
echo("Nothing to say");
}else{
echo($text);
}
if($linktype == "img"){
echo("<p style='clear: both;'></p>");
}
echo("</div>");
echo("<div id='author'>");
?><div class="fb-like" data-href="<?php echo($url.$id); ?>" data-send="true" data-layout="button_count" data-width="150" data-show-faces="false"></div> <?php
echo("<a href=\"". $link ."\" target=\"_blank\">".$author."");
if($link != $url.$id){
echo(" ". $link);
}
echo("</a> | ");
if(!$comment){
echo("<a href='/".$id."'>Comment this yell</a> | ");
}
echo("<a href=\"contact.php?id=". $id ."\">Report abuse</a></div>");
if($comment){
echo("<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = \"//connect.facebook.net/en_US/all.js#xfbml=1\";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class=\"fb-comments\" data-href=\"". $url.$id ."\" data-num-posts=\"2\" data-width=\"500\"></div>");
}
?>
<p id="pages"><a href="last.php">Older yells</a></p>
<?php
include("foot.php");
?>