PHPStudent12 Posted November 4, 2019 Share Posted November 4, 2019 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 /> > <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 /> > <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 /> > <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 /> > <a href="staff_users.php?action=reportsview">Go Back</a> '; die($h->endpage());[/PHP] Im using localhost thanks Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted November 4, 2019 Share Posted November 4, 2019 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 2 Quote Link to comment Share on other sites More sharing options...
PHPStudent12 Posted November 4, 2019 Author Share Posted November 4, 2019 (edited) 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 November 4, 2019 by PHPStudent12 Quote Link to comment Share on other sites More sharing options...
MNG Posted November 4, 2019 Share Posted November 4, 2019 Why not clear it through phpadmin? Quote Link to comment Share on other sites More sharing options...
PHPStudent12 Posted November 7, 2019 Author Share Posted November 7, 2019 (edited) On 11/4/2019 at 8:21 PM, MNG said: Why not clear it through phpadmin it's better if I could do it in the game Edited November 7, 2019 by PHPStudent12 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted November 7, 2019 Share Posted November 7, 2019 On 11/4/2019 at 8:21 PM, MNG said: Why not clear it through phpadmin? Why not run it on the command line? Everyone has their preferred method of administration ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.