Name Change Script

Page 1 of 2 12 LastLast
Results 1 to 25 of 30
  1. #1
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Name Change Script

    Anybody has hands on a name-changer script for in-game characters name? That lets you log in, then select your character and new name, but leaving a record ANYWHERE of the character's previous username? :o


  2. #2
    Account Upgraded | Title Enabled! randy1234 is offline
    MemberRank
    Mar 2009 Join Date
    SingaporeLocation
    1,196Posts

    Re: Name Change Script

    Code it yourslef or use the CP its release XD

  3. #3

    Re: Name Change Script

    I'll give a brief description on what to do.

    Do an mssql_connect and mssql_select_db with your website.
    When a user fills in the form, antisql the $_POST values and verify it with mssql_query.
    Use a drop down box to request all characters of the account using mssql_query.
    Use a text box for new name, and antisql the $_POST value.
    Create a new column in your DB called OldName.
    Store the value of the old name to OldName using mssql_query.
    Update the value of Name using mssql_query.

    That's all.

    You're done.

  4. #4
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    Quote Originally Posted by Linear88 View Post
    I'll give a brief description on what to do.

    Do an mssql_connect and mssql_select_db with your website.
    When a user fills in the form, antisql the $_POST values and verify it with mssql_query.
    Use a drop down box to request all characters of the account using mssql_query.
    Use a text box for new name, and antisql the $_POST value.
    Create a new column in your DB called OldName.
    Store the value of the old name to OldName using mssql_query.
    Update the value of Name using mssql_query.

    That's all.

    You're done.
    Hey, i understood everything your'e saying, but i'm not a PHP coder, which means to say I don't know how to put it into a code, if it's not too much trouble, do you mind helping me? If your'e busy then that;s okay!

  5. #5
    Ā  Phoenix is offline
    ModeratorRank
    Mar 2009 Join Date
    6,890Posts

    Re: Name Change Script

    Yeah I'd love to have it too.


    700th Post :D

  6. #6
    Account Upgraded | Title Enabled! pavan33 is offline
    MemberRank
    Oct 2008 Join Date
    RageZone xDLocation
    289Posts

    Re: Name Change Script

    lol @ phoenix.. btw congooo
    @# topic: even i want that :|

  7. #7
    mikethemak is offline
    MemberRank
    Apr 2008 Join Date
    Ragezone Spam SectionLocation
    1,019Posts

    Re: Name Change Script

    It's pretty easy to make...you need to know little to know php at all. Even i could make this o.o. Just use cobraPanel as a template, and edit the scripts it uses.

  8. #8
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    Quote Originally Posted by mikethemak View Post
    Even i could make this o.o.
    So then I supposed you'd make one for us?

  9. #9
    Account Upgraded | Title Enabled! alfredao is offline
    MemberRank
    Jan 2008 Join Date
    Coronel FabriciLocation
    705Posts

    Re: Name Change Script

    I coded a simple page for you.

    PHP Code:
    <?

    function sqlseguro($sql)
    {
        
    $sql str_replace("'","''",$sql);
        
    $sql strip_tags($sql);
        
    $sql addslashes($sql);
        return 
    $sql;
    }

        
    $codigo mssql_query("SELECT * FROM Login(nolock) WHERE AID = {$_SESSION['AID']}");

        if( isset(
    $_POST['mudarnome']) )
        {
            
    $cid sqlseguro($_POST['cid']);
            
    $nnome sqlseguro($_POST['nnome']);


            
    $query mssql_query("SELECT Name FROM Character WHERE Name = '$nnome'");
            if( 
    mssql_num_rows($query) != )
            {
                echo 
    "<script> alert('A Character with this name already exists')</script>";
            die();
            }
            else
            {
                
    mssql_query("UPDATE Character SET Name = '$nnome' WHERE CID = '$cid'");
                echo 
    "<script> alert('Name changed succesfully')</script>";
            die();
            }

        }


    ?>

    <form method="post" action="<?=$_SERVER['PHP_SELF']?>">
    <b>Change: </b><select size="1" name="cid">
        <?

        $codigo1 
    mssql_query("SELECT * FROM Character(nolock) WHERE AID = {$_SESSION['AID']} AND CharNum != '-1'");

        while( 
    $char mssql_fetch_assoc($codigo1) )
        {
        
    ?>
            <option value="<?=$char['CID']?>"><?=$char['Name']?></option>
        <?
        
    }
        
    ?>
    </select>
    <b> To: </b>
    <input type="text" name="nnome" size="20" maxlength="12">
    <input type="submit" name="mudarnome" value="Change Name">
    </form>

  10. #10
    Account Upgraded | Title Enabled! ManyBlackPpl is offline
    MemberRank
    Mar 2009 Join Date
    CanadaLocation
    336Posts

    Re: Name Change Script

    Quote Originally Posted by alfredao View Post
    I coded a simple page for you.

    PHP Code:
    <?

    function sqlseguro($sql)
    {
        
    $sql str_replace("'","''",$sql);
        
    $sql strip_tags($sql);
        
    $sql addslashes($sql);
        return 
    $sql;
    }

        
    $codigo mssql_query("SELECT * FROM Login(nolock) WHERE AID = {$_SESSION['AID']}");

        if( isset(
    $_POST['mudarnome']) )
        {
            
    $cid sqlseguro($_POST['cid']);
            
    $nnome sqlseguro($_POST['nnome']);


            
    $query mssql_query("SELECT Name FROM Character WHERE Name = '$nnome'");
            if( 
    mssql_num_rows($query) != )
            {
                echo 
    "<script> alert('A Character with this name already exists')</script>";
            die();
            }
            else
            {
                
    mssql_query("UPDATE Character SET Name = '$nnome' WHERE CID = '$cid'");
                echo 
    "<script> alert('Name changed succesfully')</script>";
            die();
            }

        }


    ?>

    <form method="post" action="<?=$_SERVER['PHP_SELF']?>">
    <b>Change: </b><select size="1" name="cid">
        <?

        $codigo1 
    mssql_query("SELECT * FROM Character(nolock) WHERE AID = {$_SESSION['AID']} AND CharNum != '-1'");

        while( 
    $char mssql_fetch_assoc($codigo1) )
        {
        
    ?>
            <option value="<?=$char['CID']?>"><?=$char['Name']?></option>
        <?
        
    }
        
    ?>
    </select>
    <b> To: </b>
    <input type="text" name="nnome" size="20" maxlength="12">
    <input type="submit" name="mudarnome" value="Change Name">
    </form>
    Nice script. It looks good in my opinion. I think there are a few other things you could add for your antisql thing, but who really cares. At least u made it :P. Btw quick question: Aren't we gonna be needing to translate the nnome and mudarnome into english, or is it supposed to be like that?

  11. #11
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    Quote Originally Posted by alfredao View Post
    I coded a simple page for you.

    PHP Code:
    <?

    function sqlseguro($sql)
    {
        
    $sql str_replace("'","''",$sql);
        
    $sql strip_tags($sql);
        
    $sql addslashes($sql);
        return 
    $sql;
    }

        
    $codigo mssql_query("SELECT * FROM Login(nolock) WHERE AID = {$_SESSION['AID']}");

        if( isset(
    $_POST['mudarnome']) )
        {
            
    $cid sqlseguro($_POST['cid']);
            
    $nnome sqlseguro($_POST['nnome']);


            
    $query mssql_query("SELECT Name FROM Character WHERE Name = '$nnome'");
            if( 
    mssql_num_rows($query) != )
            {
                echo 
    "<script> alert('A Character with this name already exists')</script>";
            die();
            }
            else
            {
                
    mssql_query("UPDATE Character SET Name = '$nnome' WHERE CID = '$cid'");
                echo 
    "<script> alert('Name changed succesfully')</script>";
            die();
            }

        }


    ?>

    <form method="post" action="<?=$_SERVER['PHP_SELF']?>">
    <b>Change: </b><select size="1" name="cid">
        <?

        $codigo1 
    mssql_query("SELECT * FROM Character(nolock) WHERE AID = {$_SESSION['AID']} AND CharNum != '-1'");

        while( 
    $char mssql_fetch_assoc($codigo1) )
        {
        
    ?>
            <option value="<?=$char['CID']?>"><?=$char['Name']?></option>
        <?
        
    }
        
    ?>
    </select>
    <b> To: </b>
    <input type="text" name="nnome" size="20" maxlength="12">
    <input type="submit" name="mudarnome" value="Change Name">
    </form>
    Thanks for your help, but it doesn't work :o

  12. #12
    Account Upgraded | Title Enabled! ManyBlackPpl is offline
    MemberRank
    Mar 2009 Join Date
    CanadaLocation
    336Posts

    Re: Name Change Script

    try changing
    Code:
    echo "<script> alert('A Character with this name already exists')</script>
    to:

    Code:
    echo "A Character with this name already exists"
    (don't forget the semicolon after the quotation mark).

  13. #13
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    now this is all it shows on my page :
    alert('Name changed succesfully')"; die(); } } ?>
    Change: To:

    theres a dropdown menu next to change but i can't select anything, and if i type something into "to" and press enter, i get this:

    Code:
    Forbidden
    
    You don't have permission to access /< on this server.

  14. #14

    Re: Name Change Script

    @alfredao: There are numerous amounts of bugs that you have in your script. Anyway, I won't fix them, since it is just a regular page.

    Here's the fixed code, without the errors you mentioned earlier.

    changecharname.php
    PHP Code:
    <?php
    // <!--  -->
    // Copyright Linear88 for the modifications. Alfredao for the original code.
    // <!--  -->

    function antisql2($sql)
    {
        
    $sql str_replace("'","''",$sql);
        
    $sql strip_tags($sql);
        
    $sql addslashes($sql);
        return 
    $sql;
    }

        
    $codigo mssql_query("SELECT * FROM Login(nolock) WHERE AID = " $_SESSION['AID'] . "");

        if( isset(
    $_POST['changename']) )
        {    
            
    $cid antisql2($_POST['cid']);
            
    $charname antisql2($_POST['charname']);

            
    $query mssql_query("SELECT Name FROM Character WHERE Name = '$charname'");
            if( 
    mssql_num_rows($query) != )
            {
                echo 
    "<script>alert('A Character with this name already exists!');</script>";
            die();
            }
            else
            {
                
    mssql_query("UPDATE Character SET Name = '$charname' WHERE CID = '$cid'");
                echo 
    "<script>alert('Name changed successfully!');</script>";
            die();
            }

        }


    ?>

    <form method="post" action="<?php=$_SERVER['PHP_SELF']?>">
    <b>Change: </b><select size="1" name="cid">
        <?php

        $code1 
    mssql_query("SELECT * FROM Character(nolock) WHERE AID = " $_SESSION['AID'] . " AND CharNum != '-1'");

        while( 
    $char mssql_fetch_assoc($code1) )
        {
        
    ?>
            <option value="<?php=$char['CID']?>"><?php=$char['Name']?></option>
        <?php
        
    }
        
    ?>
    </select>
    <b> To: </b>
    <input type="text" name="charname" size="20" maxlength="12">
    <input type="submit" name="changename" value="Change Name">
    </form>
    Enjoy.
    Last edited by Linear88; 18-10-09 at 05:05 PM.

  15. #15
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    Thanks linear.
    offtopic: who are you :o

  16. #16
    Account Upgraded | Title Enabled! ManyBlackPpl is offline
    MemberRank
    Mar 2009 Join Date
    CanadaLocation
    336Posts

    Re: Name Change Script

    who does he look like? He's Linear88 O_o. Lol, I feel stupid for not being able to notice the bugs, even though i have little to no experience coding webs, since I said it looks good. Ah but w/e, I guess we learn by making mistakes first.

  17. #17
    Alpha Member gregon13 is offline
    MemberRank
    Nov 2007 Join Date
    CanadaLocation
    1,945Posts

    Re: Name Change Script

    Parse error: syntax error, unexpected '=' in D:\xampp\htdocs\Gunz\os\os_changename.php on line 39

  18. #18

    Re: Name Change Script

    Thanks for informing me, fixed it.

    PHP Code:
    <?php
    // <!--  -->
    // Copyright Linear88 for the modifications. Alfredao for the original code.
    // <!--  -->

    function antisql2($sql)
    {
        
    $sql str_replace("'","''",$sql);
        
    $sql strip_tags($sql);
        
    $sql addslashes($sql);
        return 
    $sql;
    }

        
    $code mssql_query("SELECT * FROM Login(nolock) WHERE AID = " $_SESSION['AID'] . "");

        if( isset(
    $_POST['changename']) )
        {    
            
    $cid antisql2($_POST['cid']);
            
    $charname antisql2($_POST['charname']);

            
    $query mssql_query("SELECT Name FROM Character WHERE Name = '$charname'");
            if( 
    mssql_num_rows($query) != )
            {
                echo 
    "<script>alert('A Character with this name already exists!');</script>";
            die();
            }
            else
            {
                
    mssql_query("UPDATE Character SET Name = '$charname' WHERE CID = '$cid'");
                echo 
    "<script>alert('Name changed successfully!');</script>";
            die();
            }

        }


    ?>

    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <b>Change: </b><select size="1" name="cid">
        <?php

        $code1 
    mssql_query("SELECT * FROM Character(nolock) WHERE AID = " $_SESSION['AID'] . " AND CharNum != '-1'");

        while( 
    $char mssql_fetch_assoc($code1) )
        {
        
    ?>
            <option value="<?php echo $char['CID']; ?>"><?php echo $char['Name']; ?></option>
        <?php
        
    }
        
    ?>
    </select>
    <b> To: </b>
    <input type="text" name="charname" size="20" maxlength="12">
    <input type="submit" name="changename" value="Change Name">
    </form>
    Click Thanks if it worked.
    Last edited by Linear88; 01-11-09 at 04:07 PM.

  19. #19
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    Um Linear, it turns up as a blank white page :o

  20. #20

    Re: Name Change Script

    A fix again, this time, it was tested.

    PHP Code:
    <?php
    // <!--  -->
    // Copyright Linear88 for the modifications. Alfredao for the original code.
    // <!--  -->
    mssql_connect("PCNAME\SQLEXPRESS","sa","YourPasswordHere");
    mssql_select_db("GunzDB");

    function 
    antisql2($sql)
    {
        
    $sql str_replace("'","''",$sql);
        
    $sql strip_tags($sql);
        
    $sql addslashes($sql);
        return 
    $sql;
    }
        
    $code2 $_SESSION['AID'];
        
    $code mssql_query("SELECT * FROM Login(nolock) WHERE AID = '" $_SESSION['AID'] . "'");

        if( isset(
    $_POST['changename']) )
        {    
            
    $cid antisql2($_POST['cid']);
            
    $charname antisql2($_POST['charname']);

            
    $query mssql_query("SELECT Name FROM Character WHERE Name = '$charname'");
            if( 
    mssql_num_rows($query) != )
            {
                echo 
    "<script>alert('A Character with this name already exists!');</script>";
            die();
            }
            else
            {
                
    mssql_query("UPDATE Character SET Name = '$charname' WHERE CID = '$cid'");
                echo 
    "<script>alert('Name changed successfully!');</script>";
            die();
            }

        }


    ?>

    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <b>Change: </b><select size="1" name="cid">
        <?php

        $code1 
    mssql_query("SELECT * FROM Character(nolock) WHERE AID = '" $_SESSION['AID'] . "' AND CharNum != '-1'");

        while( 
    $char mssql_fetch_assoc($code1) )
        {
        
    ?>
            <option value="<?php echo $char['CID']; ?>"><?php echo $char['Name']; ?></option>
        <?php
        
    }
        
    ?>
    </select>
    <b> To: </b>
    <input type="text" name="charname" size="20" maxlength="12">
    <input type="submit" name="changename" value="Change Name">
    </form>

  21. #21
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    Still just a blank page man :o, im on Wamp.

  22. #22
    Account Upgraded | Title Enabled! ManyBlackPpl is offline
    MemberRank
    Mar 2009 Join Date
    CanadaLocation
    336Posts

    Re: Name Change Script

    the script works fine. The only thing you need to include with that is a login script so that it can read the characters (unless I'm mistaken). Don't use wamp, it sucks, use appserv.

  23. #23
    Alpha Member gregon13 is offline
    MemberRank
    Nov 2007 Join Date
    CanadaLocation
    1,945Posts

    Re: Name Change Script

    I use Xampp and it is added to my site (final revolution by ~DN modified by me) and it works great

  24. #24
    Account Upgraded | Title Enabled! lxchadxl is offline
    MemberRank
    Nov 2008 Join Date
    Hai 2 u, i r Chad.Location
    442Posts

    Re: Name Change Script

    I am already using AppServ but it stills show as a blank page :x

  25. #25
    Account Upgraded | Title Enabled! razacore is offline
    MemberRank
    Nov 2008 Join Date
    303Posts

    Re: Name Change Script

    blank page, fix please? O_O



Page 1 of 2 12 LastLast

Advertisement