You missed to fill some required fields. Please click back in your browser.'; $flag=1; } else { //add comment mysql_connect("localhost",$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $time=time(); $query = "INSERT INTO comments VALUES ('','blog','$comment','$id','$nick','$ipadd','$time','0')"; if(@mysql_query($query)) echo 'Your comment has been received. It will be displayed on this post once it has been approved. Thankyou.'; else echo 'Some problem with database. Please try again. Thanks for cooperating.'; mysql_close(); } } else { echo "Wrong security code entered. Please try again."; $flag=1; } } ?>
Visitors\' blog';
if($page) echo " Page $page";
echo '';
//get 10 blog posts details
include('cms/dbcondet.php');
mysql_connect("localhost",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
if($_GET['tag'])
{
$tag1=$_GET['tag'];
$tag1=str_replace(" ", "+", $tag1);
$tag=" and tags like '%$tag1%'";
}
else
$tag='';
//calculating total no of approved posts
$query="SELECT id FROM posts WHERE approved='1'$tag";
$result=mysql_query($query);
$count=mysql_numrows($result);
$query="SELECT * FROM posts WHERE approved='1'$tag ORDER BY time DESC limit " . $limitstart . ",10";
$result=mysql_query($query);
$num=mysql_numrows($result);
if($count==0)
{
echo 'Currently no blog post exists on this page. ADD BLOG POST.';
}
else
{
for($i=0; $i<$num; $i++)
{
//display each blog post
$id=mysql_result($result,$i,"id");
$nick=mysql_result($result,$i,"nick");
$time=mysql_result($result,$i,"time");
$topic=mysql_result($result,$i,"topic");
$post=mysql_result($result,$i,"post");
$tags=mysql_result($result,$i,"tags");
$time=date("F j, Y, g:i a", $time);
echo "$topic"; echo "Posted by $nick on $time "; $post=str_replace("\n", "", $post); echo " $post "; echo "Tagged Under: $topic"; echo "Posted by $nick on $time "; $post=str_replace("\n", "", $post); echo " $post "; echo "Tagged Under: VISITOR COMMENTS on \"$topic\": "; mysql_connect("localhost",$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT comment, nick, time FROM comments where pageid='$id' and type='blog' and approved='1'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); if($num==0) { echo ' ';
}
else
{
for($i=0;$i<$num;$i++)
{
$comment=mysql_result($result,$i,"comment");
$nick=mysql_result($result,$i,"nick");
$timestamp=mysql_result($result,$i,"time");
$comment=str_replace("\n", "", $comment); $time=date("jS F y", $timestamp); echo << $nick said, |
$time $comment |
| |||
Tags
$value)
{
echo "$value
";
}
}
?>