Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/167160-ajax-chat-help/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/167160-ajax-chat-help/#findComment-881384
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/167160-ajax-chat-help/#findComment-881427
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/167160-ajax-chat-help/#findComment-881790
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.