65 lines
2.3 KiB
PHP
65 lines
2.3 KiB
PHP
<?php
|
|
|
|
/* $Id: admin_viewreports.php 8 2009-01-11 06:02:53Z john $ */
|
|
|
|
$page = "admin_general1";
|
|
include "../admin/admin_header.php";
|
|
|
|
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }
|
|
|
|
|
|
// DELETE SINGLE REPORT
|
|
if($task == "delete") {
|
|
|
|
$database->database_query("DELETE FROM contactemails WHERE id='".mysql_real_escape_string($_GET["delete"])."'");
|
|
/*if($database->database_num_rows($report_query) != 0) {
|
|
$database->database_query("DELETE FROM se_reports WHERE report_id='$report_id'");
|
|
}*/
|
|
}
|
|
|
|
|
|
|
|
function general()
|
|
{?><table><tr><td><strong>Subject</strong></td><td><strong>Message</strong></td><td>Email</td><td><strong>Actions</strong></td></tr><?
|
|
$reports_query = "SELECT * FROM contactemails ORDER BY id DESC";
|
|
$query=mysql_query($reports_query) or die(mysql_error());
|
|
while($row=mysql_fetch_array($query))
|
|
{
|
|
?><tr><td valign="top"><?=$row["subject"]?></td><td valign="top"><?=$row["message"]?><br>
|
|
<br>
|
|
<strong>Name:</strong> <?=$row["name"]?><br /><br />
|
|
<strong>Username:</strong> <?=$row["username"]?><br /><br />
|
|
<strong>IP Address:</strong> <?=$row["ip"]?><br><br>
|
|
<strong>Relevant info:</strong> <?=$row["info"]?>
|
|
</td>
|
|
<td valign="top"><?php echo $row["email"];?></td>
|
|
|
|
<td valign="top"><a href="mailto:<?=$row["email"]?>?subject=RE: <?=$row["subject"]?>&body=<?=$row["message"]?>">Reply</a> | <a href="../admin/contact.php?delete=<?=$row["id"]?>&task=delete">Delete</a></tr>
|
|
<?
|
|
}?></table><?
|
|
}
|
|
// CONSTRUCT QUERY USING FILTERS
|
|
|
|
|
|
if($f_object != "") { $where_clause[] = "se_reports.report_object='$f_object'"; }
|
|
if($f_reason != "") { $where_clause[] = "se_reports.report_reason='$f_reason'"; }
|
|
if($f_details != "") { $where_clause[] = " se_reports.report_details LIKE '%$f_details%'"; }
|
|
if(count($where_clause) != 0) { $reports_query .= " WHERE ".implode(" AND ", $where_clause); }
|
|
|
|
|
|
|
|
|
|
|
|
// ASSIGN VARIABLES AND SHOW VIEW REPORTS PAGE
|
|
$smarty->assign('total_reports', $total_reports);
|
|
$smarty->assign('pages', $page_array);
|
|
$smarty->assign('reports', $report_array);
|
|
$smarty->assign('i', $i);
|
|
$smarty->assign('u', $u);
|
|
$smarty->assign('p', $page_vars[1]);
|
|
$smarty->assign('s', $s);
|
|
$smarty->assign('f_object', $f_object);
|
|
$smarty->assign('f_reason', $f_reason);
|
|
$smarty->assign('f_details', $f_details);
|
|
include "../admin/admin_footer.php";
|
|
?>
|