Jump to content
MakeWebGames

Recommended Posts

Guest Sniko`
Posted

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

Guest Sniko`
Posted

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

  • 1 month later...
Posted

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.

Posted

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

Posted

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 :-)

Posted

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.

Posted

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.

Posted

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.

  • 3 weeks later...
Posted

well i tired to use this colour change but it would not work, so i decided to custom it so that the users can tottaly choose there colour

 

You're unable to view this code.

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

Posted

Doesn't seems a really safe way to handle the thing. Basically here you let your player enter more or less whatever they want, could be a link, a script or whatever else. A good way to let players hack other players accounts ;)

Posted

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.

Posted

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.

Posted

Vortex23:

Your $uInfo['uColour'] implies you store the color as it is directly in the database. Fine as long as you double check what players set as color at the beginning. Otherwise it could open the door to XSS exploits. If you don't know what that means, I can make an example.

Posted

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.

  • 2 weeks later...
Posted
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

Posted

I can understand what you mean for a small thing, but wouldn't checking the input to an array be more efficent compared to regexp? I would test but I have no access to any testing enviroments at this moment in time.

Posted

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.

Posted
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:
  • 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...