// Script to view the comments submitted from feedback.php.
// Called by view_feedback.php
// PJ Waskiewicz, 9/30/2001
// view_feedback.php
$filename = "/home/waskiewicz.org/www/scripts/view_comments.html";
$mysql_connect_string = "/home/waskiewicz.org/etc/mysql_connect_string";
// Make sure we were called correctly
$date_query = $_GET["query"];
if(($date_query != NULL) || ($date_query != "")) {
// We should be ok.
$date_query = preg_replace("/([A-Za-z]*)_([0-9]...)/", "$1 $2", $date_query);
$fp = fopen($mysql_connect_string, "r");
$username = fgets($fp, 4096);
$password = fgets($fp, 4096);
fclose($fp);
$username = chop($username);
$password = chop($password);
// First open connection to database
$link = mysql_connect("localhost", $username, $password)
or die("Could not connect to MySQL!!");
// Select the database
mysql_select_db("pj_web", $link);
// Now load the page, and regex replace.
$fp = fopen($filename, "r");
$content = fread($fp, filesize($filename));
// Cleaning up the file descriptors...
fclose($fp);
$content = preg_replace("/MONTHDATE/", $date_query, $content);
// Now set up and query the database
$res = mysql_query("SELECT comments,date FROM pj_feedback WHERE date LIKE '% $date_query'") or die("SELECT query on pj_feedback died");
if(mysql_num_rows($res) == 0) {
print "Sorry, but the data you supplied for the query did not return anything. Please go back to the View Feedback section to select a month of comments.\n";
mysql_close($link);
} else {
$comment_content = "";
while($row = mysql_fetch_array($res)) {
$date = $row["date"];
$comment = $row["comments"];
// Construct the content string for this record
$comment = preg_replace("/\n/", "
", $comment);
$comment_content .= "