Page 1 of 4 123 ... LastLast
Results 1 to 10 of 35
  1. #1
    Beginner Mystical's Avatar
    Join Date
    Jan 2011
    Location
    Sunny South Carolina
    Posts
    263

    Adjust User Level error

    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.

  2. #2
    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'>Adju st 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...
    Last edited by lucky3809; 04-13-2011 at 12:21 AM.

  3. #3
    Beginner Mystical's Avatar
    Join Date
    Jan 2011
    Location
    Sunny South Carolina
    Posts
    263
    Quote Originally Posted by lucky3809 View Post
    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'>Adju st 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 />&gt; <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 />&gt; <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>

  4. #4
    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'>Adju st 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...
    Last edited by lucky3809; 04-13-2011 at 03:52 AM.

  5. #5
    Beginner Mystical's Avatar
    Join Date
    Jan 2011
    Location
    Sunny South Carolina
    Posts
    263
    That is exactly what the link looks like <a href='staff_special.php?action=userlevelform'>Adju st 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.

  6. #6
    Change the form method to post and all the variables to $_POST rather than $_GET
    Ruler of Zu

    FIA ISP FTW!

    MWG a discussion forum. If you do not like replies then perhaps dont start a topic.

    I no longer support Mccodes bugs, errors or security flaws either on the forum or by private message due to the lack of support by the mccodes staff for their own engine.

    If your looking for an engine get one thats supported by its staff. EzRPG and EzRPG Rework & NWE are my recommendations.

  7. #7
    Beginner Mystical's Avatar
    Join Date
    Jan 2011
    Location
    Sunny South Carolina
    Posts
    263
    Quote Originally Posted by rulerofzu View Post
    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` =

  8. #8
    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.

  9. #9
    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 />&gt; <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 />&gt; <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 />&gt; <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>
    Last edited by lucky3809; 04-13-2011 at 05:41 PM.

  10. #10
    Beginner Mystical's Avatar
    Join Date
    Jan 2011
    Location
    Sunny South Carolina
    Posts
    263
    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.

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •