Colorful Users Nicknames

Started on the old forum in August 2007 · view the original in the archive · old links redirect here

74 replies · 5,614 views · started 19 years ago · 1 min read

TL;DR · summary of 74 replies
  • alesh needs help implementing code that allows users to choose their own nickname colors, but is having trouble with the database setup.
  • The thread suggests creating a new row in the users table for storing the color preference, but alesh is unsure if this is correct and how to implement it properly.
  • The issue of changing all nicknames to one color instead of individual user preferences remains unresolved.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

14 participants
alexism Developer · 136 posts #61

$nickboja is just a declared variable, you can use it by changing $alexism or $alexism_wants_it_translated_but_its_really_useless or $IDontKnow or $_variable .no need to tranlslate it.you posts are now very very funny

lol rukiya....im newbie lol..haha.. External image (may be gone)

alexism Developer · 136 posts #63

i hv try but the color didnt change......................................................

khan1 Developer · 101 posts #64

in which page to add this script also do i have to add sql table if i use this script does this script allow users to make colorful nicknames

CODE

/////ALL LISTS SCRIPT <<

if($page=="" || $page<=0)$page=1; $num_items = getnumonline(); //changable $items_per_page= 10; $num_pages = ceil($num_items/$items_per_page); if($page>$num_pages)$page= $num_pages; $limit_start = ($page-1)*$items_per_page;

//changable sql $sql = "SELECT a.name,a.perm, b.place, b.userid FROM ibwf_users a INNER JOIN ibwf_online b ON a.id = b.userid GROUP BY 1,2 LIMIT $limit_start, $items_per_page "; echo " "; $items = mysql_query($sql); echo mysql_error(); while ($item = mysql_fetch_array($items)) { if($item[1]=='0') { $tit = ""; }if($item[1]=='1') { $tit = "[M]"; }if($item[1]=='2') { $tit = "[A]"; } if($item[1]=='3') { $tit = "****"; } if($item[1]=='4') { $tit = "[O]"; }

$sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name='$item[0]'")); if($sex[0]=="M"){$usersex = "<img src="../images/male.gif" alt="(M)"/>";} if($sex[0]=="F"){$usersex = "<img src="../images/female.gif" alt="(F)"/>";} if($sex[0]==""){$usersex = "";} if($item[1]>'0') {

$lnk = "$usersex<a href="index.php?action=viewuser&who=$item[3]&sid=$sid">$item[0]$tit</a>"; }else{ $lnk = "$usersex<a href="index.php?action=viewuser&who=$item[3]&sid=$sid">$item[0]$tit</a>"; } echo "$lnk $item[2] "; } echo " "; echo " "; if($page>1) { $ppage = $page-1; echo "<a href="index.php?action=online&page=$ppage&sid=$sid">«Prev</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href="index.php?action=online&page=$npage&sid=$sid">Next»</a>"; } echo " $page/$num_pages"; if($num_pages>2) { echo getjumper($action, $sid,"index"); } echo " ";

alexism Developer · 136 posts #65

i have try in my online list n inbox but the color didnt change in online list..

CODEelse if($action=="online") {

addonline(getuid_sid($sid),"Online List","index.php?action=online"); echo "<head>"; echo "<title>Online List</title>"; echo "<link rel="stylesheet" type="text/css" href="../themes/$theme[0]">"; echo "</head>"; echo "<body>";

//echo "<img src=\"../images/onlinelist.gif\" alt=\"Online List\"/>";

echo popup($sid); //////ALL LISTS SCRIPT <<

if($page=="" || $page<=0)$page=1;
$num_items = getnumonline(); //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if($page>$num_pages)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;

//changable sql
$sql = "SELECT
        a.name,a.perm, b.place, b.userid FROM ibwf_users a
        INNER JOIN ibwf_online b ON a.id = b.userid
        GROUP BY 1,2
        LIMIT $limit_start, $items_per_page
";

echo " "; $items = mysql_query($sql); echo mysql_error(); while ($item = mysql_fetch_array($items)) { if($item[1]=='0') { $tit = ""; }if($item[1]=='1') { $tit = ""; }if($item[1]=='2') { $tit = ""; } if($item[1]=='3') { $tit = ""; } if($item[1]=='4') { $tit = "******"; }

$sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name='$item[0]'")); if($sex[0]=="M"){$usersex = "<img src="../images/male.gif" alt="(M)"/>";} if($sex[0]=="F"){$usersex = "<img src="../images/female.gif" alt="(F)"/>";} if($sex[0]==""){$usersex = "";} if($item[1]>'0') { $nickboja = mysql_fetch_array(mysql_query("SELECT boja FROM ibwf_users WHERE id='$item[2]'")); $lnk = "$usersex<a href="index.php?action=viewuser&who=$item[3]&sid=$sid">$tit$item[0]$tit</a>"; }else{ $nickboja = mysql_fetch_array(mysql_query("SELECT boja FROM ibwf_users WHERE id='$item[2]'")); $lnk = "$usersex<a href="index.php?action=viewuser&who=$item[3]&sid=$sid">$tit$item[0]$tit</a>"; } $cmmsg = (getcmmsg($item[3])); echo "$lnk - $item[2] On9 Msg - $cmmsg ";

}
//echo "

"; //echo " "; if($page>1) { $ppage = $page-1; echo "<a href="index.php?action=online&page=$ppage&sid=$sid">«Prev</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href="index.php?action=online&page=$npage&sid=$sid">Next»</a>"; } echo " $page/$num_pages"; if($num_pages>2) { echo getjumper($action, $sid,"index"); } echo " "; ////// UNTILL HERE >>

echo " "; echo "<a href="index.php?action=cmmsg&sid=$sid">"; echo "Your On9 Msg</a> "; $tmsg = getpmcount(getuid_sid($sid)); $umsg = getunreadpm(getuid_sid($sid)); echo "6<a accesskey="1" href="inbox.php?action=main&sid=$sid">Inbox($umsg/$tmsg)</a> "; echo "7<a accesskey="7" href="lists.php?action=buds&sid=$sid">BuddyList</a> "; echo "8<a accesskey="8" href="index.php?action=chat&sid=$sid">Chatrooms</a> "; echo forumlink($sid,9); echo "0<a accesskey="0" href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt=""/>Home</a>"; echo " "; echo "</body>"; }

