GM Creation Code

Results 1 to 11 of 11
  1. #1
    Cory James Cuvvvie is offline
    Grand MasterRank
    Nov 2009 Join Date
    707Posts

    GM Creation Code

    Edit: Version 2 released
    -Will give 'Wrong Account' error if an incorrect name is given.
    -Overall cleaner

    This code is made to create a GM in the CHARACTER_01_DBF database without having to go into it and get all messy.

    Credits to me for making it, credits to Diumelia for large chunks of code. I'm veerryy inexperienced in mssql so please feel free to let me know if i need to fix anything up.

    WARNING:
    I must also warn you that you shouldn't use this on a public server, for any reason o.o
    I used my server for testing and for fun, and this helps greatly.
    Code:
    <body>
    <font face="Geneva, Arial, Helvetica, Sans-Serif">
    <font size="3">   
        <?php
    ini_set('display_errors', 0); 
    $connection = mssql_connect('CONNECTION NAME', 'sa', 'PASSWORD'); //Replace CONNECTION NAME and PASSWORD
    
    if(!connection || !mssql_select_db('CHARACTER_01_DBF', $connection)) 
    {
        die('Unable to connect or select database!');
    }
    
    $checkusername = $_POST['character'];
    $query = mssql_query("SELECT m_szName FROM CHARACTER_TBL WHERE m_szName='$checkusername'");
    $result = mssql_fetch_row($query);
    
    if(isset($_POST['submit'])){
        if($checkusername == ""){
            $error = '<font color="red"><b>Please enter a username.</b></font>';
        }
        else if($checkusername != $result[0]){
            $error = '<font color="red"><b>Please enter a valid character name.</b></font>'; 
        }
        else{
            mssql_query("UPDATE CHARACTER_TBL SET m_chAuthority = 'S' WHERE m_szName = '$checkusername'");
            $error = '<font color="green"><b>Your character is now a GM!</b></font>';
        }
    }
    
    echo '<form action="creategm.php" method="post">';
    echo 'Character Name: <input type="text" name="character" /><br /><br />';
    echo '<input type="submit" name="submit" value="Become a GM!">';
    echo '</form>';
    echo $error
    ?>
    
    </body>
    NOTICE: Must be saved as creategm.php (or just edit the 8th line from the bottom)

    If it doesnt work for any reason, let me know and I'd be happy to help.
    Last edited by Cuvvvie; 14-11-09 at 08:17 PM.


  2. #2
    Elite Member DeltaBurnt is offline
    Member +Rank
    Apr 2008 Join Date
    157Posts

    Re: GM Creation Code

    Is it that hard to just open MSSQL and edit ch_authority yourself?

  3. #3
    Cory James Cuvvvie is offline
    Grand MasterRank
    Nov 2009 Join Date
    707Posts

    Re: GM Creation Code

    yeah.

  4. #4
    Member Diumelia is offline
    MemberRank
    Apr 2009 Join Date
    BelgiumLocation
    60Posts

    Re: GM Creation Code

    I don't wanna be rude but I don't really like this: "Credits to Diumelia for SOME pieces of the script.".
    I highlighted everything that I wrote in red and everything that you wrote (actually changed) in blue. Do you see the difference? I think you better write there: "Credits to me, Cuvvvie, for some parts of the script.".
    But anyways, thanks for mentioning my name..

    Code:
    <body>
    <font face="Geneva, Arial, Helvetica, Sans-Serif">
    <font size="3">   
        <?php
    //This script was created by Cuvvvie, credits to Diumelia for some pieces of the script.
    ini_set('display_errors', 0); 
    $connection = mssql_connect('**YOURHOST**', 'sa', '**YOURPASSWORD**'); //Replace YOURHOST and YOURPASSWORD
    
    if(!connection || !mssql_select_db('CHARACTER_01_DBF', $connection)) 
    {
        die('Unable to connect or select database!');
    }
    
    $checkusername = $_POST['character'];
    $query = mssql_query("UPDATE CHARACTER_TBL SET m_chAuthority = 'S' WHERE m_szName = '$checkusername'");
    $result = mssql_fetch_row($query);
    
    if(isset($_POST['submit'])){
        if($_POST['character'] == ""){
            $error = '<font color="red"><b>Please enter a username.</b></font>';
        }
        else{
            mssql_query("UPDATE CHARACTER_TBL SET m_chAuthority = 'S' WHERE m_szName = '$checkusername'");
            $error = '<font color="green"><b>Youhave been succesfully changed to a GM!</b></font>';
        }
    }
    
    echo '<form action="creategm.php" method="post">';
    echo 'Character Name: <input type="text" name="character" /><br /><br />';
    echo '<input type="submit" name="submit" value="Become a GM!">
    echo '</form>';
    echo $error
    ?>
    
    </body>

  5. #5
    Cory James Cuvvvie is offline
    Grand MasterRank
    Nov 2009 Join Date
    707Posts

    Re: GM Creation Code

    Quote Originally Posted by Diumelia View Post
    I don't wanna be rude but I don't really like this: "Credits to Diumelia for SOME pieces of the script.".
    Mk, changed it. But you cant really call this section mostly your code, since it is the mssql syntax, not your syntax.
    Especially the mssql_query(" ") parts.There is no possible way to create this without that syntax as far as i know.
    Code:
    $checkusername = $_POST['character'];
    $query = mssql_query("UPDATE CHARACTER_TBL SET m_chAuthority = 'S' WHERE m_szName = '$checkusername'");
    $result = mssql_fetch_row($query);
    
    if(isset($_POST['submit'])){
        if($_POST['character'] == ""){
            $error = '<font color="red"><b>Please enter a username.</b></font>';
        }
        else{
            mssql_query("UPDATE CHARACTER_TBL SET m_chAuthority = 'S' WHERE m_szName = '$checkusername'");
            $error = '<font color="green"><b>Youhave been succesfully changed to a GM!</b></font>';
        }
    But yes, most of it came from you and i hope you know that i'm not trying to take credit for that.

    I didn't just take your Create Account script, change a few things, and call it my own Create Account script. The GM creation script is a whole different concept.
    Last edited by Cuvvvie; 13-11-09 at 10:35 PM.

  6. #6
    Newbie heyheyloga is offline
    MemberRank
    Jan 2010 Join Date
    8Posts

    Re: GM Creation Code

    how will i make this work i tried creating an accoun but it says account has been ban

  7. #7
    Infraction Banned BGxApixen is offline
    Grand MasterRank
    May 2009 Join Date
    936Posts

    Re: GM Creation Code

    S = Suspend? ;D
    I think P should only be used.

  8. #8
    Cory James Cuvvvie is offline
    Grand MasterRank
    Nov 2009 Join Date
    707Posts

    Re: GM Creation Code

    Quote Originally Posted by apixen View Post
    S = Suspend? ;D
    I think P should only be used.
    S = Admin
    P = High GM
    O = Low GM
    F = Normal player

    This is what i remember, i'm not 100% sure.

    [I am 100% sure that S = admin though]

  9. #9
    Infraction Banned BGxApixen is offline
    Grand MasterRank
    May 2009 Join Date
    936Posts

    Re: GM Creation Code

    Anti-SQL injectable page? If not, then using this is just a risk to be hacked.

  10. #10
    Sorcerer Supreme darkesthour123 is offline
    Member +Rank
    Oct 2009 Join Date
    Sheffield (UK)Location
    270Posts

    Re: GM Creation Code

    Wow. can people get any lazier? Whats wrong with executing a query in mssql express. No need for this. Just a extra flaw in your security.
    Good to give the leachers though that don't even know how to execute a query /ridicule.

  11. #11
    Elite Member wolvesaber is offline
    Member +Rank
    Jan 2010 Join Date
    USLocation
    170Posts

    Re: GM Creation Code

    i didn't have to use scripts to make gm's



Advertisement