Hey guys, I have been looking for hours, and I can't find the correct solution or know where to even start...
I got this script, and when I click on a radiobutton from the part of the website, it needs to change the reasons (other radiobuttons). Can anyone help me to get started?
And if you got any suggestions regarding to make this code more optimized, please let me know, I'm not that good in php...
In the case below the reasons are made for the chat option... So I need to know how to let it change on change of website part change
Thanks! Code is below
<?
session_start();
if(!session_is_registered(moderator)){
header("location:main_login.php");
}
?>
<form action="reportsubmit.php" method="post">
<p>User: <br /><input type="text" name="user" tabindex="2"/>
</p>
<p>Section of website<br /><input type="radio" name="section" value="profile" />Profile
<input type="radio" name="section" value="chat" />Chat
<input type="radio" name="section" value="forums" />Forums
</p>
<p>Reason: <br /> <input type="radio" name="reason" value="predator" />Predator
<br />
<input type="radio" name="reason" value="floodspam" />Flooding / Spam<br />
<input type="radio" name="reason" value="porn" />Posting pornographic content<br />
<input type="radio" name="reason" value="personal" />Posting personal information<br />
<br />
Additional information: <br />
<textarea name="additionalinfo" cols="30" rows="5" id="additionalinfo" tabindex="3"></textarea>
<br />
<br />
No IP Address has to be provided, this IP Address is recorded automaticaly.<br />
<br />
Action: <br /><input type="radio" name="action" value="freeze">Freeze</input><input type="radio" name="action" value="kick">
KICK</input>
<br />
<br />
<input type="Submit" name="Submit" value="Submit"/></p>
</form>
<?
if (isset($_POST['Submit'])) {
if (isset($_SESSION['emoderator'])){
$psswd = $_POST['pass'];
$epass = md5($_POST['pass']);
$euser = $_POST['user'];
$eipaddress = $_POST['ipaddress'];
$ereason = $_POST['reason'];
$ecomment = $_POST['additionalinfo'];
$esection = $_POST['section'];
$eaction = $_POST['action'];
include 'db.php';
//Start UserID lookup
// Look up UserID & if this user can be reported (moderators can't be reported for now)
// Or if the user has been banned already, it will not work either.
$getuserid = "SELECT username,gid,block FROM jos_users WHERE username = '".addslashes($euser)."'";
$getuseridresult = mysql_query($getuserid);
$rowuser = @mysql_fetch_array ($getuseridresult);
$username = $rowuser['0'];
$usergid = $rowuser['1'];
$userblock = $rowuser['2'];
if ($usergid >= 19) {
echo "
<script type='text/javascript'>
alert(\"You can't report fellow moderators or higher staff!\");
</script>
";
die();
}
//Start Reporting
$emod= $_SESSION['emoderator'];
$querykick = "INSERT INTO modsite_reports (websitepart, moderator, user, reason, additionalinfo, action, ipaddress) VALUES('$esection','$emod','$username','$ereason','$ecomment','$eaction','$eipaddress')";
if (!mysql_query($querykick))
{
die('Error: ' . mysql_error());
}
echo "
<script type='text/javascript'>
alert(\"Report added!\");
</script>
";
mysql_free_result();
mysql_close();
}
}
//End Reporting
?>
</body>
</html>