<?
///////////////////////////////////////////////////////////////////////////////////////
// In the name of God //
// This portal is a private portal And it was writen by Mohsen Davari //
// Please do not change it`s copyright //
// I hope that you enjoy using my portal //
// If you have any problem contact me with this email => [email protected] //
// Thank`s a lot //
// Bye //
///////////////////////////////////////////////////////////////////////////////////////
//mysql host name//
$DBHOST = "localhost";
//database username//
$DBUSER = "";
//database password//
$DBPASS = "";
//database name//
$DBNAME = "";
//Connect to mysql//
mysql_connect($DBHOST, $DBUSER, $DBPASS) or die(mysql_error());
//Connect to database//
mysql_select_db($DBNAME) or die(mysql_error());
$getpostid = $_GET['t'];
//get number of post comments//
$mainconnect = mysql_query("SELECT * FROM `comment` where `postid`='{$getpostid}'") or die(mysql_error());
$numberofcomments=mysql_numrows($mainconnect);
print'<div style="width: 692; height: 38">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="100%" height="187">
<tr> <td width="100%" style="border-style: none; border-width: medium" align="center" height="28" colspan="3">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="100%">
<tr>
<td width="100%" style="border-style: none; border-width: medium" colspan="2">
There are ['.$numberofcomments.' ] Commenst For This Posts <hr></td>
</tr>
';
$comments = mysql_query("SELECT * FROM comment where `postid`='{$getpostid}' ORDER BY `id` ASC ") or die(mysql_error());
$num=mysql_numrows($comments);
while ( $row = mysql_fetch_array( $comments )){
//show comments//
print'
<tr>
<td width="16%" style="border-style: none; border-width: medium">
<p align="center">Name</td>
<td width="84%" style="border-style: none; border-width: medium">
'.$row['name'].'</td>
</tr>
<tr>
<td width="16%" style="border-style: none; border-width: medium" align="center">
Email</td>
<td width="84%" style="border-style: none; border-width: medium">
'.$row['email'].'</td>
</tr>
<tr>
<td width="16%" style="border-style: none; border-width: medium" align="center" valign="top">
Message</td>
<td width="84%" style="border-style: none; border-width: medium" valign="top">
'.$row['msg'].'</td>
</tr>
<tr>
<td width="100%" style="border-style: none; border-width: medium" align="center" colspan="2">
--------------------------------------</td>
</tr>
';
}
//show form for send information//
print'
</table>
</td>
</tr>
<tr><form name="ersal" action="" method="post">
<td width="100%" style="border-style: none; border-width: medium" align="center" height="28" colspan="3">
<font color="#FF0000">
';
//send informations to database //
if(isset($_REQUEST['comment'])){
$todayis = date("l j F Y ");
if($_POST['name'] == '' || $_POST['email'] == '' || $_POST['msg'] == '' ){
print'please complete all fields';
}else{
$msg= str_replace ("\n","<br>",$_POST['msg']);
mysql_query("INSERT INTO `comment` ( `postid` ,`name` , `email` , `msg` , `ip`, `date` )
VALUES('{$getpostid}','{$_POST['name']}', '{$_POST['email']}','{$msg}' ,'{$_SERVER['REMOTE_ADDR']}','{$todayis}' ) ") or die(mysql_error());
print'thanks';
}
}
print'
</font></td>
</tr>
<tr>
<td width="34%" style="border-style: none; border-width: medium" align="center" height="28">
Your Name</td>
<td width="33%" style="border-style: none; border-width: medium" height="28">
<input name="name" size="42" class="input" dir="ltr" style="float: right"></td>
<td width="33%" style="border-style: none; border-width: medium" height="28"> </td>
</tr>
<tr>
<td width="34%" style="border-style: none; border-width: medium" align="center" height="28">
Your Email</td>
<td width="33%" style="border-style: none; border-width: medium" height="28">
<input name="email" size="42" class="input" dir="ltr" style="float: right"></td>
<td width="33%" style="border-style: none; border-width: medium" height="28"> </td>
</tr>
<tr>
<td width="34%" style="border-style: none; border-width: medium" align="center" height="98">
Your Message</td>
<td width="33%" style="border-style: none; border-width: medium" dir="rtl" height="98">
<textarea onkeypress="return convert(this,event)" style="float: right; font-weight: normal; font-size: 10px; font-style: normal; font-family: Tahoma; font-variant: normal; color: #000080; background: #FFFFFF" name="msg" rows="8" cols="71" dir="rtl" class="text"></textarea></td>
<td width="33%" style="border-style: none; border-width: medium" height="98"> </td>
</tr>
<tr>
<td width="34%" style="border-style: none; border-width: medium" align="center" height="25"> </td>
<td width="33%" style="border-style: none; border-width: medium" height="25">
<input class="button" type="submit" value="send" name="comment">
<input class="button" type="reset" name="reset"></td>
<td width="33%" style="border-style: none; border-width: medium" height="25"> </td>
</form> </tr>
</table>
</div>
';
?>