FluxRP CMS - Report Feature

Moon

If life is a Bitch, Fuck it |
Dec 25, 2017
59
20
Hey, I recently added a Report Players feature to the FluxRP CMS, it's not the best but I was feeling that it would be better off to add it to the website then the already added CFH system in the EMU, I'm not the most experienced when it comes to coding, so I based it on the suggestions.php, as of which you have to check the reports via the suggestions in the ASE, however that's not a major issue, just a little less convenient.
Screenshots:
--
Report Players added to the SideNav
screenshot_1-png.6744

The report.php
screenshot_2-png.6745

ASE/HouseKeeping
screenshot_3-png.6746


How to Install:
Make a report.php file in your FluxRP Skin (Reccomended to use the 'Theme' Skin, not 100% sure about others)
Add this code to it:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{hotelName}: ReportPlayers</title>
<script src="{url}/static/js/jquery-2.1.0.js"></script>
<script type="text/javascript" src="{cdnurl}/fluxweb/static/js/libs2.js"></script>
        <script type="text/javascript" src="{cdnurl}/fluxweb/static/js/visual.js"></script>
        <script type="text/javascript" src="{cdnurl}/fluxweb/static/js/libs.js"></script>
        <script type="text/javascript" src="{cdnurl}/fluxweb/static/js/common.js"></script>
        <script type="text/javascript" src="{cdnurl}/fluxweb/static/js/fullcontent.js"></script>
<link href="{url}/static/css/global.css" rel="stylesheet" type="text/css" />
<link href="{url}/static/css/jquery.qtip.css" rel="stylesheet" type="text/css" />
<link href="{url}/static/css/jquery.fancybox.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="{url}/app/tpl/skins/Theme/styles/lightweightmepage.css" type="text/css">
<link rel="stylesheet" href="{cdnurl}/fluxweb/static/styles/extra.css?<?php echo time(); ?>" type="text/css">
<script type="text/javascript" src="{cdnurl}/fluxweb/static/js/lightweightmepage.js"></script>

</head>

<body class="blue">
<div id="style">   
    <?php
    
    ?>
    <div id="header">
        <div id="clouds"></div>

        <?php
        include_once '/includes/inner.php';
        ?>
    </div>


<?php
include_once 'includes/sidenav.php';
?>
    <div id="wrapper">
    
        <?php
        include_once '/includes/column1.php';
        ?>
<div id="rcontent">
                     <div id="site-response"></div>
            <div id="ajax-content">
        <!-- Player Box -->
  <?php
  $playerInfo = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE username = '".$_SESSION['user']['username']."' LIMIT 1"));
   function hashed($password)
    {
        return sha1(md5($password));
    }
    
   function pinhashed($pin)
    {
        return substr(md5($pin), 0, 6);
    }
    function validEmail($email)     
    {         
        return preg_match("/^[a-z0-9_\.-]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i", $email);     
    }     
  ?>
  <div id="column1" style="width:49%;float:left;display:inline-block;">
                <div class="box blue">
                <h1 class="header">Report Player's</h1><br>
                <br>
                <h1 class="header"> Report less serious crime's to the Police </h1>
                <?php
                if(isset($_POST['sendReportSub'])){
                    $errors = array();
                    $failed = 0;
                    $rStrength = -1;$rHealth = -1;$rIntel = -1;$rEnergy = -1;$rHunger = -1;$rArrests = -1;$rJob = NULL;
                    $suggType = filter($_POST['type']);
                    $suggDesc = filter($_POST['briefDesc']);
                    if(isset($_POST['Strength'])){
                        $rStrength = filter($_POST['requiresS']);
                    }
                    if(isset($_POST['Health'])){
                        $rHealth = filter($_POST['requiresH']);
                    }
                    if(isset($_POST['Energy'])){
                        $rEnergy = filter($_POST['requiresE']);
                    }
                    if(isset($_POST['Intelligence'])){
                        $rIntel = filter($_POST['requiresI']);
                    }
                    if(isset($_POST['Hunger'])){
                        $rHunger = filter($_POST['requiresHun']);
                    }
                    if(isset($_POST['Arrests'])){
                        $rArrests = filter($_POST['requiresA']);
                    }
                    if(isset($_POST['Job'])){
                        $rJob = filter($_POST['requiresJ']);
                    }
                    if($rStrength != -1){
                        if(!is_numeric($rStrength) || strlen($rStrength) < 0 || strlen($rStrength) > 3 || $rStrength > 50 || $rStrength < 0){
                            $errors[] = "Invalid Strength";
                        }
                    }
                    if($rHealth != -1){
                        if(!is_numeric($rHealth) || strlen($rHealth) < 0 || strlen($rHealth) > 3 || $rHealth > 800 || $rHealth < 0){
                            $errors[] = "Invalid Health";
                        }
                    }
                    if($rEnergy != -1){
                        if(!is_numeric($rEnergy) || strlen($rEnergy) < 0 || strlen($rEnergy) > 3 || $rEnergy > 100 || $rEnergy < 0){
                            $errors[] = "Invalid Energy";
                        }
                    }
                    if($rIntel != -1){
                        if(!is_numeric($rIntel) || strlen($rIntel) < 0 || strlen($rIntel) > 2 || $rIntel > 50 || $rIntel < 0){
                            $errors[] = "Invalid Intelligence";
                        }
                    }
                    if($rHunger != -1){
                        if(!is_numeric($rHunger) || strlen($rHunger) < 0 || strlen($rHunger) > 3 || $rHunger > 100 || $rHunger < 0){
                            $errors[] = "Invalid Hunger";
                        }
                    }
                    if($rArrests != -1){
                        if(!is_numeric($rArrests) || strlen($rArrests) < 0 || strlen($rArrests) > 3 || $rArrests > 500 || $rArrests < 0){
                            $errors[] = "Invalid Arrests";
                        }
                    }
                    if($rJob != NULL){
                        if(strlen($rJob) < 3 || strlen($rJob) > 50 || is_numeric($rJob) || strpos($rJob, '<') || strpos($rJob, '>') || strpos($rJob, '"')){
                            $errors[] = "Invalid Job Title";
                        }
                    }
                    if($suggType != "Uncategorized" && $suggType != "Corporation" && $suggType != "Bug" && $suggType != "Games" && $suggType != "Fighting" && $suggType != "Gangs" && $suggType != "Forums" && $suggType != "Other"){
                        $errors[] = "IP Logged for trying to exploit.";
                    }
                    
                    
                    if(strlen($suggDesc) < 15 || strlen($suggDesc) > 500 || is_numeric($suggDesc) || strpos($suggDesc, '<') || strpos($suggDesc, '>') || strpos($suggDesc, '"')){
                            $errors[] = "Invalid Brief Description";
                    }
                    if(isset($errors) && is_array($errors) && !empty($errors)){
                        echo "<center><p style='color:red;'>";
                        foreach($errors as $err){
                            echo $err;
                            echo "<br>";
                        }
                        echo "</center></p>";
                        $failed = 1;
                    }else{
                        mysql_query("INSERT INTO `rp_suggestions` (type, rstrength, rintel, renergy, rhealth, rarrests, rhunger, rjob, description, user_id) VALUES ('".$suggType."','".$rStrength."','".$rIntel."','".$rEnergy."','".$rHealth."','".$rArrests."','".$rHunger."','".$rJob."','".$suggDesc."', '".$_SESSION['user']['id']."')") or die(mysql_error());
                        echo "<center><p style='color:green;'>Suggestion Sent!</center></p>";
                    }
                }
                
                ?>
                <form method="post" name="sendReport">
                <center><select name="type">
                <option value="Uncategorized" selected>Uncategorized</option>
                <option value="Corporation">Corporation</option>
                <option value="Bug">Bug/Glitch</option>
                <option value="Fighting">Weapons/Fighting</option>
                <option value="Gangs">Gang Abuse</option>
                <option value="Forums">Forums</option>
                <option value="Other">Others</option>
                </select><br><h4>Put the user's name and the offence.:</h4></center>
                <textarea style="width:90%;height:120px;" name="briefDesc" placeholder="The rule the user broke, they're user-name & evidence."><?php if($failed == 1) echo $suggDesc; ?></textarea>
                
                
                <center><input type="submit" value="Send In" name="sendReportSub"></center>
                </form>
                </div>
  </div>
