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
AJAX Chat help?
Moderator: General Moderators
Re: AJAX Chat help?
You can use the match() function.
Re: AJAX Chat help?
Would I insert it somewhere around here:
a=f.name;if(a.value.length<3)
a=f.name;if(a.value.length<3)
Re: AJAX Chat help?
You'd insert it wherever you want to perform the validation to check that the username doesn't contain Andrew.
Something like this:
Something like this:
Code: Select all
if(username.match(/Andrew/))
alert('Username contains Andrew');