Location: PHPKode > projects > php Blogger > post.php
<?php session_start();
/* * ********************************************************************
*  Copyright notice PHP Blogger 1.1.
*
*  (c) 2011 Predrag Rukavina - admin[at]phpblogger[dot]org
*  All rights reserved
*
*  This script is part of the PHP Blogger project. 
*  The PHP Blogger project is free software; you can redistribute it and/or
*  modify it under the terms of the GNU General Public License
*  as published by the Free Software Foundation; either version 2
*  of the License, or (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
*  MA  02110-1301, USA.
*
*  This copyright notice MUST appear in all copies of the script!
* ********************************************************************** */
##############################
# post.php       version 1.1.#
##############################
include ('settings.php');
include 'libs/pagination.class.php';
$pagination = new pagination;
$id = (int)$_GET['id'];
$arecordSet = &$conn->Execute("SELECT * FROM comment WHERE commid = '".mysql_real_escape_string($id)."' ORDER by commid desc LIMIT 1");
if($arecordSet) {
	if($arecordSet->fields == 0) {
		echo "Sorry, the post you are looking for does not exist.";
		$arecordSet->Close();
		$conn->Close();
		die();
	}
}
if(!$arecordSet)
	print $conn->ErrorMsg();
else
	while(!$arecordSet->EOF) {
		$acval[] = $arecordSet->fields;
		$arecordSet->MoveNext();
	}
$brecordSet = &$conn->Execute("SELECT * FROM reviews  WHERE comrev = '".mysql_real_escape_string($id)."' ORDER by revid desc");
if(!$brecordSet)
	print $conn->ErrorMsg();
else
	while(!$brecordSet->EOF) {
		$bcval[] = $brecordSet->fields;
		$brecordSet->MoveNext();
	}
if(@$_SESSION["view"] == $id.$_SERVER['SERVER_NAME']) {
} else {
$conn->Execute("UPDATE comment SET views = views + '".mysql_real_escape_string(1)."' WHERE commid = '".mysql_real_escape_string($id)."' ");
	$_SESSION["view"] = $id.$_SERVER['SERVER_NAME'];
}
/**
 * intergrate()
 * 
 * @param mixed $comment
 * @return
 */
if($rewritemod == 2){
function intergrate($comment) {
        $comment = preg_replace("#(([a-zA-Z]+://)([a-zA-Z0-9?&%.;:/=\-_+\#]*))#e","'<a href=\"$1\" target=\"_blank\">$0</a>'",$comment);
	$comment = preg_replace("/@([A-Za-z0-9_]+)/","<a href='$1'>$0</a> ",$comment).'';
return $comment;
}
}
if($rewritemod == 1){
function intergrate($comment) {
        $comment = preg_replace("#(([a-zA-Z]+://)([a-zA-Z0-9?&%.;:/=\-_+\#]*))#e","'<a href=\"$1\" target=\"_blank\">$0</a>'",$comment);
	$comment = preg_replace("/@([A-Za-z0-9_]+)/","<a href='profile.php?cid=$1'>$0</a> ",$comment).'';
return $comment;
}
}
$smarty->caching = 0;
$iconfig['date'] = '%I:%M %p';
$iconfig['time'] = '%H:%M:%S';
$smarty->assign('iconfig',$iconfig);
$smarty->assign('today',strtotime('+ 1 hours'));
$smarty->assign('comment',$acval);
@$dataPages = $pagination->generate($bcval,12);
$smarty->assign('increv',$dataPages);
$smarty->assign('pagination',$pagination->links());
$smarty->display('post.php');
$smarty->display('footer.php');
$recordSet->Close();
$arecordSet->Close();
$brecordSet->Close();
$conn->Close();
?>
Return current item: php Blogger