<?php
include 'common/functions.php';
function trim_string2($string)
{
$string = (strlen($string) > 12) ? substr($string,0,12).'...' : $string;
return $string;
}
if(isset($_GET['url']) && ($_GET['url']!=""))
{
$url=$_GET['url'];
if(substr($url,0,4) != "http")
$url = "http://" . $url;
if(!valid_url($url) || strpos($url, " "))
{
$error = "Invalid URL";
$url="";
}
else
{
$url=getdomain($url);
}
}
$match = "select * from stats where url='$url'"; 
$qry = mysql_query($match);
$row = mysql_fetch_array($qry);
$worth = $row['worth'];
?>
document.write("<div style='width: 200px; height: 60px; background: url(<?php echo(rootpath()) ?>/images/badge_bg.png) no-repeat;'>");
document.write("<div style='padding: 6px; font: normal 9px Arial, sans-serif; color: #4b4b4b;'><a href='<?php echo(rootpath() . "/" . $url . ".html") ?>' target='_blank' style='color: #4b4b4b; font: normal 9px Arial, sans-serif; text-decoration: underline;'><?php echo(trim_string2($url)) ?></a> &raquo; has estimated worth</div>");
		document.write("<div style='padding:9px 30px 0 0; text-align: center; font: bold 18px Arial, sans-serif; color: #4b4b4b; text-shadow: 1px 1px 1px #ffffff;'>$ <?php echo(number_format($worth)) ?></div>");
		document.write("</div>");