Jump to content
MakeWebGames

Change Username Color


Guest Sniko`

Recommended Posts

Guest Sniko`

This modification allows users or donation users change the color of their username:

SQL

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

OPEN UP prefences.php

CASES

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Non donators

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Donation Users

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Functions

V2 Do not modify

V1 Change $db->query with mysql_query

Find ?> in prefences and above add

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Now open up

userlist.php

usersonline.php

viewuser.php

hospital.php

jail.php

And find where it says {$r['username']} and replace with

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Any errors reply or PM me

Thanks

Sniko

+1 me if used

Link to comment
Share on other sites

Guest Sniko`

Re: [V1 && V2]Change Username Color

 

I was told by someone that if you change user name colours there is some possible bug.

Is this true?

I have no idea sorry

Link to comment
Share on other sites

  • 1 month later...

Re: [V1 && V2]Change Username Color

Revised for you, loads of code was not needed and some markup errors

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Also using the <font> tag isn't reccomended as it has depreciated. try something like..

echo '<span class="'.$ir['username_color'].'-username">'.$ir['username'].'</span>';

You can then add username-black, username-red, username-blue and username-green to your CSS.

Link to comment
Share on other sites

Re: [V1 && V2]Change Username Color

 

I was told by someone that if you change user name colours there is some possible bug.

Is this true?

Yeah I heard it brings up a few vulnerabilities

Not if you do it right it won't, I advise following POG1's method.

Also, +1 Sniko`

Your posting alot of nice free stuff, your learning :-)

Link to comment
Share on other sites

Re: [V1 && V2]Change Username Color

Yeah actually this does seem to be done correctly. Only thing id say is you need a code to check if the colour that has been posted by the user is one of those options, cant trust those firefox addons anymore ;) Posts need to be secured in every way possible.

Link to comment
Share on other sites

Re: [V1 && V2]Change Username Color

 

Yeah actually this does seem to be done correctly. Only thing id say is you need a code to check if the colour that has been posted by the user is one of those options, cant trust those firefox addons anymore ;) Posts need to be secured in every way possible.

He has done that.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Re: [V1 && V2]Change Username Color

 

Yeah actually this does seem to be done correctly. Only thing id say is you need a code to check if the colour that has been posted by the user is one of those options, cant trust those firefox addons anymore ;) Posts need to be secured in every way possible.

He has done that.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Oh I looked at snikos first post not Pog1's. Pog1 is the one that added that.

Link to comment
Share on other sites

  • 3 weeks later...

How about using a function.

My current username format

usage "nameFormat($ir['userid']);"

Includes if they have a "Faction/gang" etc..

currently im using it as a external script eg:.. namescript.php etc..

But with some alterations it can be

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

The best way personally is do keep it simple IMHO. Why type up so much code hundred's of times to display the same thing? Just use a function.. Surely everyone knows them.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Might contain an error, I haven't coded anything for a while.

Link to comment
Share on other sites

a_bertrand:

I only did that as an example, however I would first off make the field in the mysql database and make sure they can't input anything different. I also understand where your coming from about XSS expolits. Also whenever someone checks input data before inserting or updating anything, they need to make sure that it goes into there database exactly how it should, by that I mean not allowing any chance for an exploit or bug to occur.

Link to comment
Share on other sites

  • 2 weeks later...
Regex can do this -.-

Note - I didnt do the regex came from a regex site.

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

That is a valid point, however preg_match() can see to slow down the processing. I'd personally say K.I.S.S (Keep it simple stupid..), this seems like that you rather use something more complex than needed. Try messing with a ternary operator and inclue these functions..

As I said.. K.I.S.S

Link to comment
Share on other sites

Regexp are not really efficient, but are anyhow fast. Now, where is your bottleneck, the server CPU?, the server HDD? or the network?

For me the server CPU is not the bottleneck, I do have more troubles with the network (for far away players) and some times the HDD, so I don't even start thinking about optimizing such small things. Also a regexp ensure you have LOT more flexibility when you need it. I still use strpos or equivalents when I just search a position inside a string but regexp are really good at finding non fixed things.

Link to comment
Share on other sites

Where have i heared that word K.I.S.S before.... Someone on here used to use it all the time..

Nyna springs to mind lol

K.I.S.S. Stands For Many People As-Keep It Simple Stupid....Comes From Schooling I Think....At Least It Was Used In My GED Classes....LMMFAO.... :thumbsup:
Link to comment
Share on other sites

  • 3 years 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...