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!

[Release] PHP Name Changer Script

Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
This was in response to ashur2good's thread - http://forum.ragezone.com/f425/request-php-name-changer-515069/

I think I have all the checks I need in it, it checks if -

The name is already taken
If the name contains illegal characters like !@#$%^&*(
If the name is over 4 characters long
If you have enough money
If the character exists on the account
If the info for the account is right

Basically all that crap.

I made this based off of my PHP NX Cash seller so some people might realize the coding is similar.

So the updates I did on the script from the PHP NX one is -

Got rid of that dumb message that said "Invalid name or password" before you even typed anything
Made the error defining alot better
Made it a bit cleaner I guess


Anywho, here is the script for it, I tested numerous times but if you happen to find a bug, please tell me and I will try to fix it.

PHP:
<?php
// process the script only if the form has been submitted
if (array_key_exists('reset', $_POST)) {
// start the session
include('config.php');
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$username = mysql_real_escape_string($username);
$char = trim($_POST['char']);
$name = trim($_POST['name']);
$result = mysql_query("SELECT meso, accountid FROM characters WHERE name = '$char' LIMIT 1");
list($meso, $accountid) = mysql_fetch_row($result);

$result = mysql_query("SELECT id, password, salt FROM accounts WHERE name = '$username' LIMIT 1");
list($id, $realpass, $salt) = mysql_fetch_row($result);

$sql = "SELECT * FROM accounts WHERE name = '$username'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

$namecheck = mysql_query("SELECT id FROM characters WHERE name=$name;");

if(mysql_num_rows(mysql_query("SELECT id FROM characters WHERE name = '$name'")))
        echo "The name you have chosen is already taken. Please choose another one"; 
    else
if (ereg('[^A-Za-z0-9]', $name))
        echo "The name you have chosen needs to only have letters or numbers";
    else
if (strlen($name) < 4)
    echo "The name you have chosen is to short. Please make sure it is over 4 characters long.";
else
if($realpass == hash('sha512',$password.$salt) && $accountid == $id && $meso >= 100000000 && $loggedin < 1){
mysql_query("UPDATE characters SET meso = meso - 100000000 WHERE name = '$char' LIMIT 1");
mysql_query("UPDATE characters SET name = '$name' WHERE name = '$char' LIMIT 1");
echo "You have payed 100 mil to change $char's name to $name!";
}    else if($meso < 100000000)
        echo "You do not have enough money";
    else if($loggedin = 0)
        echo "Please log out of your character";
    else
echo "There was an error changing your name. You have provided the wrong information or the character you have listed is not on the account you listed."; 
}
?>
<!-- start content -->
<div class='welcome'><br>Welcome to the Name changer! 100,000,000 mesos to change your name. Credits to Spyker710 of RageZone</div>
<div align="center">
<div class="display">
<?php
if (isset($message)) {
echo '<ul>';
foreach ($message as $item) {
echo "<li>$item</li>";
}
echo '</ul>';
}
//c
?>
</div>
<form id="form1" name="form1" method="post" action="">
<table cellspacing="0" cellpadding="5" width="100%">
<tr>
<td width="50%" align="right" class="list">Username :</td>
<td class="list"><input id="username" type="text" name="username" maxlength="12"></td>
</tr>
<tr>
<td width="50%" align="right" class="list">Password :</td>
<td class="list"><input id="password" type="password" name="password" maxlength="20" /></td>
</tr>
<tr>
<td width="50%" align="right" class="list">Character's Current Name :</td>
<td class="list"><input id="char" type="text" name="char" maxlength="12"></td>
</tr>
<td width="50%" align="right" class="list">Character's New Name :</td>
<td class="list"><input id="name" type="text" name="name" maxlength="12"></td>
</tr>
<tr>
<td align="right" colspan="2"><input id="reset" name="reset" type="submit" value="Change Name"/></td>
</tr>
</table>
</form>
</div>
<!-- end content -->
Please leave the credits in there, because of my last script I said you didn't need to put the credits in, people just stole it and released it themselves.

If you do try to steal and release, I will know if it's mine. I DO recognize my own coding...


For the config.php basically all you need is something in it to define your database info.

Hm, this was my first release since I came back.

Anyways, enjoy the script.
 
Junior Spellweaver
Joined
Aug 16, 2008
Messages
159
Reaction score
0
Good job on this one.

It's not that hard to make, but it's good for people who can't do it.
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
Yeah, it was a little project for me. I stopped PHP coding for a few months ago so I wanted to see how much I remember. Surprisingly I didn't remember much.
 
Last edited:
Visit my hompage
Loyal Member
Joined
May 2, 2008
Messages
1,017
Reaction score
2
wasnt this already released? but good job
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
Not sure, but not this exact script, I just started it yesterday, and thanks.
 
Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,534
Reaction score
448
Visit my hompage
Loyal Member
Joined
May 2, 2008
Messages
1,017
Reaction score
2
Hmm im gonna try it out to see if it works
 
Experienced Elementalist
Loyal Member
Joined
May 26, 2008
Messages
267
Reaction score
1
Good job I liked your other thread in dev section lol
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
lol cool this is like "SO AWESOME"
i can now change my name to GMofMapleSomthing.
Or SuperAdmin. or perhaps, ThisServerFails :)
Very nice work =P hahahahahaha

EDIT: yes there is one released, old and poop as hell.
http://forum.ragezone.com/f427/release-character-name-changer-php-script-requested-422061/
Although Antv later replied with a better one...
http://forum.ragezone.com/f427/rele...nger-php-script-requested-422061/#post3614980

Antv's script looks ALOT like mine, guess he also based it off my NX script?
 
Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,534
Reaction score
448
i cant be assed what people based it off =.="
And no, its not really similiar to yours. PHP looks the same... i mean cmon you can't replace echo with something else unless its for like a different purpose, perhaps printf?
You can't really own the PHP script especially since this is like a single file o.o
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
i cant be assed what people based it off =.="
And no, its not really similiar to yours. PHP looks the same... i mean cmon you can't replace echo with something else unless its for like a different purpose, perhaps printf?
You can't really own the PHP script especially since this is like a single file o.o

True, well, I like my script that I made :p
 
Master Summoner
Loyal Member
Joined
Sep 25, 2008
Messages
501
Reaction score
0
good job nicely done ill tell ashur

EDIT : is this the line that lets say if they tried to put thier name as [GM] imafag it shows up
echo "The name you have chosen needs to only have letters or numbers";

and this checks it ?
(ereg('[^A-Za-z0-9]', $name))
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
good job nicely done ill tell ashur

EDIT : is this the line that lets say if they tried to put thier name as [GM] imafag it shows up
echo "The name you have chosen needs to only have letters or numbers";

and this checks it ?
(ereg('[^A-Za-z0-9]', $name))

Yes that's the line.

So it only allows A-Z, a-z and 0-9.

If you want, I can try adding a filter to filter out names that include

"GM" or "Test" or something
 
Master Summoner
Loyal Member
Joined
Sep 25, 2008
Messages
501
Reaction score
0
lol dw ashur wont want it his old server had the command and some people did that LOL
 
Legendary Battlemage
Loyal Member
Joined
Sep 28, 2008
Messages
600
Reaction score
291
but the name in the guild wont change
 
Back
Top