Jump to content
MakeWebGames

Name Colour Change


chromed

Recommended Posts

Does anybody know how to change the color of a users name without going to edit user then typing in their name box

<font color=FFFFFF>Chromed</font> ect.

This would be ok but when you click on this persons name to mail them it comes up with that code instead of just the coloured name.

Any help would be appreciated.

Link to comment
Share on other sites

Re: Name Colour Change

killah just basically said..

But here it is again..

 

$ID = 1; // User & 1 = blue, 2 = green, 3 = yellow, 4 = brown.

if ($userid == $ID) {

$color = array('1' => 'blue', '2' => 'green', '3' => 'yellow', '4' => 'brown');

echo '<font color="'.$color[$ID].'">';

}

 

Add before username is displayed, then after </font>

Link to comment
Share on other sites

Re: Name Colour Change

Like i had explained on msn...

Here is an example for people that want to change there own color name.

SQL:

alter table users add name_color varchar(255) not null default 'black';

 

Preferences: (TOP)

case 'name_color': font_color(); break;

Bottom:

function font_color()
{
  global $ir,$h;
  if($_POST['font'])
  {
         $font = mysql_real_escape_string($_POST['font']));
         $game_color = "Game Link Color's ETC EX: black";
         if($font == $game_color)
         {
                echo 'The game color is '.$game_color.' and you may not use it.';
                $h->endpage();
                exit;
         }
         mysql_query("UPDATE users SET name_color='".$font."' WHERE userid=".$ir['userid']) or die(mysql_error());
         echo 'Your name color has been changed to '.$font;
         $h->endpage();
         exit;
   }
   echo '
   <form action="?action=name_color" method="post">
        Color: <input type="text" name="font" value="'.$ir['name_color'].'">

                 <input type="submit" value="Change">
   </form>';
}

 

Then of course the link:

Change name color

 

Now to display it.

 

<font color='".$ir['name_color']."'>".$ir['userid']."</font>

 

So for example i use a green:

<font color='green'>killah</font>

Link to comment
Share on other sites

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...