Jump to content
MakeWebGames

name change preferences help


Nicholas

Recommended Posts

hi im wondering... does anyone know how to make it so it costs say $1,000,000 to change the players name?

 

} 
function name_change() 
{ 
global $ir,$c,$userid,$h; 
print "<h3><font color=white>Name Change</h3> 
<font color=white>Please note that you still use the same name to login, this procedure simply changes the name that is displayed. <form action='preferences.php?action=namechange2' method='post'> 
New Name: <input type='text' name='newname' />

<input type='submit' value='Change Name' /></form>"; 
} 
function do_name_change() 
{ 
global $db,$ir,$c,$userid,$h; 
if($_POST['newname'] == "") 
{ 
print "<font color=white>You did not enter a new name.

[url='preferences.php?action=namechange']> <font color=white>Back[/url]"; 
} 
else 
{ 
$_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']); 
$db->query("UPDATE users SET username='{$_POST['newname']}' WHERE userid=$userid"); 
print "<font color=white>Username changed!"; 
}

 

thats the function for the change username, can anyone edit it so it costs you 1,000,000 to change your name please? it be very greatful.

i have acturally tried searching to see if its already been posted but i cant find it.

Link to comment
Share on other sites

Try this, Also remember to close your colour tags ;) basic HTML and in the next version of HTML youll need to end your tags

 

<?php //pwitty colours come alive
function name_change() 
{ 
global $ir,$c,$userid,$h;
$cost1 ='1000000'; // 1 million
$cost = money_formatter($cost);
print "<h3><font color=white>Name Change</h3>
Please note that you still use the same name to login, this procedure simply changes the name that is displayed.

It will cost you ".$cost." to change your name.</font>

<form action='preferences.php?action=namechange2' method='post'> 
font color=whiteNew Name</font>: <input type='text' name='newname' />

<input type='submit' value='Change Name' /></form>"; 
} 
function do_name_change() 
{ 
global $db,$ir,$c,$userid,$h; 
$cost1 ='1000000'; // 1 million
$cost = money_formatter($cost);
if($_POST['newname'] == "") 
{ 
print "<font color=white>You did not enter a new name.</font>

[url='preferences.php?action=namechange']> <font color=white>Back</font>[/url]"; 
} 
if($ir['money'] < $cost1)
{
echo'<font color=white>You do not have enough money to change your name, you need '.$cost.' to change it </font>
';
}
else 
{ 
$_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']); 
$db->query("UPDATE users SET username='{$_POST['newname']}', money=money-$cost1 WHERE userid=$userid"); 
print "<font color=white>Username changed!</font>"; 
}
Link to comment
Share on other sites

  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...