SRCDS Steam group


PHP Help!
#1
Hi

Not sure if this is the right place to post this, so Mods please move it to the right place if necessary.

I am working on a mysql player reporting system for our comunities servers. I already have the reporting side in place, with a php web front end to view all the reported players in a table, with date, reason, reporter etc

I now want to integrate an admin response system into the web page by adding a checkbox to each entry in the table, and a text box with submit button at the bottom of the table. If a row is selected with the checkbox, then entering text in the textbox and pressing the submit button will enter that text into the response column for the selected row in the database.

But I have very little experience with php (writing our web admin system took me several weeks on Google...) and was hoping someone could help me out!

This is the basic page. I haven't included any of my attempts to integrate the response system, as they haven't worked...

PHP Code:
<?php
include("include/session.php");
include(
"include/header.php");

?>

<?php
$host
="localhost";
$username="blabla";
$password="blabla";
$database="blabla";

mysql_connect($host,$username,$password);
@
mysql_select_db($database) or die( "Unable to select database");
?>

<table>
<tr>
<td><img src="images/spacer001.gif" height=50 width=1></td>
<td><img src="images/spacer001.gif" height=1 width=100></td>
</tr>
<tr><td align='right'><img src="images/logo02.jpg"></td><td rowspan=2>&nbsp;&nbsp;<img src="images/spacer002.gif" height=300 width=1></td></tr>
<tr><td class='main' align='right' valign='top'>

<?php
/**
 * User has already logged in, so display relavent links, including
 * a link to the admin center if the user is an administrator.
 */
if($session->logged_in){
   echo 
"<h1>" COMMUNITYNAME " Admin Tools</h1>";
   
   echo 
"<h1>Player Reporting System</h1>";
   echo 
"<br>";
      
?>
<center>
<h1><small><small><span style="font-family: Verdana;"><b>Reported Players</b></span></small></small></h1>
</center>
<br>
<table align="center" border="1" width="70%">


<tbody>
<tr>

<td style="font-family: Verdana;"><b>Date</b></td>
<td style="font-family: Verdana;"><b>Server</b></td>
<td style="font-family: Verdana;"><b>Map</b></td>
<td style="font-family: Verdana;"><b>Player</b></td>
<td style="font-family: Verdana;"><b>STEAM ID</b></td>
<td style="font-family: Verdana;"><b>Reported by</b></td>
<td style="font-family: Verdana;"><b>STEAM ID</b></td>
<td style="font-family: Verdana;"><b>Reason</b></td>
</tr>
<tr>

</tbody>
<?php

mysql_query
("SET NAMES 'utf8'");
$result=mysql_query("SELECT * FROM report");

$num=mysql_numrows($result);

mysql_close();

$i=0;
while (
$i $num) {
    
$id=mysql_result($result,$i,"id");
    
$name=mysql_result($result,$i,"name");
    
$steamid=mysql_result($result,$i,"steamid");
    
$server=mysql_result($result,$i,"server");
    
$map=mysql_result($result,$i,"map");
    
$reason=mysql_result($result,$i,"reason");
    
$date=mysql_result($result,$i,"date");
    
$reportername=mysql_result($result,$i,"reportername");
    
$reporterid=mysql_result($result,$i,"reporterid");
        
    echo 
"\t<tr><td>$date</td><td>$server</td><td>$map</td><td>$name</td><td>$steamid</td><td>$reportername</td><td>$reporterid</td><td>$reason</td></tr>\n";

    
$i++;
}

?>

</table>
 <?php  
include("include/footer.php"); 
     
}
else
{
    
header'Location: index.php' ) ;
}
?>

</td></tr>
</table>
</body>
</html> 

Any ideas/pointers gratefully accepted, thanks!
Reply
#2
So you need a system where you can log in as an administrator and then view reports posted by anonymous poeple? Or am I wrong? And more specificly you need to show a list of reported submitions?


PHP Code:
<?php 
    $listre 
