Jump to content

Ranks certain privileges and font color help needed


cobusbo

Recommended Posts

I'm currently making use of arrays to modify my font colors in my chat script for example

$admin = array('m70141099002' , 'Debater', '27765238453', '');
$moderator = array('m52626156002', 'm57010835002' , 'm50079252002', '27723289551', 'm38565659002');


$testip = $_SERVER["HTTP_X_MXIT_USERID_R"];




if(!isset($name))
{
	$name = "Debater";
}


if(!isset($testip))
{
	$testip = "Debater";
}




////////////////This is for Admin Permission Users//////////////
if (in_array($testip, $admin))
{
if (in_array($list['StringyChat_ip'], $admin))
{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' . '</span>'. '<span style="color:red">' . '<b>'   . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
elseif (in_array($list['StringyChat_ip'], $moderator))

{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:green">' .  '<b>' . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
elseif (in_array($list['StringyChat_ip'], $pc))

{
   print '<span style="color:gold">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:purple">' .  '<b>' . $list['StringyChat_name'] . '</b>' . '</span>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
elseif (in_array($list['StringyChat_ip'], $helper))

{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:blue">' .  '<b>' . $list['StringyChat_name'] . '</span>' . '<span style="color:green">' . ' ' . '[H]' . '</span>' . '</b>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}

elseif (in_array($list['StringyChat_ip'], $globalhelper))

{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:blue">' .  '<b>' . $list['StringyChat_name'] . '</span>' . '<span style="color:green">' . ' ' . '[G.H]' . '</span>' . '</b>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
else
{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:#0365B8">' .  '<b>' . $list['StringyChat_name'] . '</b>' . '</span>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';
}
}

This printout will show all the users matching the testip within the admin array, I got the same printout for moderators as well.

 

Well the real problem I'm experiencing right now is to use my database to calculate the color it should display.

 

I got 3 tables at this stage

 

Table 1: Users2

Layout

ID, Username, mxitid, nick, phone and rank

 

This table is where I store the usernames of people if they register and give them the rank value of 6

 

Table 2: ranks_colors

Layout

Type, rank, color1, color2, color3, color4

 

Admin, 1, red, blue, orange, purple

Mod, 2, green, pink, yellow, black

etc... upto 6 wich is Normal 

 

This table is where I specify Type like Administrator rank 1 and 4 colors he can use within hes text printout

 

Table 3: StringyChat

Layout

id, ip, name, message, time, device, rank

 

This is basically where the messages that is being send will be stored each in its own row with the specified rank number.

 

 

The problem I'm currently struggling with is the ranks I want each rank type font to be different for example in the above Table 2.  If admin all the messages send by admin must be red. All the mod messages must be green etc.

 

How can I change from the array way to mysql by using the ranks system?

 

Link to comment
Share on other sites

I'm currently making use of arrays to modify my font colors in my chat script for example

$admin = array('m70141099002' , 'Debater', '27765238453', '');
$moderator = array('m52626156002', 'm57010835002' , 'm50079252002', '27723289551', 'm38565659002');


$testip = $_SERVER["HTTP_X_MXIT_USERID_R"];




if(!isset($name))
{
	$name = "Debater";
}


if(!isset($testip))
{
	$testip = "Debater";
}




////////////////This is for Admin Permission Users//////////////
if (in_array($testip, $admin))
{
if (in_array($list['StringyChat_ip'], $admin))
{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' . '</span>'. '<span style="color:red">' . '<b>'   . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
elseif (in_array($list['StringyChat_ip'], $moderator))

{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:green">' .  '<b>' . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
elseif (in_array($list['StringyChat_ip'], $pc))

{
   print '<span style="color:gold">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:purple">' .  '<b>' . $list['StringyChat_name'] . '</b>' . '</span>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
elseif (in_array($list['StringyChat_ip'], $helper))

{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:blue">' .  '<b>' . $list['StringyChat_name'] . '</span>' . '<span style="color:green">' . ' ' . '[H]' . '</span>' . '</b>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}

elseif (in_array($list['StringyChat_ip'], $globalhelper))

{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:blue">' .  '<b>' . $list['StringyChat_name'] . '</span>' . '<span style="color:green">' . ' ' . '[G.H]' . '</span>' . '</b>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';

}
else
{
   print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] )  . ') ' . '</span>' . $form .  ' ' .  '<span style="color:#0365B8">' .  '<b>' . $list['StringyChat_name'] . '</b>' . '</span>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) .  '<span style="color:#d8d8d8">'  . " - " . $ipi . '</span>' . '<br />';
}
}

This printout will show all the users matching the testip within the admin array, I got the same printout for moderators as well.

 

Well the real problem I'm experiencing right now is to use my database to calculate the color it should display.

 

I got 3 tables at this stage

 

Table 1: Users2

Layout

ID, Username, mxitid, nick, phone and rank

 

This table is where I store the usernames of people if they register and give them the rank value of 6

 

Table 2: ranks_colors

Layout

Type, rank, color1, color2, color3, color4

 

Admin, 1, red, blue, orange, purple

Mod, 2, green, pink, yellow, black

etc... upto 6 wich is Normal 

 

This table is where I specify Type like Administrator rank 1 and 4 colors he can use within hes text printout

 

Table 3: StringyChat

Layout

id, ip, name, message, time, device, rank

 

This is basically where the messages that is being send will be stored each in its own row with the specified rank number.

 

 

The problem I'm currently struggling with is the ranks I want each rank type font to be different for example in the above Table 2.  If admin all the messages send by admin must be red. All the mod messages must be green etc.

 

How can I change from the array way to mysql by using the ranks system?

 I tried to recall it with

 

$resultr = mysql_query("SELECT * FROM Users2 WHERE mxitid = \"$ip\"");
        $rowr = mysql_fetch_array($resultr);
         $rank = $rowr['rank'];
         $mxitidd = $rowr['mxitid'];


$resultc = mysql_query("SELECT * FROM ranks_color WHERE rank = \"$rank\"");


        $rowc = mysql_fetch_array($resultc);
         $rank2 = $rowc['rank'];
         $color1 = $rowc['color1'];
$color2 = $rowc['color2'];
$color3 = $rowc['color3'];
$color4 = $rowc['color4'];

but it didn't work only got it that everyones text was one color not according to the colors of the permissions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.