<div id="column2" style="width:49%;float:right;display:inline-block;">

                <div class="box green">
                <h1 class="header">Handled Requests</h1><br>
                <?php
                $getHandled = mysql_query("SELECT * FROM rp_suggestions WHERE Answer IS NOT NULL AND user_id = '".$_SESSION['user']['id']."'");
                if(mysql_num_rows($getHandled) > 0){
                    while($sugg = mysql_fetch_assoc($getHandled)){
                        echo "<b>Type: </b>";
                        echo $sugg['type'];
                        echo "<br><b>Description: </b>";
                        echo $sugg['description'];
                        echo "<br><b>Staff Reply: </b>";
                        echo $sugg['Answer'];
                        echo "<br><hr><br>";
                    }
                }else{
                    echo "<center> You have no handled requests </center>";
                }
                ?>
                </div>   
                
                
                <div class="box green">
                <h1 class="header">Current Requests</h1><br>
                <?php
                $getHandled = mysql_query("SELECT * FROM rp_suggestions WHERE Answer IS NULL AND user_id = '".$_SESSION['user']['id']."'");
                if(mysql_num_rows($getHandled) > 0){
                    while($sugg = mysql_fetch_assoc($getHandled)){
                        echo "<b>Type: </b>";
                        echo $sugg['type'];
                        echo "<br><b>Description: </b>";
                        echo $sugg['description'];
                        echo "<br><br> <i>Staff are working very hard and taking serious thought to get back to you on this.<br><hr><br>";
                    }
                }else{
                    echo "<center> You have no pending requests </center>";
                }
                ?>
                </div>   
                
                
</div>   
                
<input type="hidden" id="page-title" value="Home">            </div>
        </div>
        
        <div class="clear"></div>
    </div>
</div>
<?php include('includes/checktheban.php'); ?>
<?php include('includes/footer.php'); ?>
</body>
</html>
And yes sorry about alot of the unneccessary code, it was from the suggestions.

Then save that and check (Your RP Domain)/report if it comes up with the screenshot I provided earlier that bit worked.
Now go your sidenav.php and add this here:
screenshot_4-png.6748


And if your sidenav 'Report Players' goes to report.php when you click on it, it should be working!

Thanks, sorry I'm not the most experienced at coding but I thought I would add this!
-MoonShots
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    231.1 KB · Views: 1,240
  • Screenshot_2.png
    Screenshot_2.png
    139.4 KB · Views: 1,230
  • Screenshot_3.png
    Screenshot_3.png
    34.7 KB · Views: 1,214
  • Screenshot_3.png
    Screenshot_3.png
    34.7 KB · Views: 23
  • Screenshot_4.png
    Screenshot_4.png
    65.9 KB · Views: 1,218

Users who are viewing this thread

Top