Mystical Posted April 11, 2011 Share Posted April 11, 2011 There is an error in staff_special.php for v2.0.3. When I try to update a users level I get this message. Error: This script requires an action. I saw Illusions fix in another thread but after I added the fix I still get the exact same error. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted April 13, 2011 Share Posted April 13, 2011 (edited) There is no action meaning one of the links you clicked on didnt direct to an action in the script in which it goes to... Or the action function is not in the script... post your staff_special.php then others can see what link or action is missing. For an example... You have in smenu.php <a href='staff_special.php?action=userlevelform'>Adjust User Level</a> Then see where the "action=" is? The "userlevelform" is the action... That action should be a function in your staff_special.php.... The link from your menu may be missing an action, or just says <a href='staff_special.php'>... You need to correct it and add an action, if the action is there, make sure it is correctly spelt, if that is fine then the problem is in your staff_special.php, may be missing the action function... Edited April 13, 2011 by lucky3809 Quote Link to comment Share on other sites More sharing options...
Mystical Posted April 13, 2011 Author Share Posted April 13, 2011 There is no action meaning one of the links you clicked on didnt direct to an action in the script in which it goes to... Or the action function is not in the script... post your staff_special.php then others can see what link or action is missing. For an example... You have in smenu.php <a href='staff_special.php?action=userlevelform'>Adjust User Level</a> Then see where the "action=" is? The "userlevelform" is the action... That action should be a function in your staff_special.php.... The link from your menu may be missing an action, or just says <a href='staff_special.php'>... You need to correct it and add an action, if the action is there, make sure it is correctly spelt, if that is fine then the problem is in your staff_special.php, may be missing the action function... Here is the part in question and thanks! function userlevel() { global $db,$ir,$c,$h,$userid; $_GET['level'] = ( isset($_GET['level'])&&in_array($_POST['level'], array(1,2,3,4,5)) )?abs(intval($_GET['level'])):1; $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; $d = $db->query('SELECT `userid` FROM `users` WHERE `userid` = '.$_POST['ID']); if ( $db->num_rows($d) == 0 ) { echo 'Invalid user.<br />> <a href="staff_special.php?action=userlevelform">Go Home</a>'; die($h->endpage()); } $db->query("UPDATE `users` SET `user_level` = {$_GET['level']} WHERE `userid` = {$_GET['ID']}"); stafflog_add('Adjusted user ID '.$_GET['ID'].'\'s staff status.'); echo 'User\'s level adjusted.<br />> <a href="staff.php">Go Home</a>'; die($h->endpage()); } function userlevelform() { global $db,$ir,$c,$h,$userid; echo " <h3>User Level Adjust</h3> <form action='staff_special.php?action=userlevel' method='get'> User: ".user_dropdown($c,'ID')." <br /> User Level: <br /> <input type='radio' name='level' value='1' /> Member <br /> <input type='radio' name='level' value='2' /> Admin <br /> <input type='radio' name='level' value='3' /> Secretary <br /> <input type='radio' name='level' value='4' /> IRC Op <br /> <input type='radio' name='level' value='5' /> Assistant <br /> <input type='submit' value='Adjust' /> </form> Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted April 13, 2011 Share Posted April 13, 2011 (edited) Ok your functions is not the problem... its the link in your smenu page where it should say... <a href='staff_special.php?action=userlevelform'>Adjust User Level</a> If it does not have that then copy and paste that line... it should work evidently the smenu page links are not linking to the actions... Which the action is... userlevelform... which directs the link when clicked to the form... Edited April 13, 2011 by lucky3809 Quote Link to comment Share on other sites More sharing options...
Mystical Posted April 13, 2011 Author Share Posted April 13, 2011 That is exactly what the link looks like <a href='staff_special.php?action=userlevelform'>Adjust User Level</a><br />. When I change those functions to the old version in 2.0.2c it works like a charm so it must be something in the way the one of the two functions are coded in the new version 2.0.3. Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted April 13, 2011 Share Posted April 13, 2011 Change the form method to post and all the variables to $_POST rather than $_GET Quote Link to comment Share on other sites More sharing options...
Mystical Posted April 13, 2011 Author Share Posted April 13, 2011 Change the form method to post and all the variables to $_POST rather than $_GET Still cant figure it out because your talking to a moron when it comes to coding. I also found another error in the same file. When you go to staff list clicking on the links secretary assistant or member will get you this message: QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query was SELECT `userid` FROM `users` WHERE `userid` = Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted April 13, 2011 Share Posted April 13, 2011 Replace those functions with... function userlevel() { global $db,$ir,$c,$h,$userid; $_GET['level']=abs((int) $_GET['level']); $_GET['ID']=abs((int) $_GET['ID']); $db->query("UPDATE users SET user_level={$_GET['level']} WHERE userid={$_GET['ID']}"); print "User's level adjusted."; stafflog_add("Adjusted user ID {$_GET['ID']}'s staff status."); } function userlevelform() { global $db,$ir,$c,$h,$userid; print "<h3>User Level Adjust</h3> <form action='staff_special.php' method='get'> <input type='hidden' name='action' value='userlevel'> User: ".user_dropdown($c,'ID')."<br /> User Level:<br /> <input type='radio' name='level' value='1' /> Member<br /> <input type='radio' name='level' value='2' /> Admin<br /> <input type='radio' name='level' value='3' /> Secretary<br /> <input type='radio' name='level' value='4' /> IRC Op<br /> <input type='radio' name='level' value='5' /> Assistant<br /> <input type='submit' value='Adjust' /></form>"; } Your getting that query error because it may have not inserted the ID. Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted April 13, 2011 Share Posted April 13, 2011 (edited) haha didnt see it until now but take a look at your script... function userlevel() { global $db,$ir,$c,$h,$userid; $_GET['level'] = ( isset($_GET['level'])&&in_array($_POST['level'], array(1,2,3,4,5)) )?abs(intval($_GET['level'])):1; $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; $d = $db->query('SELECT `userid` FROM `users` WHERE `userid` = '.$_POST['ID']); if ( $db->num_rows($d) == 0 ) { echo 'Invalid user.<br />> <a href="staff_special.php?action=userlevelform">Go Home</a>'; die($h->endpage()); See whats wrong? There is 2 $_POST when it should be $_GET Your script probably works fine now that i changed those... function userlevel() { global $db,$ir,$c,$h,$userid; $_GET['level'] = ( isset($_GET['level'])&&in_array($_GET['level'], array(1,2,3,4,5)) )?abs(intval($_GET['level'])):1; $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; $d = $db->query('SELECT `userid` FROM `users` WHERE `userid` = '.$_GET['ID']); if ( $db->num_rows($d) == 0 ) { echo 'Invalid user.<br />> <a href="staff_special.php?action=userlevelform">Go Home</a>'; die($h->endpage()); } $db->query("UPDATE `users` SET `user_level` = {$_GET['level']} WHERE `userid` = {$_GET['ID']}"); stafflog_add('Adjusted user ID '.$_GET['ID'].'\'s staff status.'); echo 'User\'s level adjusted.<br />> <a href="staff.php">Go Home</a>'; die($h->endpage()); } function userlevelform() { global $db,$ir,$c,$h,$userid; echo " <h3>User Level Adjust</h3> <form action='staff_special.php?action=userlevel' method='get'> User: ".user_dropdown($c,'ID')." <br /> User Level: <br /> <input type='radio' name='level' value='1' /> Member <br /> <input type='radio' name='level' value='2' /> Admin <br /> <input type='radio' name='level' value='3' /> Secretary <br /> <input type='radio' name='level' value='4' /> IRC Op <br /> <input type='radio' name='level' value='5' /> Assistant <br /> <input type='submit' value='Adjust' /> </form> Edited April 13, 2011 by lucky3809 Quote Link to comment Share on other sites More sharing options...
Mystical Posted April 13, 2011 Author Share Posted April 13, 2011 Worked like a charm! Thanks a bunch for showing me how to fix it. Appreciated. rulerofzu told me that but I dont know a whole lot about this stuff yet. I am just starting to learn. Thanks again. Quote Link to comment Share on other sites More sharing options...
mike Posted April 14, 2011 Share Posted April 14, 2011 I just bought version 2.0.3 last night and after we got it installed on our host and started playing around we found this same problem. I will try this fix when I get home tonight but I assume this means the engine is not working out of the box and there will probably be other bugs to fix? Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted April 14, 2011 Share Posted April 14, 2011 There will always be bugs and problems with mccodes ... The script in which you guys/girls are using had $_POST mixed with $_GET, it either needs to be all $_POST or all $_GET, in those lines I fixed... Or else it will give the error and not update the database... Quote Link to comment Share on other sites More sharing options...
mike Posted April 15, 2011 Share Posted April 15, 2011 Yep, we are working them out now. Thanks! Quote Link to comment Share on other sites More sharing options...
Paul Evans Posted April 16, 2011 Share Posted April 16, 2011 To be honest i think that's just a typo not a bug, but even if it is categorized under a bug what doesn't have bugs? I know of 2 bugs in the script and they have both got fixes posted on here so... Quote Link to comment Share on other sites More sharing options...
Danny696 Posted April 16, 2011 Share Posted April 16, 2011 A bug would be an an error, flaw, mistake. Alot of things dont actually have bugs :/ Quote Link to comment Share on other sites More sharing options...
Paul Evans Posted April 16, 2011 Share Posted April 16, 2011 Name one script that has never had a bug. Quote Link to comment Share on other sites More sharing options...
Danny696 Posted April 16, 2011 Share Posted April 16, 2011 Windows, lol joke... Umm, Google :) Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted April 17, 2011 Share Posted April 17, 2011 Google do have bugs too. No software is without bugs, it's simply impossible. Simply on some softs you see the bugs more than others, or actually some bugs are easier to spots than others. Of course some softs do have better quality than others. Now for most developers, bugs are part of software which do not work as planned or should. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted February 19, 2012 Share Posted February 19, 2012 This didnt work for me unless im just not seeing it but here is my code function userlevel() { global $db,$ir,$c,$h,$userid; $_GET['level'] = ( isset($_GET['level'])&&in_array($_GET['level'], array(1,2,3,4,5)) )?abs(intval($_GET['level'])):1; $_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):''; $d = $db->query('SELECT `userid` FROM `users` WHERE `userid` = '.$_GET['ID']); if ( $db->num_rows($d) == 0 ) { echo 'Invalid user.<br />> <a href="staff_special.php?action=userlevelform">Go Home</a>'; die($h->endpage()); } $db->query("UPDATE `users` SET `user_level` = {$_GET['level']} WHERE `userid` = {$_GET['ID']}"); stafflog_add('Adjusted user ID '.$_GET['ID'].'\'s staff status.'); echo 'User\'s level adjusted.<br />> <a href="staff.php">Go Home</a>'; die($h->endpage()); } function userlevelform() { global $db,$ir,$c,$h,$userid; echo " <h3>User Level Adjust</h3> <form action='staff_special.php?action=userlevel' method='get'> User: ".user_dropdown($c,'ID')." <br /> User Level: <br /> <input type='radio' name='level' value='1' /> Member <br /> <input type='radio' name='level' value='2' /> Admin <br /> <input type='radio' name='level' value='3' /> Secretary <br /> <input type='radio' name='level' value='4' /> Assistant <br /> <input type='radio' name='level' value='5' /> Forum Mod <br /> <input type='submit' value='Adjust' /> </form> "; Quote Link to comment Share on other sites More sharing options...
Danny696 Posted February 19, 2012 Share Posted February 19, 2012 Look when the last post was before posting. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted February 19, 2012 Share Posted February 19, 2012 Yeah, just under a year and your point is? Why start another thread when we have a perfectly good working one here ie not locked? Now back to the topic which isnt when the last post was please Quote Link to comment Share on other sites More sharing options...
Danny696 Posted February 19, 2012 Share Posted February 19, 2012 My point is that if this topic was still relavent, people would have posted in it in that year it has been dead. It probably would have been better to open a new topic. P.S, no old topics get locked if which, we have previously asked for it to be done, which was refused. Quote Link to comment Share on other sites More sharing options...
Dominion Posted February 19, 2012 Share Posted February 19, 2012 This didnt work for me unless im just not seeing it but here is my code What errors are you getting? Look when the last post was before posting. Since it's asking for support on the same things as the rest of the thread there is nothing "wrong" with it... Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted February 19, 2012 Share Posted February 19, 2012 Error: This script requires an action. Quote Link to comment Share on other sites More sharing options...
sniko Posted February 19, 2012 Share Posted February 19, 2012 You need to edit the link; I'm unsure what the actual case name is, so; - Open the file. - Find the case section of the file - Find the case name of the function you want to link to - Edit the link (Normally, McCodes uses this <a href='file.php?action=casename'>Something</a>) Personally, I don't like the default case returning that error, it would be so much more user friendly if it returned links to the functions... 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.