Nick color lavalair script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Nick color lavalair script

    Hello friends, first sorry for the
    bad english, but I am from
    Brazil and I do not speak
    English very well. What
    prompted me to come to this
    forum, is that I am creating a
    wap site lavalair style, but do
    not know how to differentiate
    the color of nicknames of the
    users, wanted to differentiate,
    admin, moderator, male, female
    by the color of the nick. Would
    you like an orientation, thanks
    to all.

    #2
    PHP Code:
    list($name,$perm,sex) = mysql_fetch_array(mysql_query("SELECT name,  perm, sex FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
    if(
    $sex == "F"){
    if(
    $perm == 4)
      
    $color "pink";
    else if(
    $perm == 3)
      
    $color "red";
    else .....
    }else{
    if(
    $perm == 4)
      
    $color "blue";
    else if(
    $perm == 3)
      
    $color "black";
    else .....
    }
    $name "<font color=\"$color\">$name</font>"
    something like that ...u can extend ...
    <?php unlink('World/Europe/Romania.country'); ?>

    Comment


      #3
      funny it is for n0ob c0ders lol..

      Comment


        #4
        Like u reymon07? I have diffrent one.. Users can costumize their nick color just like changing email, location, shout out, etc.. But nick color will appear as Default .a link color when it is not set/costumized, not like other site that nick color will appear as BLACK if not set. Because <font color="(blank)">nick</font> will appear as black right?
        Last edited by warchief; 06.12.10, 07:43.

        Comment


          #5
          code like this

          SUBZERO

          I can do this but i do say going to be long code and costly
          Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
          Visit: WapMasterz Coming Back Soon!
          _______
          SCRIPTS FOR SALE BY SUBZERO
          Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
          FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
          _______
          Info & Tips
          php.net
          w3schools.com

          Comment


            #6
            subzero alweiz want money as payment for a little easy code.. Haha

            Comment


              #7
              I don't see any problem with coders asking compensation for ANY coding, because stuff that they share for free, are usually made like someone else did the coding
              Why cry for a soul set free?

              Comment


                #8
                PHP Code:
                <?PHP

                $n 
                'Test';
                $new '';
                $i 0;
                $colors = array('red','blue','pink','purple','orange'); // '','','' ....
                $len strlen($n);
                while(
                $i<=$len-1){
                $new .= '<font color="'.$colors[$i].'">'.$n[$i].'</font>';
                $i++;
                }
                echo 
                $new;

                ?>
                2 minutes ... and in array put a no. of colors eq with the max name range:P

                later edit for randomize the colors use shuffle($colors); before while loop
                Last edited by i0nutzxp; 06.12.10, 08:48.
                <?php unlink('World/Europe/Romania.country'); ?>

                Comment


                  #9
                  <font> tag? Seriously?
                  Btw you need to factor that database storage of specific user color choices and also edit your entire code to display colored usernames wherever usernames appear.
                  Perfection comes at a cost



                  I accept liberty!

                  Comment


                    #10
                    For the lava use this.
                    add a new varchar line named colcode in ibwf_users :P
                    PHP Code:
                    $uid getuid_sid($sid);
                    list(
                    $nick) = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
                    $i 0;
                    $len strlen($nick);
                    echo 
                    "<form action=\"set_col.php?action=colproc&amp;sid=$sid\" method=\"post\">";
                    echo 
                    "<small>Make ur nick multicolored</small><br/>";
                    while(
                    $i<=$len-1){
                    echo 
                    "Word #".($i+1)." <input name=\"w$i\" maxlength=\"100\" size=\"3\"/><br/>";
                    $i++;
                    }
                    echo 
                    "<input type=\"submit\" value=\"Submit\"/>";
                    echo 
                    "</form>"
                    PHP Code:
                    list($nick) = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
                    $i 0;
                    $len strlen($nick);
                    $msg '';
                    while(
                    $i<=$len-1){
                    $msg .= ''.$_POST['w'.$i].'-';
                    $i++;
                    }
                    $msg .= '1';
                    $res mysql_query("UPDATE ibwf_users SET colcode='".mysql_real_escape_string($msg)."' WHERE id='".$uid."'");
                    if(
                    $res) echo " that\'s so good.."
                    and for core ..
                    PHP Code:
                    function getnick_uid($uid)
                    {
                      
                    $q mysql_fetch_assoc(mysql_query("SELECT name, colcode FROM ibwf_users WHERE id='".$uid."'"));
                      return 
                    colorize($q['name'],$q['colcode']);
                    }
                    function 
                    colorize($n,$code){
                    $new '';
                    $i 0;
                    $colors explode('-',$code);
                    $len strlen($n);
                    #shuffle($colors);
                    while($i<=$len-1){
                    $new .= '<font color="'.$colors[$i].'">'.$n[$i].'</font>';
                    $i++;
                    }
                    return 
                    $new;

                    PS: make urself the code valid for xhtml validation...
                    PS2: restrict user max len to max 10 chars ...
                    Last edited by i0nutzxp; 07.12.10, 08:58.
                    <?php unlink('World/Europe/Romania.country'); ?>

                    Comment


                      #11
                      colcode varchar(60) NULL
                      //
                      and in action where u change the nick add mysql_query("UPDATE ibwf_users SET colcode='' WHERE id='".$who."'); :P
                      <?php unlink('World/Europe/Romania.country'); ?>

                      Comment


                        #12
                        username_color function

                        The scripts above have one flaw. either username or colors list must be limited.
                        this is not successful in all cases and might cause problems.
                        This function should be a panacea to all the problems.
                        if you notice any bugs or errors, please post it.

                        PHP Code:
                        <?php
                        //list($usercolors)= fetch from the database table
                        //we assume user is allowed to add colors in to the database separated by commas
                        //this can be any method that allows us to put it into an array
                        //it can even be a serialized array put into the db

                        $usercolors"red,blue,yellow,green,violet,lime";//assumed selection of course
                        $username="frostymarvelous";//obviously, this should be db retrieval or other convenient method

                        $colorsexplode(",",$usercolors);//put colors into an array

                        username_colors($username$colors);

                        //so this funtion takes the username and array of colours and return a coloured username

                        function username_colors($username$colors)//username is a string. colors is an array
                        {
                        $unlenstrlen($username);
                        $colsizecount($colors);

                        if (
                        $unlen $colsize)//this is to make sure that the colors are not more than the username chars
                        {
                        $diff$colsize$unlen;//find the difference between the two

                        while($diff != 0)
                        {
                        unset(
                        $colors[$diff]);//remove excess values
                        $diff --;
                        }
                        $colsizecount($colors);
                        }

                        $intervalceil($unlen $colsize);//this will allow us to make sure all chars have colours

                        $start 0;
                        $newusername"";

                        foreach(
                        $colors as $k => $v)//go through all colours
                        {
                        $next$start $interval;
                        $section substr($username$start$interval);//get sections of username to colour

                        $newusername .=  "<span style=\"color:$v;\">$section</span>";//replace with colours

                        $start  += $interval;
                        }

                        echo 
                        $newusername;//do something with result. echo, return or whatever you wish
                        }
                        ?>
                        Last edited by frostymarvelous; 07.12.10, 18:51.
                        Perfection comes at a cost



                        I accept liberty!

                        Comment

                        Working...
                        X