Guest Sniko` Posted July 28, 2009 Share Posted July 28, 2009 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 Quote Link to comment Share on other sites More sharing options...
Strats Posted July 28, 2009 Share Posted July 28, 2009 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? Quote Link to comment Share on other sites More sharing options...
Guest Sniko` Posted July 28, 2009 Share Posted July 28, 2009 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 Quote Link to comment Share on other sites More sharing options...
Deadmafia Posted September 2, 2009 Share Posted September 2, 2009 Re: [V1 && V2]Change Username Color sql for this ? i tried it out but cannot change the color. Quote Link to comment Share on other sites More sharing options...
POG1 Posted September 2, 2009 Share Posted September 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
Adil Posted September 2, 2009 Share Posted September 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
Miniman Posted September 2, 2009 Share Posted September 2, 2009 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 :-) Quote Link to comment Share on other sites More sharing options...
Adil Posted September 2, 2009 Share Posted September 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
BlueDevil23 Posted September 2, 2009 Share Posted September 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
Adil Posted September 2, 2009 Share Posted September 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
Peterisgb2 Posted September 19, 2009 Share Posted September 19, 2009 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. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted September 19, 2009 Share Posted September 19, 2009 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 ;) Quote Link to comment Share on other sites More sharing options...
Eternal Posted September 21, 2009 Share Posted September 21, 2009 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. Quote Link to comment Share on other sites More sharing options...
Karlos94 Posted September 24, 2009 Share Posted September 24, 2009 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. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted September 25, 2009 Share Posted September 25, 2009 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. Quote Link to comment Share on other sites More sharing options...
Karlos94 Posted September 25, 2009 Share Posted September 25, 2009 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. Quote Link to comment Share on other sites More sharing options...
CrazyT Posted October 3, 2009 Share Posted October 3, 2009 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. Quote Link to comment Share on other sites More sharing options...
Gucci Mane Posted October 6, 2009 Share Posted October 6, 2009 I have tried to put this on my game 3 times but it never seems to work Quote Link to comment Share on other sites More sharing options...
Karlos94 Posted October 6, 2009 Share Posted October 6, 2009 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.. isset() empty() strtolower() array() in_array() strlen() As I said.. K.I.S.S Quote Link to comment Share on other sites More sharing options...
Uridium Posted October 6, 2009 Share Posted October 6, 2009 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 Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted October 10, 2009 Share Posted October 10, 2009 For such small thing, a regexp is just fine. And personally I would do the check while writing it to the DB as opposed to every time it's displayed, just to shave a bit server resources. Quote Link to comment Share on other sites More sharing options...
Karlos94 Posted October 11, 2009 Share Posted October 11, 2009 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. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted October 12, 2009 Share Posted October 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
Snake Posted October 12, 2009 Share Posted October 12, 2009 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: Quote Link to comment Share on other sites More sharing options...
chavdave Posted November 11, 2012 Share Posted November 11, 2012 Love it :D This was created for my game by Sniko and i have had now errors i have done some tweaks to it and added more color's :D Good work Sniko :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.