SOMEBODY HELP ME.....................

khan1 Developer · 101 posts #66

change this part

$usl = "
<a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\">$iml$unick</a>";

to

<?php
$rnubmer=rand(1,7);*/you can change this to $rnumber=rand(1,10) but theen you must have 10 if conditions below:*/
if($rnubmer==1){
$usercolor="#000000";
}
if($rnubmer==2){
$usercolor="#FFFFFF";
}
if($rnubmer==3){
$usercolor="#FF00FF";
}
if($rnubmer==4){
$usercolor="#0000FF";
}
if($rnubmer==6){
$usercolor="#00FF00";
}
if($rnubmer==7){
$usercolor="#F0FF0F";
}

$usl = "
<font color=\"$usercolor\"><a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\">$iml$unick</a></font>";

}
?>

do you understand how to change it?

i have added thecode in index.php and was getting error so i just added start bracket and close bracket but still its not showing color nicknames

CODE

{ $rnubmer=rand(1,7);

if($rnubmer==1){ $usercolor="#FF0000"; } if($rnubmer==2){ $usercolor="#FFFFFF"; } if($rnubmer==3){ $usercolor="#FF00FF"; } if($rnubmer==4){ $usercolor="#0000FF"; } if($rnubmer==6){ $usercolor="#00FF00"; } if($rnubmer==7){ $usercolor="#F0FF0F"; }

$usl = " <a href="index.php?action=viewuser&sid=$sid&who=$ttext[0]">$iml$unick</a>";

}

alesh Lead · 604 posts #67

Bcuz u missing WHO id!! try 2 ask urself who has tht color..?

eeeeerrr....

khan1 Developer · 101 posts #68

your nick in red, others in personal colors.

like this, but you need to edit,

if ($uid = "ADMIN"){ echo "ADMIN"; } else{ echo [$color_from_database] NORMAL USER [$color_from_database]}

this show red for you and other user color for each member.

this code looks good just need to know is it possible to use this code without database i just need diff colors for admin , mod , head admin please help

rukiya Lead · 569 posts #69
else if($action=="online")
{

  addonline(getuid_sid($sid),"Online List","index.php?action=online");
echo "<head>";
  echo "<title>$sitename</title>";
  echo "</head>";
    echo "<body>";
    if($page=="" || $page<=0)$page=1;
    $num_items = getnumonline(); //changable
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    //changable sql
    $sql = "SELECT
            a.name,a.perm, b.place, b.userid FROM ibwf_users a
            INNER JOIN ibwf_online b ON a.id = b.userid
            GROUP BY 1,2
            LIMIT $limit_start, $items_per_page
    ";
  echo "<p align=\"center\">";
    $items = mysql_query($sql);
    echo mysql_error();
    while ($item = mysql_fetch_array($items))
    {
        if($item[1]=='0')
        {
          $f1 = "";
          $f2 = "";

        }if($item[1]=='1')
        {
          $f1 = "<font color="blue">";
          $f2 = "</font>";
        }if($item[1]=='2')
        {
          $f1 = "<font color="red">";
          $f2 = "</font>";
        } 

$sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name='$item[0]'"));
if($sex[0]=="M"){$usersex = "<img src=\"../images/male.gif\" alt=\"(M)\"/>";}
if($sex[0]=="F"){$usersex = "<img src=\"../images/female.gif\" alt=\"(F)\"/>";}
if($sex[0]==""){$usersex = "";}

      $lnk = "$usersex<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$item[0]</a>";
      echo "$f1 $lnk$ $f2 - $item[2] 
";
    }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=online&page=$ppage&sid=$sid\">«Prev</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=online&page=$npage&sid=$sid\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
    echo getjumper($action, $sid,"index");
    }
    echo "</p>";
  
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  echo "</body>";
}

here is the code that you want,its for the online list only,if you want to show colored nick inn other places,use this idea and edit there and stop being so crazy khan1

alesh Lead · 604 posts #75

Feelin lil lazy arent u? Read this topic nd ull figure it out.... Its all writen down...

eeeeerrr....

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close