Jump to content
MakeWebGames

Player reporting clear issue


PHPStudent12

Recommended Posts

Hello, I'm new to mccodes. I tried to clear existing player reports but keep getting this error message: Error: This script requires an action.

This is the code

function report_clear()
{
    global $db, $ir, $c, $h, $userid;
    if (!in_array($ir['user_level'], array(2, 3)))
    {
        echo 'You cannot access this area.<br />
        &gt; <a href="staff.php">Go Back</a>';
        die($h->endpage());
    }
    staff_csrf_stdverify('staff_clear_preport',
            'staff_users.php?action=reportsview');
    $_POST['ID'] =
            (isset($_POST['ID']) && is_numeric($_POST['ID']))
                    ? abs(intval($_POST['ID'])) : 0;
    if (empty($_POST['ID']))
    {
        echo '
        Invalid ID, please go back and try again.
        <br />
        &gt; <a href="staff_users.php?action=reportsview">Go Back</a>
           ';
        die($h->endpage());
    }
    $d =
            $db->query(
                    'SELECT COUNT(`prID`)
                     FROM `preports`
                     WHERE `prID` = ' . $_POST['ID']);
    if ($db->fetch_single($d) == 0)
    {
        $db->free_result($d);
        echo '
        Report doesn\'t seem to exist, Please go back and try again.
        <br />
        &gt; <a href="staff_users.php?action=reportsview">Go Back</a>
           ';
        die($h->endpage());
    }
    $db->free_result($d);
    $db->query(
            'DELETE FROM `preports`
                WHERE `prID` = ' . $_POST['ID']);
    stafflog_add('Cleared player report ID ' . $_POST['ID']);
    echo '
    Report deleted.
    <br />
    &gt; <a href="staff_users.php?action=reportsview">Go Back</a>
       ';
    die($h->endpage());[/PHP]

Im using localhost

thanks

Link to comment
Share on other sites

And the URL you're attempting to use?
Chances are you're not using an action (the "?action=wutever" bit) that's in the switch() statement near the top of the file.

In v2 and v2.0.5b, the case is "repclear". and that function requires a POST value of ID.
In reports_view(), the default form reads as
 

<form action='staff_users.php?action=repclear'>
    <input type='hidden' name='ID' value='{$r['prID']}' />
    {$csrf}
    <input type='submit' value='Clear' />
</form>

and is part of an echo statement

  • Like 2
Link to comment
Share on other sites

hi yh i think thats exactly whats happening because when i try to clear reports i get this url: http://localhost/staff_users.php?ID=1&verf=a29d9633458a9a570f04b09726bf26c8

with no action, can you help me learn how to add one please?

sorry im new to this 

EDIT: i think i fixed with adding

method='post' in the form action 
Edited by PHPStudent12
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...