Location: PHPKode > projects > Sound PHP Engine > s-p-e-0.3.0/s-p-e-0.3.0/comment.php
<?php
// ===================================================== 
// 
// s-p-e - Content management system. 
// Copyright (C) 2004, 2005, 2010, 2011 Vladimir B. Tsarkov
// 
// This file is part of s-p-e. 
// 
// s-p-e 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 3 of the License, or 
// (at your option) any later version. 
// 
// s-p-e 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 s-p-e. If not, see <http://www.gnu.org/licenses/>.
//
// ------
//
//  You can contact me via e-mail: lipetsk-gnu-lug at bk period ru
//
//  comment.php
//
//  Abstract: Implementation of a form to save 
//  	      comments upon the news and articles.
//  
//  Revision History:
// 
//	1  2004-03-27 - 2005-07-02 vbt
//	2  2005-07-19  vbt
//	3  2005-08-03  vbt
//	4  2005-10-30  vbt
//	5  2010-06-11  vbt
//	6  2011-01-22  vbt
// 7  2011-05-14  vbt
// 8	2011-11-04	vbt
//
// =====================================================

if(isset($_GET['id']) && isset($_GET['rid']))
{
	$id = $_GET['id'];
	$rid = $_GET['rid'];
}

if(ctype_digit($id) && ctype_digit($rid))
{
	connect($cfg["host"], $cfg["user"], $cfg["password"], $cfg["database"], $connector);
	$result = mysql_query("select num, theme, date, timer 
		from ".($cfg["prefix"].$pointer)." 
		where num='$rid'", $connector) 
		or die("error #102");
	while($row = mysql_fetch_array($result, MYSQL_NUM))
	{
		echo "<table>
		<tr>
		<td width='5'></td>
		<td>
		<font class='s-normal' id='w-bold'>".$row[1]."</font><br>
		<p>
		<font class='s-normal' id='w-normal'>
		".(_("Published"))."&nbsp;:&nbsp;".$row[2].";&nbsp;".$row[3]."
		</font>
		</p>
		</td>
		<td width='5'></td>
		</tr>
		</table>
		<div align='right'>
		<font class='s-normal' id='w-normal'><a href='#down'>".(_("Comment"))."</a></font>
		</div>
		<div align='center'>";
		line();
		echo "</div><br>";
		$theme = $row[1];
		$rid = $row[0];
	}
	mysql_free_result($result);
	
	$result = mysql_query("select uname, umail, date, timer, comment 
		from ".($cfg["prefix"])."comment 
		where partid='$id' and recid='$rid' 
		order by date desc, timer desc", $connector);
	echo "<div align='center'><font class='s-normal' id='w-normal'>".(_("Number of comments")).":&nbsp;";
	echo mysql_num_rows($result); 
	echo "</font></div>
	<br>
	<div align='center'>";
	line();
	echo "</div><br>";
	while($row = mysql_fetch_array($result, MYSQL_NUM))
	{
		echo "<table><tr><td width='5'></td><td>";
		if($row[1] == false)
		{
			$xmail = $row[0];
		} 
		else 
		{
			$xmail = "<a href='mailto:".$row[1]."'>".$row[0]."</a>";
		}
		echo "<font class='s-normal' id='w-normal'>
		".(_("Author"))."&nbsp;:&nbsp;$xmail<br>".(_("Date"))."&nbsp;:&nbsp;".$row[2]."
		</font>
		<p><font class='s-normal' id='w-normal'>".$row[4]."</font></p>
		</td>
		<td width='5'>
		</td>
		</tr>
		</table>
		<div align='center'>";
		line();
		echo "</div><br>";
	}
	mysql_free_result($result);
	mysql_close($connector);
	
	echo "<a name='down'>
	
	<table>
	<tr>
	<td width='5'></td>
	<td>
	<form action='comsaver.php' method='post'>
	<table>
	<tr>
	<td>
		<font class='s-normal' id='w-bold'>".(_("Your name"))."*:</font>
		&nbsp;
	</td>
	<td>
		<input class='client-text' type='text' name='uname' size='45' maxlength='25'>
	</td>
	</tr>
	<tr>
	<td>
		<font class='s-normal' id='w-bold'>".(_("E-mail")).":&nbsp;</font>
	</td>
	<td>
		<input class='client-text' type='text' name='umail' size='45' maxlength='30'>
	</td>
	</tr>
	<tr>
	<td>
		<font class='s-normal' id='w-bold'>".(_("Comment"))."*:&nbsp;</font>
	</td>
	<td>
		<textarea class='client-text' name='comment' cols=30 rows=8></textarea>
	</td>
	</tr>
	<tr>
		<td></td>
		<td><br>";
		echo "<input type='hidden' name='id' value='$id'>
		<input type='hidden' name='rid' value='$rid'>
		<input type='hidden' name='lng' value='$lng'>
		<input class='simple-button' type='reset' value='".(_("Reset"))."'>
		<input class='simple-button' type='submit' name='send' value='".(_("Save"))."'>
		</td>
	</tr>
	</table>
	</form>
	</td>
	
	</td>
	<td width='5'></td>
	</tr></table>
	<div align='center'></div>";
} 
else 
{
	echo "error #101";
}
?>  
Return current item: Sound PHP Engine