Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/uprtou2/
Upload File :
Current File : /var/www/html/mmishra/mm/uprtou2/feedback.php

<?php
$rowid = $_REQUEST["rowid"];
$message = htmlsafe(strip_tags($_POST["message"]));
$sender = htmlsafe($_POST["sender"]);
$email = htmlsafe($_POST["email"]);
//$reply = htmlsafe($_POST["reply"]);
$reply = $_POST["reply"];
$submit = $_POST["submit"];

$tbl = "feedbacks";

echo "
<dir>Your feedback/suggestion is important for us to improve upon the services of your need.
Please submit complete information with your valrowid email to receive response from us. Thanks.
<p>";

//if query sent
if ($submit == 'SEND' && $message && $sender) {
	if (checkAbuser($message, $sender, $email, $remoteip) == TRUE) {
                echo "<b>You are blocked under abusers category</b>";
	} else {//} else if (checkEmail($email)) {
		mysql_query("insert into $tbl(webid,message,sender,email,remoteip,status,datecreation,datesubmission) 
		values('$webid','$message','$sender','$email','$remoteip','offline',now(),curdate())");
                $rowid = mysql_insert_id();
	}
//if reply sent
} else if ($submit == 'SAVE') {
        mysql_query("update $tbl set reply='$reply',status='online' where rowid=$rowid");
        //check for email address to send reply
	/*
	$rs = mysql_query("select * from $tbl where rowid=$rowid");
	while ($o = mysql_fetch_object($rs)) {
		$message = $o->message;
		$email = $o->email;
	}
        if ($email && $_POST["sendemail"] == 1) {
		$reply = "
Your query:
	$message 

Our reply:
	$reply

Webmaster, $webid"; 
		sendmail($email, "Thanks for your feedback", strip_tags($reply)); 
	}
	*/
} else if ($submit == "DELETE") {
    	mysql_query("delete from $tbl where rowid=$rowid");
}

if ($rowid == '0') {
	echo "<table class=normal wrowidth='90%'>
  	<tr><td nowrap>Full Name<br>
	<input type='text' name='sender' value='".$sender."' size='50'></td></tr>
  	<tr><td nowrap>Valid Email<br>
	<input type='text' name='email' value='".$email."' size='50'></td></tr>
  	<tr valign='top'><td>Query/feedback/suggestion (in 500 words)<br>
	<textarea name='message' rows='5' cols='40'>".$message."</textarea></td></tr>
  	<tr><td><input type='submit' name='submit' value='SEND'><br>
	Query/Feedback with <u>fake email</u> address will be rejected.</td></tr>
	</table><br>";
} else {
  	echo "[ <a href='$PHP_SELF?conf=$conf&rowid=0'>New query/feedback</a> ]";
}

$rs = mysql_query("select SQL_CALC_FOUND_ROWS * from $tbl where webid='$webid' and status='offline'");
$tro = mysql_fetch_object(mysql_query("select FOUND_ROWS() as t"));
$pending = $tro->t;

$rs = mysql_query("select SQL_CALC_FOUND_ROWS * from $tbl where webid='$webid' and status='online'");
$tro = mysql_fetch_object(mysql_query("select FOUND_ROWS() as t"));
$total = $tro->t;

echo "<p><b>Posted Query/Feedback</b> (Online: $total";
if ($pending > 0) echo " / <a href='$PHP_SELF?conf=$conf&pending=1'>Offline: $pending</a>";
echo ") Pages: ";

$pno = $_REQUEST["pno"];
if (!$pno) $pno = 1;
$pgsize = 10;
$start = (($pno - 1) * $pgsize);
if ($start >= $total) $pno--;

if ($total > $pgsize) {
        $firstpno = max (1, ceil($start/$pgsize) - 2);
        $lastpno = $firstpno + 9;
        if (ceil($total/$pgsize) > $pgsize && $lastpno >= ceil($total/$pgsize)) $firstpno = ceil($total/$pgsize) - 10;
        for($i = $firstpno; $i <= min($lastpno, ceil($total/$pgsize)); $i++) {
                if ($i == $pno) echo "<b>$i</b>&nbsp;";
                else echo "<a href='$PHP_SELF?conf=$conf&pno=$i'>$i</a>&nbsp;";
        }
} else echo "1";

$i = 0;
if ($_REQUEST["pending"]) {
	$rs = mysql_query("select SQL_CALC_FOUND_ROWS * from $tbl where webid='$webid' and status='offline' order by datecreation desc,rowid");
	$p = 1;
} else {
	//$rs = mysql_query("select * from $tbl where webid='$webid' and status='confirmed' and reply<>'' order by datecreation desc,rowid LIMIT $start,10");
	$rs = mysql_query("select * from $tbl where webid='$webid' and status='online' order by datecreation desc,rowid LIMIT $start,$pgsize");
	$p = 0;
}

echo "</p><ul>";
while($o = mysql_fetch_object($rs)) {
       	$start++;
	echo "<li><a name='$o->rowid'>$o->rowid</a>) $o->message
       	<div class='datetime'>By $o->sender ($o->remoteip, dated: $o->datecreation)</div>
       	<b>Reply:</b><dir>";
       	if ($role == 'admin') {
               	if ($rowid == $o->rowid) {
                       	echo "<textarea name='reply' rows='5' cols='60'>$o->reply</textarea>
                       	<input type='hidden' name='rowid' value='$o->rowid'> <input type='hidden' name='pending' value='$p'><br>";
			if ($o->email)
				echo "<input type='checkbox' name='sendemail' value='1'> Send reply to &lt;$o->email&gt;<br>";
                       	echo "<input type='submit' name='submit' value='SAVE' style='width: 80px'>&nbsp;
                       	<input type='submit' name='submit' value='DELETE' style='width: 80px'>&nbsp;";
               	} else {
			if ($o->reply) {
				echo "<div>$o->reply</div> [ <a href='$PHP_SELF?conf=$conf&rowid=$o->rowid&pending=$p&pno=$pno#$o->rowid'>Edit</a> ]";
               		} else {
                       		echo "Awaited [ <a href='$PHP_SELF?conf=$conf&pending=$p&rowid=$o->rowid&pno=$pno#$o->rowid'>Reply</a> ]";
               		}
		}
       	} else if ($o->reply) 
		echo $o->reply.' '; 
	else 
		echo "<span>Awaited</span> ";
       	echo "</dir><br></li>";
}
echo "</ul></p>";

?>