mysql_query("SELECT * FROM table");

    
$temp = array();
    while(
$list mysql_fetch_assoc($listre) {
        
$temp[] = $list;
    }
    foreach(
$temp as $list) { 
        echo 
"<td> " $list['tablename'] . "</td>";
    }
?>
Reply
#3
(04-12-2011, 08:55 PM)realchamp Wrote:  So you need a system where you can log in as an administrator and then view reports posted by anonymous poeple? Or am I wrong? And more specificly you need to show a list of reported submitions?

No, thats what I already have. What I want to do now is add a way of responding to those reports, as described in the first post.

Thanks
Reply
#4
(04-12-2011, 09:40 PM)Nomarky Wrote:  
(04-12-2011, 08:55 PM)realchamp Wrote:  So you need a system where you can log in as an administrator and then view reports posted by anonymous poeple? Or am I wrong? And more specificly you need to show a list of reported submitions?

No, thats what I already have. What I want to do now is add a way of responding to those reports, as described in the first post.

Thanks

Like via email? And obviously another table in the database for the responses given.
Reply
#5
(04-12-2011, 08:55 PM)realchamp Wrote:  Like via email? And obviously another table in the database for the responses given.

No. The response to the player will by SM plugin when they join the server after a response has been given. What I need here is to add PHP code to the web page to allow a response to be added to the response column of the sql db.

(04-12-2011, 08:53 PM)Nomarky Wrote:  I now want to integrate an admin response system into the web page by adding a checkbox to each entry in the table, and a text box with submit button at the bottom of the table. If a row is selected with the checkbox, then entering text in the textbox and pressing the submit button will enter that text into the response column for the selected row in the database.
Reply
#6
(04-12-2011, 09:54 PM)Nomarky Wrote:  
(04-12-2011, 08:55 PM)realchamp Wrote:  Like via email? And obviously another table in the database for the responses given.

No. The response to the player will by SM plugin when they join the server after a response has been given. What I need here is to add PHP code to the web page to allow a response to be added to the response column of the sql db.

(04-12-2011, 08:53 PM)Nomarky Wrote:  I now want to integrate an admin response system into the web page by adding a checkbox to each entry in the table, and a text box with submit button at the bottom of the table. If a row is selected with the checkbox, then entering text in the textbox and pressing the submit button will enter that text into the response column for the selected row in the database.
Like this?
PHP Code:
<?php
    
// File.php
    // Check which checkbox has been marked...
    
if(isset($_POST['checkbox1'])) {
        
$q mysql_query("SELECT * FROM table WHERE somethingTOidentifyEQUALSsomething else"); // Not sure about your database setup.
        
$b mysql_fetch_array($q);
        
        
mysql_query("INSERT into response(column1, column2, column3) VALUES ('$b[value1]', '$b[value2]', '$b[value3]')");
    }
    
// etc...
?>

Reply
#7
Kind of. I have a table on the webpage. Each row in the table is populated with the data from a player's report. I want to add a checkbox to the end of each row. At the end of the page I want a text entry box to enter a response for the row selected by the checkbox. Hitting submit then enters the text from the textbox into the response column for the selected row in the database
Reply
#8
(04-12-2011, 10:16 PM)Nomarky Wrote:  Kind of. I have a table on the webpage. Each row in the table is populated with the data from a player's report. I want to add a checkbox to the end of each row. At the end of the page I want a text entry box to enter a response for the row selected by the checkbox. Hitting submit then enters the text from the textbox into the response column for the selected row in the database

yeh you can check if the checkbox has been marked if it is then get the result of the text box and then insert into the other table.
Reply
#9
(04-12-2011, 10:50 PM)realchamp Wrote:  
(04-12-2011, 10:16 PM)Nomarky Wrote:  Kind of. I have a table on the webpage. Each row in the table is populated with the data from a player's report. I want to add a checkbox to the end of each row. At the end of the page I want a text entry box to enter a response for the row selected by the checkbox. Hitting submit then enters the text from the textbox into the response column for the selected row in the database

yeh you can check if the checkbox has been marked if it is then get the result of the text box and then insert into the other table.

Yeah, thats the bit I need help with
Reply
#10
Look at my previously reply. It's being made with the thought that HTML is in place. Smile
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)