Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Authority Tool

Experienced Elementalist
Joined
Dec 7, 2006
Messages
250
Reaction score
2
This is more sth like a broken release since im needing some help.

Code:
<?php

if ($site == 0)
{
echo'This tool is only for super-admins.';
die();
}

include('./log_maker.php');
parth1tr();    
parth1('100%',4,'center');
echo '<font color="black"><h1><strong>Authority Tool</strong></h1></font>';    
echo '<u>By HellFire</u>';    
parth2();
echo"Auth 0 = GM<br>Auth 1 = Player<br>Auth 255 = Banned<br>Auth 9 = Muted<br>";
parth2tr();




if ($site == 1)
{
  if ($security == 1)

    if ($_GET['do'] == 'authtool') 
    {
    if ($_SESSION['editOk'] != "canEdit") {
        echo "<script>self.location = 'index.php?act=admin&actu=authtool'</script>";
    } else {
        $_SESSION['editOk'] = "";
    }
    
    error_reporting(E_ALL ^ E_NOTICE);

    $char = trim($_POST['char']);
    $auth = trim($_POST['auth']);

    $char = test($char);
    $auth = test($auth);



         if (empty($char) && empty($auth))
    {
        parth1tr();
        part1('100%',1,1,'center');
        echo "U have to fill all fields. <br><a href='$PHP_SELF?act=admin&actu=authtool'>Edit again.</a>";
        die();
    }
    
    
    if (!empty($char) && !empty($auth))
    {

        $msquery="UPDATE USERDATA SET Authority='$auth' WHERE strUserID='$char'";
              $msresults=odbc_exec($msconnect,$msquery) or die("Error, check your connection parameters!");
           
       
        parth1tr();
        part1('100%',1,1,'center');

            

            echo "<font color='blue'>Succesfully edited Authority</font>";
                echo"<br>";
                echo "<font color='green'>Details</font><br>";
                echo"<br>";
                echo"<br>";
                echo "<font color='red'>Character Name:</font> ".$char."";
                echo"<br>";
                echo "<font color='red'>New Authority:</font> ".$auth."";
                echo"</p>";

        parth2();
        parth2tr();
               
    }else
    {
        parth1tr();
        part1('100%',1,1,'center');
        echo "Character <b>".$char."</b> not found. <br><a href='$PHP_SELF?act=admin&actu=authtool'Try Again!</a>";
        parth2();
        parth2tr();
    }
    }else
    {
    $_SESSION['editOk'] = "canEdit";
    echo '<td class="alt1"><center><FORM method=post name=regform action=index.php?act=admin&actu=authtool&do=authtool style="margin:0px; padding:0px">
        <table  width="300px">
        <tr>
        <td>Character Name:</td>
        <td><input type="text" class="input" name="char" value="" maxlength="50" size="20"></td>
        <tr>
        <td>New Authority:</td>
        <td><input type="text" class="input" name="auth" value="" maxlength="50" size="20"></td>
        <tr>
        </table>
        <center><input class="input" type="submit" value="Update!"</center></br></br>
        </form>
        </center>
        </td>
        ';
    }
}

?>

when i try to update a user with authority=0 it says character xx not found, when i try it with 255 it just works , same for 9 and 1 :s
 
Junior Spellweaver
Joined
Jun 5, 2006
Messages
133
Reaction score
0
Re: [Pre-Release]Authority Tool

Code:
<?php

if ($site == 0)
{
echo'This tool is only for super-admins.';
die();
}

include('./log_maker.php');
parth1tr();    
parth1('100%',4,'center');
echo '<font color="black"><h1><strong>Authority Tool</strong></h1></font>';    
echo '<u>By HellFire</u>';    
parth2();
echo"Auth 0 = GM<br>Auth 1 = Player<br>Auth 255 = Banned<br>Auth 9 = Muted<br>";
parth2tr();


if ($site == 1)
{
  if ($security == 1)

    if ($_GET['do'] == 'authtool') 
    {
    if ($_SESSION['editOk'] != "canEdit") {
        echo "<script>self.location = 'index.php?act=admin&actu=authtool'</script>";
    } else {
        $_SESSION['editOk'] = "";
    }
    
    error_reporting(E_ALL ^ E_NOTICE);

    $char = trim($_POST['char']);
   $auth = trim($_POST['auth']);

    $char = test($char);
    $auth = test($auth);



         if (empty($char))
    {
        parth1tr();
        part1('100%',1,1,'center');
        echo "Char empty<br><a href='$PHP_SELF?act=admin&actu=authtool'>Edit again.</a>";
        die();
    }
	
	         if (empty($auth) and ($auth <>0)) 
    {
        parth1tr();
        part1('100%',1,1,'center');
        echo "Auth empty<br><a href='$PHP_SELF?act=admin&actu=authtool'>Edit again.</a>";
        die();
    }
	
           $msqueryz21="select count(*) from userdata WHERE strUserID='$char'";
              $usercount=odbc_exec($msconnect,$msqueryz21) or die("Error, check your connection parameters!");
    
    if (!empty($char))
    {
 
           if (($usercount)> 0)
		   {
        $msquery="UPDATE USERDATA SET Authority='$auth' WHERE strUserID='$char'";
              $msresults=odbc_exec($msconnect,$msquery) or die("Error, check your connection parameters!");
           
       
        parth1tr();
        part1('100%',1,1,'center');

            

            echo "<font color='blue'>Succesfully edited Authority</font>";
                echo"<br>";
                echo "<font color='green'>Details</font><br>";
                echo"<br>";
                echo"<br>";
                echo "<font color='red'>Character Name:</font> ".$char."";
                echo"<br>";
                echo "<font color='red'>New Authority:</font> ".$auth."";
                echo"</p>";

        parth2();
        parth2tr();
               
    }
	}else
    {
        parth1tr();
        part1('100%',1,1,'center');
        echo "Character <b>".$char."</b> not found. <br><a href='$PHP_SELF?act=admin&actu=authtool'Try Again!</a>";
        parth2();
        parth2tr();
    }
    }else
    {
    $_SESSION['editOk'] = "canEdit";
    echo '<td class="alt1"><center><FORM method=post name=regform action=index.php?act=admin&actu=authtool&do=authtool style="margin:0px; padding:0px">
        <table  width="300px">
        <tr>
        <td>Character Name:</td>
        <td><input type="text" class="input" name="char" value="" maxlength="50" size="20"></td>
        <tr>
        <td>New Authority:</td>
        <td><input type="text" class="input" name="auth" value="" maxlength="1" size="1"></td>
        <tr>
        </table>
        <center><input class="input" type="submit" value="Update!"</center></br></br>
        </form>
        </center>
        </td>
        ';
    }
}

?>

Try that.

The problem was empty() was detecting 0 as empty. There may be a better workaround, but I just added a if $auth <> 0 clause, and it seems to work fine.
 
Experienced Elementalist
Joined
Dec 7, 2006
Messages
250
Reaction score
2
Re: [Pre-Release]Authority Tool

thanks
 
Back
Top