So I decided to start coding up a player report, one which is more advance, some features it will include can be found below, currently I don't know when it will be finished however I will keep you updated on what I have completed, you will find that below too. :)
Currently I have coded the main page & the ability to file new reports you will find images about that underneath as well. So the image links you see are action for staff. Also I personally like to be able to keep things on one page, so the staff features are on the one file, not in staff panel.
Staff features:
Modify/Respond to report
Delete Report
Report's Archive
Report Filter
Currently coded things (Main)/Fixed things (Secondary)/Misc additions (Side/Requested Features)
Main page (Main)
File a Report (Main)
Time Stamp (Side/Requested Features)
Case Urgencies (Side/Requested Features)
Best Features:
Controllable in one single page
Filter through tasks - Find cases easily if you have a pile of them
Task Archive- closed or dismissed cases get archived so you always have previous records that are easily obtainable
Ease of use - very easy to use! :p
Feel free to give me advice, or things you would like to see, I will gladly try and implement any ideas in - if I can. :)
Some images of current progress, will try and update as I go along.
So I decided to start coding up a player report, one which is more advance, some features it will include can be found below, currently I don't know when it will be finished however I will keep you updated on what I have completed, you will find that below too. :)
Currently I have coded the main page & the ability to file new reports you will find images about that underneath as well. So the image links you see are action for staff. Also I personally like to be able to keep things on one page, so the staff features are on the one file, not in staff panel.
Staff features:
Modify/Respond to report
Delete Report
Report's Archive
Report Filter
Currently coded things (Main)/Fixed things (Secondary)/Misc additions (Side/Requested Features)
Main page (Main)
File a Report (Main)
Time Stamp (Side/Requested Features)
Case Urgencies (Side/Requested Features)
Delete Page (Main)
Corresponding Link to ID (Side/Requested Features)
Modify case (Main)
Respond to case (Main)
Cases archive (Main)
Best Features:
Controllable in one single page
Filter through tasks - Find cases easily if you have a pile of them
Task Archive- closed or dismissed cases get archived so you always have previous records that are easily obtainable
Ease of use - very easy to use! :p
Feel free to give me advice, or things you would like to see, I will gladly try and implement any ideas in - if I can. :)
Some images of current progress, will try and update as I go along.
Main Page
[ATTACH=CONFIG]1035[/ATTACH]
Create Report
[ATTACH=CONFIG]1027[/ATTACH]
Delete Report - Picks out all the details of that single case and show's it, so you can review it one last time if you wish to delete.
[ATTACH=CONFIG]1036[/ATTACH]
*Updates*
03/07/2013
CSS Changes (Side/Requested Features)
PHP ID's automated and links moved (Side/Requested Features) - will explain tomorrow with images, tired lol long day. :)
PHP ID's automated explantion - So before you would have had to write the ID of the case you want to delete through a form, but now you don't as it's automated to make life easier. :)
04/07/2013
Added Updated Image (Side/Requested Features)
Created Delete Feature (Main)
06/07/2013
Created ability to modify case (Main)
Created ability to respond to case (Main)
Created ability to go through cases archive (Main)
*Deadline Information*
06/07/2013 or 07/07/2013
*Mod Creation Complete - Code will be added (later on today) after some checks.*
Special thanks to:
Kyle Mass - Helping me on countless occasions, no matter how much explaining he had to do. Showed me loads of examples of code, to help me.
Nick - Was able to create this feature (PHP ID's automated) with the help of Nick here, a great teacher.
Ian - No matter how busy, always would help me with code.
Dom - Helped with tutorial links, where I could find out useful things.
DJK - Stayed awake till three last night with me, reviewing my code. Taught me how to secure bits of my code. Or has he put it " just taught you a few functions and their uses/downsides." :p
I appreciate all the help you all have given me, and if not for your help, my code would most likely suck loads! :p Thanks loads fellas. If I've missed you, give me a shout!
pReport.php
<html>
<head>
<title>Player Report</title>
</head>
<style>
table {
border-collapse:collapse;
background-color: #EDEDED;
width:95%;
}
th {
background-color: #E8E8E8;
height:50px;
}
</style>
</html>
<?php
include 'globals.php';
/*
* Designed and developed by Script47 & Ramzy <----- lol xD
* The code here (named "pReport") is provided "as is" with no warranty or gurantee of safety to existing code.
* pReport has been fully tested and is found to work as intended.
* pReport is released freely under the GNU License. Feel free to modify as you wish, as long as this comment block remains atuynd remains untouched.
*/
$_GET['action'] = isset($_GET['action']) && ctype_alnum($_GET['action']) ? trim($_GET['action']) : null;
switch ($_GET['action']) {
case "newReport":
newReport();
break;
case "newReportGo":
newReportGo();
break;
case "modifyReport":
modifyReport();
break;
case "modifyReportDo":
modifyReportDo();
break;
case "respondReportDo":
respondReportDo();
break;
case "deleteReport":
deleteReport();
break;
case "deleteReportDo":
deleteReportDo();
break;
case "casesArchive":
casesArchive();
break;
case "searchFilter":
searchFilter();
break;
case "searchFilterGo":
searchFilterGo();
break;
default:
index();
break;
}
function index() {
global $db, $ir;
echo '<h3>Player Reports</h3>';
echo '<a href="index.php">Home</a><br/>';
echo '<br/>';
if ($ir['user_level'] >1) {
echo ' · <a href="pReport.php?action=casesArchive"> <img src="images/archive.png " title="Cases Archive" /></a> · <a href="pReport.php?action=searchFilter"> <img src="images/filter.png " title="Case Filter"/></a> ·';
// Colour codes in array.
$caseStatusColours = array(
0 => "<span style='color:#AF4035;' value='0'>Queued</span>",
1 => "<span style='color:#FFCC66;' value='1'>Pending</span>",
2 => "<span style='color:#79A888;' value='3'>Closed</span>",
3 => "<span style='color:#A9A9A9;' value='4'>Case Dismissed</span>",
);
$caseUrgencyColours = array(
0 => "<span style='color:#AF4035;' value='0'>Low</span>",
1 => "<span style='color:#FFCC66;' value='1'>Medium</span>",
2 => "<span style='color:#FF9933;' value='2'>High</span>",
3 => "<span style='color:#FF704D;' value='3'>Urgent</span>"
);
// Table headings.
$showCurrentCases = $db->query("SELECT * FROM `preports`");
echo '<center><table border="1">';
echo '<tr>';
echo '<th><br/>Basic Task Info</th>';
echo '<th><br/>Other Details</th>';
echo '<th><br/>Misc</th>';
echo '<th><br/>Actions</th>';
while ($row = $db->fetch_row($showCurrentCases)) {
// Print out the contents of each row into a table.
echo "<tr><td>";
echo '<b>Case ID:</b> ', htmlentities($row['prID']), '<br/>', ' <b>Case Name:</b> ', htmlentities($row['prName']), '<br/>', ' <b>Date/Time Reported:</b> ', htmlentities(date('d/m/y g:i A',strtotime($row['prDateTime']))), '<br/>', '<b>Case Desc:</b> ', htmlentities($row['prDesc']);
echo "</td><td>";
echo '<b>Staff Over Seeing Case:</b> ', htmlentities($row['prStaffOverSeeingCase']), '<br/>', '<b>Reporter:</b> ', htmlentities($row['prReporter']), '<br/>', '<b>Offender:</b> ', htmlentities($row['prOffender']);
echo "</td>";
echo '<td> <b>Case Status:</b> ', $caseStatusColours[$row['prStatus']], '<br/>', '<b>Case Urgency:</b> ', $caseUrgencyColours[$row['prUrgency']], '<br/>';
echo "<td>· <a href='pReport.php?action=modifyReport&prID={$row['prID']}'> <img src='images/modify.png' title='Modify/Respond to a Case' /></a>· <br/>·<a href='pReport.php?action=deleteReport&prID={$row['prID']}'> <img src='images/delete.png' title='Delete a Case' /></a> ·</td></tr>";
}
echo "</table></center>";
} else {
echo '<br/>';
echo 'Know of a player breaking the rules? Report them here, all reports are kept anonymous if requested.<br/>';
echo '<br/> · <a href="pReport.php?action=newReport"> <img src="images/add.png" title="Report a Player"/></a> ·';
}
}
function newReport() {
echo '<title>Create Report</title>';
echo '<h3>Report a Player</h3>';
echo '<a href="preport.php">Back</a><br/>';
echo 'Report any players who have been offensive, racist, or have scammed you.<br/>';
echo 'Remember, reporting a player is not a joke. If you are found filing a false report, you <b>will</b> be banned!<br/>';
echo '<br/>';
echo "<form action='pReport.php?action=newReportGo' method='post'>
<input type='text' name='prName' value='Case Name'><br/>
<input type='text' name='prReporter' value='Reporter'><br/>
<input type='text' name='prOffender' value='Offender'><br/>
<textarea rows='8' cols='35' name='prDesc'>
Case Description, so what exactly happened, when, specific date if possible to help the us speed up the process. Any other information if possible.</textarea>
<br/>Case Urgency: <select name='prUrgency'>
<option value='0' selected>Low</option>
<option value='1'>Medium</option>
<option value='2'>High</option>
<option value='3'>Urgent</option>
</select>
<br/><input type='submit' value='Submit Report'>
</form>";
}
function newReportGo() {
echo '<title>Create Report</title>';
global $db, $caseStatusColours, $caseUrgencyColours;
if (empty($_POST['prName']) || empty($_POST['prReporter']) || empty($_POST['prOffender']) || empty($_POST['prDesc']) || empty($_POST['prUrgency']) ) {
echo '<br/>One or more of the required fields are empty please go back and try again.';
$h->endpage();
exit();
}
if (!array_key_exists($_POST['prStatus'], $caseStatusColours) || (!array_key_exists($_POST['prUrgency'], $caseUrgencyColours))) {
echo "That value doesn't exist!";
$h->endpage();
exit();
}
$prName = $db->escape(htmlentities($_POST['prName']));
$prReporter = $db->escape(htmlentities($_POST['prReporter']));
$prOffender = $db->escape(htmlentities($_POST['prOffender']));
$prDesc = $db->escape(htmlentities($_POST['prDesc']));
$prUrgency = $_POST['prUrgency'];
$db->query("INSERT INTO `preports` (prName, prReporter, prOffender, prDesc, prUrgency) VALUES ('$prName', '$prReporter', '$prOffender', '$prDesc', '$prUrgency')");
if (!$db) {
echo "Query Error: Line 196.";
$h->endpage();
exit();
} else {
echo 'Report processed, please be patient while we look in to it.<br/>';
echo '<a href="index.php">Home</a>';
}
}
function modifyReport() {
global $ir;
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
echo '<h3>Modify/Respond to a case</h3>';
echo '<a href="pReport.php">Back</a><br/>';
echo '<h4>Respond to a case</h4>';
echo '<form action="pReport.php?action=respondReportDo" method="post">
<input type="num" name="prID" value="ID of case you want to modify"><br/>
<input type="text" name="prStaffOverSeeingCase" value="Staff Over Seeing Case"><br/>
Case Urgency: <select name="prUrgency">
<option value="0" selected>Low</option>
<option value="1">Medium</option>
<option value="2">High</option>
<option value="3">Urgent</option>
</select>
<br/><input name="Respond" type="submit" value="Respond to case">
</form>';
echo '<h4>Modify a case</h4>';
echo "<form action='pReport.php?action=modifyReportDo' method='post'>
<input type='num' name='prID' value='ID of case you want to modify'><br/>
<input type='text' name='prStaffOverSeeingCase' value='Staff Over Seeing Case'><br/>
Case Status: <select name='prStatus'>
<option value='0' selected>Queued</option>
<option value='1'>Pending</option>
<option value='2'>Closed</option>
<option value='3'>Case Dismissed</option>
</select>
<br/>
Case Urgency: <select name='prUrgency'>
<option value='0' selected>Low</option>
<option value='1'>Medium</option>
<option value='2'>High</option>
<option value='3'>Urgent</option>
</select>
<br/><input type='submit' value='Edit a case'>
</form>";
}
function respondReportDo() {
echo '<title>Respond to Report</title>';
global $db, $ir, $caseUrgencyColours;
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
if (!isset($_POST['prID']) || !isset($_POST['prStaffOverSeeingCase']) || (empty($_POST['prID']) || empty($_POST['prStaffOverSeeingCase']))) {
echo '<br/>One or more of the required fields are empty please go back and try again.';
$h->endpage();
exit();
}
if (!ctype_digit($_POST['prID'])) {
echo '<br/>prID refers to a numerical value correspoding to the case ID, please go back and try again.';
$h->endpage();
exit();
}
if (!array_key_exists($_POST['prUrgency'], $caseUrgencyColours)) {
echo "That value doesn't exist!";
$h->endpage();
exit();
}
$prID = abs(intval($_POST['prID']));
$prStaffOverSeeingCase = $db->escape(htmlentities($_POST['prStaffOverSeeingCase']));
$prUrgency = abs(intval($_POST['prUrgency']));
echo '<h3>Respond to a Report</h3>';
echo '<a href="pReport.php">Back</a><br/>';
echo '<br/>';
$db->query("UPDATE `preports` SET prStaffOverSeeingCase='{$prStaffOverSeeingCase}', prUrgency='{$prUrgency}' WHERE prID='{$prID}'");
if (!$db) {
echo "Query Error: Line 301.";
$h->endpage();
exit();
} else {
echo 'Successfully responded to case..<br/>';
echo '<a href="pReport.php">Back</a>';
}
}
function modifyReportDo() {
echo '<title>Modify Report</title>';
global $db, $ir, $caseStatusColours, $caseUrgencyColours;
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
if (!isset($_POST['prID']) || !isset($_POST['prStaffOverSeeingCase']) || (empty($_POST['prID']) || empty($_POST['prStaffOverSeeingCase']))) {
echo '<br/>One or more of the required fields are empty please go back and try again.';
$h->endpage();
exit();
}
if (!ctype_digit($_POST['prID'])) {
echo '<br/>prID refers to a numerical value correspoding to the case ID, please go back and try again.';
$h->endpage();
exit();
}
if (!array_key_exists($_POST['prStatus'], $caseStatusColours) || (!array_key_exists($_POST['prUrgency'], $caseUrgencyColours))) {
echo "That value doesn't exist!";
$h->endpage();
exit();
}
$prID = abs(intval($_POST['prID']));
$prStaffOverSeeingCase = $db->escape(htmlentities($_POST['prStaffOverSeeingCase']));
$prStatus = abs(intval($_POST['prStatus']));
$prUrgency = abs(intval($_POST['prUrgency']));
echo '<h3>Modify a Report</h3>';
echo '<a href="pReport.php">Back</a><br/>';
echo '<br/>';
$db->query("UPDATE `preports` SET prStaffOverSeeingCase='{$prStaffOverSeeingCase}', prStatus='{$prStatus}', prUrgency='{$prUrgency}' WHERE prID='{$prID}'");
if (!$db) {
echo "Query Error: Line 359.";
$h->endpage();
exit();
} else {
echo 'Case modified.<br/>';
echo '<a href="pReport.php">Back</a>';
}
}
function deleteReport() {
echo '<title>Delete Report</title>';
global $db, $ir, $caseStatusColours, $caseUrgencyColours;
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
echo '<h3>Delete a report</h3>';
echo '<a href="pReport.php">Back</a><br/>';
echo '<br/>';
$_GET['prID'] = abs((int) $_GET['prID']);
$prID = ($db->query("SELECT * FROM `preports` WHERE prID={$_GET['prID']}"));
echo "Are you sure you want to <b>delete</b> this case? Remember once it's gone you can't get it back.";
echo '<center><table border="1">';
echo '<tr>';
echo '<th><br/>Basic Task Info</th>';
echo '<th><br/>Other Details</th>';
echo '<th><br/>Misc</th>';
echo '<th><br/>Actions</th>';
while ($row = $db->fetch_row($prID)) {
// Print out the contents of each row into a table.
echo "<tr><td>";
echo '<b>Case ID:</b> ', htmlentities($row['prID']), '<br/>', ' <b>Case Name:</b> ', htmlentities($row['prName']), '<br/>', ' <b>Date/Time Reported:</b> ', htmlentities(date('d/m/y g:i A',strtotime($row['prDateTime']))), '<br/>', '<b>Case Desc:</b> ', htmlentities($row['prDesc']);
echo "</td><td>";
echo '<b>Staff Over Seeing Case:</b> ', htmlentities($row['prStaffOverSeeingCase']), '<br/>', '<b>Reporter:</b> ', htmlentities($row['prReporter']), '<br/>', '<b>Offender:</b> ', htmlentities($row['prOffender']);
echo "</td>";
echo '<td> <b>Case Status:</b> ', $caseStatusColours[$row['prStatus']], '<br/>', '<b>Case Urgency:</b> ', $caseUrgencyColours[$row['prUrgency']], '<br/></td>';
echo "<td><br/>· <a href='pReport.php?action=deleteReportDo&prID={$row['prID']}'>Yes</a> · <br/> · <a href='pReport.php'>No</a> ·</td></tr>";
}
echo "</table></center>";
}
function deleteReportDo() {
echo '<title>Delete Report</title>';
global $db, $ir;
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
$_GET['prID'] = abs((int) $_GET['prID']);
$prID = $db->fetch_row($db->query("SELECT * FROM `preports` WHERE prID={$_GET['prID']}"));
$db->query("DELETE FROM `preports` WHERE prID={$_GET['prID']} ");
if (!$db) {
exit('Query Error: Line 434.');
$h->endpage();
} else {
echo 'Case deleted.';
echo '<br/><a href="pReport.php">Home</a>';
}
}
function casesArchive() {
global $db, $ir, $caseStatusColours, $caseUrgencyColours;
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
echo '<h3>Case Archive</h3>';
echo '<a href="pReport.php">Back</a><br/>';
$showArchivedCases = $db->query("SELECT * FROM `preports` WHERE prStatus='3' OR prStatus='2' ORDER BY prStatus ASC");
echo '<br/>';
echo '<br/>';
echo '<center><table border="1">';
echo '<tr>';
echo '<th><br/>Basic Task Info</th>';
echo '<th><br/>Other Details</th>';
echo '<th><br/>Misc</th>';
while ($row = $db->fetch_row($showArchivedCases)) {
// Print out the contents of each row into a table.
echo "<tr><td>";
echo '<b>Case ID:</b> ', htmlentities($row['prID']), '<br/>', ' <b>Case Name:</b> ', htmlentities($row['prName']), '<br/>', ' <b>Date/Time Reported:</b> ', htmlentities(date('d/m/y g:i A',strtotime($row['prDateTime']))), '<br/>', '<b>Case Desc:</b> ', htmlentities($row['prDesc']);
echo "</td><td>";
echo '<b>Staff Over Seeing Case:</b> ', htmlentities($row['prStaffOverSeeingCase']), '<br/>', '<b>Reporter:</b> ', htmlentities($row['prReporter']), '<br/>', '<b>Offender:</b> ', htmlentities($row['prOffender']);
echo "</td>";
echo '<td> <b>Case Status:</b> ', $caseStatusColours[$row['prStatus']], '<br/>', '<b>Case Urgency:</b> ', $caseUrgencyColours[$row['prUrgency']], '<br/></td></td>';
}
echo "</table></center>";
}
function searchFilter() {
echo '<title>Search Filter</title>';
global $ir;
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
echo '<h3>Search Filter</h3>';
echo '<a href="pReport.php">Back</a><br/>';
echo "<br/><form action='pReport.php?action=searchFilterGo' method='post'>
<input name='prID' maxlength='3' value='ID of the case'>
<br/>Case Status: <select name='prStatus'>
<option value='0' selected>Queued</option>
<option value='1'>Pending</option>
<option value='2'>Closed</option>
<option value='3'>Case Dismissed</option>
</select>
<br/>
Case Urgency: <select name='prUrgency'>
<option value='0' selected>Low</option>
<option value='1'>Medium</option>
<option value='2'>High</option>
<option value='3'>Urgent</option>
</select>
<br/><input type='submit' value='Filter'>
</form>";
}
function searchFilterGo() {
global $db, $ir, $caseStatusColours, $caseUrgencyColours;
echo '<title>Search Filter</title>';
if ($ir['user_level'] !=2) {
echo '<br/>Restricted area, please go back.<br/>';
echo '<a href="index.php">Back</a>';
$h->endpage();
exit();
}
echo '<h3>Search Filter</h3>';
echo '<a href="pReport.php?action=searchFilter">Back</a><br/>';
if (!ctype_digit($_POST['prID'])) {
echo 'prID refers to a numerical value correspoding to the case ID, please go back and try again.';
$h->endpage();
exit();
}
if (!array_key_exists($_POST['prStatus'], $caseStatusColours) || (!array_key_exists($_POST['prUrgency'], $caseUrgencyColours))) {
echo "That value doesn't exist!";
$h->endpage();
exit();
}
$prID = abs(intval(intval($_POST['prID'])));
$prStatus = abs(intval(intval($_POST['prStatus'])));
$prUrgency = abs(intval(intval($_POST['prUrgency'])));
$showFilteredCases = $db->query("SELECT * FROM `preports` WHERE prID='{$prID}' OR prStatus='{$prStatus}' OR prUrgency='{$prUrgency}'");
echo '<br/>';
echo '<br/>';
echo '<center><table border="1">';
echo '<tr>';
echo '<th><br/>Basic Task Info</th>';
echo '<th><br/>Other Details</th>';
echo '<th><br/>Misc</th>';
while ($row = $db->fetch_row($showFilteredCases)) {
// Print out the contents of each row into a table.
echo "<tr><td>";
echo '<b>Case ID:</b> ', htmlentities($row['prID']), '<br/>', ' <b>Case Name:</b> ', htmlentities($row['prName']), '<br/>', ' <b>Date/Time Reported:</b> ', htmlentities(date('d/m/y g:i A',strtotime($row['prDateTime']))), '<br/>', '<b>Case Desc:</b> ', htmlentities($row['prDesc']);
echo "</td><td>";
echo '<b>Staff Over Seeing Case:</b> ', htmlentities($row['prStaffOverSeeingCase']), '<br/>', '<b>Reporter:</b> ', htmlentities($row['prReporter']), '<br/>', '<b>Offender:</b> ', htmlentities($row['prOffender']);
echo "</td>";
echo '<td> <b>Case Status:</b> ', $caseStatusColours[$row['prStatus']], '<br/>', '<b>Case Urgency:</b> ', $caseUrgencyColours[$row['prUrgency']], '<br/></td></td>';
}
echo "</table></center>";
}
$h->endpage();
?>
SQL's
CREATE TABLE `pReports` (
prID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
prName VarChar(225),
prDesc VarChar(225),
prReporter VarChar(50),
prOffender VarChar(50),
prStaffOverSeeingCase VarChar(50) DEFAULT 'Not chosen yet',
prDateTime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
prUrgency INT DEFAULT '0',
prStatus INT DEFAULT '0'
);
I have a ZIP version of all this with installation help included, just can't seem to find a way to upload it. Also give me your opinions on it, and if you would like to see more mods for the future and if so, what sort of mods?