Ateu Posted July 23, 2009 Share Posted July 23, 2009 Hi. To cut a long story short, I'm a 13 year old kid seeking help with a piece of PHP code I've downloaded a chat and I'm really going very deep into the customisation. Occasionally my class use it to chat as my school filters certain websites including MSN. So, they also swear on my chat. I've got swear words to be replaced with <censored> and their new trick is to use my name (Andrew) as their username. I've got the login form box to display an error message if their username is 2 characters or less, but now I want it to also display an error message if their username contains 'Andrew' in it, because the current code replaces 'Andrew' with 'Fake Andrew' and allows them to login but they've found that if they type 'And'rew' it removes the quotation mark and let's them get away with Andrew as their username. Here's the current code: function q09(w){f=document.forms.fms;ok=1;a=f.name;if(a.value.length<6){a.value='';a.focus();ok=0};if(ok==1){return true}else{document.getElementById('emms').innerHTML=w;return false}} Could you please tell me what to add so it will display the same error message if the username contains 'Andrew'. P.S. There are a whole lot of other files on the server. One is the framework for /login.php and it says that if the username contains q09 (that's the code above) it will display the error message located in another file. http://www.andrewtaylor.eu/live/blab Quote Link to comment Share on other sites More sharing options...
ignace Posted July 23, 2009 Share Posted July 23, 2009 function q09(w){f=document.forms.fms;ok=1;a=f.name;if(a.value.length<6){a.value='';a.focus();ok=0};if(ok==1){return true}else{document.getElementById('emms').innerHTML=w;return false}} is in my opinion javascript. Quote Link to comment Share on other sites More sharing options...
Ateu Posted July 23, 2009 Author Share Posted July 23, 2009 I know it's Javascript. The file is called blite.js. Any ideas on the code? Quote Link to comment Share on other sites More sharing options...
ignace Posted July 23, 2009 Share Posted July 23, 2009 What is actually the problem Andrew doesn't get <censored> but all others will? If you disallow Andrew you'll also disallow yourself. Don't allow them to create names and create a generated name for them (ex. user001). Allow names only when registered (because if anyone is Andrew, then who are you?). And add a UNIQUE type to your username field to your database so noone can use the same name more then once. Quote Link to comment Share on other sites More sharing options...
ignace Posted July 23, 2009 Share Posted July 23, 2009 To cut a long story short, I'm a 13 year old kid seeking help with a piece of PHP code contradicts: I know it's Javascript. The file is called blite.js. Any ideas on the code? Quote Link to comment Share on other sites More sharing options...
Ateu Posted July 23, 2009 Author Share Posted July 23, 2009 It's not the <censored> part. There is a file called badwords.txt which contains all the swears. The user can pick their own username but I don't want them to use my name. At the moment, it will replace 'Andrew' with Fake Andrew'. Also, I have my own admin URL that I've developed that doesn't replace 'Andrew' and nor does it replace swear words. Quote Link to comment Share on other sites More sharing options...
ignace Posted July 24, 2009 Share Posted July 24, 2009 At the moment, it will replace 'Andrew' with Fake Andrew'. Also, I have my own admin URL that I've developed that doesn't replace 'Andrew' and nor does it replace swear words. Unless they write And'rew, right? I'm sticking with my first suggestion, it solves a lot of problems and saves you the hussle: Don't allow them to create names and create a generated name for them (ex. user001). Allow names only when registered (because if anyone is Andrew, then who are you?). And add a UNIQUE type to your username field to your database so noone can use the same name more then once. 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.