Sample Blog
1
URL required
';
exit;
}else if (!is_numeric($_GET['id']))
{
echo '
1
Invalid Trackback ID
';
exit;
}else
{
$id = $_GET['id'];
$blogName = mysql_escape_string($_POST['blog_name']);
$title = mysql_escape_string($_POST['title']);
$excerpt = $_POST['excerpt'];
if (strlen($excerpt) > 252)
{
$excerpt = substr($excerpt, 0, 252) . "...";
}
$excerpt = mysql_escape_string($excerpt);
$query = "INSERT INTO 03_simple_blog_trackback
(`blog_id`, `blogName`, `title`, `url`, `excerpt`) VALUES
('$_GET[id]', '$_POST[blog_name]', '$_POST[title]', '$_POST[url]',
'$_POST[excerpt]')";
insertQuery($query);
echo '
0
';
exit;
}
}else if (is_numeric($_GET['entry']))
{
$query = "SELECT * FROM 03_simple_blog WHERE id = '{$_GET['entry']}'";
}else
{
$query = "SELECT * FROM 03_simple_blog ORDER by `id` DESC";
}
$blogEntries = getAssoc($query,2);
foreach($blogEntries AS $entry)
{
$pageURL = "http://example.preinheimer.com/blog/index.php";
echo "\n";
echo "{$entry['category']}\n";
echo "{$entry['post']}
\n";
echo "{$entry['name']}\n";
echo "({$entry['date']})\n
";
echo "Trackback";
echo '';
}
//echo "";
//print_r(parse_url("http://www.preinheimer.com/blog/test/asd"));
//print_r(parse_url("http://www.preinheimer.com/"));
//print_r(parse_url("http://www.preinheimer.com"));
//echo "
";
function checkLinkBack($remoteURL, $localURL)
{
$page = implode('', file($remoteURL));
if (stristr($page, $localURL) != FALSE)
{
return true;
}else
{
return false;
}
}
function checkBadWords($excerpt)
{
$wordList = array('debt', 'poker', 'weight-loss', 'phentermine', 'diet');
foreach($wordList as $word)
{
if (stristr($excerpt, $word) != FALSE)
{
return false;
exit;
}
}
return true;
}
function checkURL($remoteURL)
{
$urlInfo = parse_url($remoteURL);
if (str_len($urlInfo['path'] > 1))
{
return true;
}else
{
return false;
}
}
?>