Polly po-cket
Dictator
(Posted on: 2015-02-19 11:35)
This code creates the form of registration fields.It
prevents the users to use the nicknames which are
inside the code: var blacklist=new Array
("hacker","fuck","admin","moderator");
Thus the
words like hacker,admin etc will not be allowed to
register through this form.You can use more words
in the blacklist.This code needs to be added inside
a html code element in a file.
<form onsubmit="checknick();" action="main.php?id=reg&ses=KrAslAo98nrtdNMOXglj7n2DTU9" method="post" >
<div class="center">
Nickname(max 10 characters):
<br/>
<input id="username" name="nick" maxlength="10" value="" onchange="checknick();" />
<br/>
Password(minimum 6 symbols):
<br/>
<input name="pass" maxlength="32" value=""/>
<br/>Repeat password:<br/>
<input name="re_pass" maxlength="32" value=""/>
<br/>
E-mail:
<br/>
<input name="email" maxlength="100" value=""/>
<br/>
Gender:
<br/>
<select name="sex">
<option value="1">
Male
</option>
<option value="2">
Female
</option>
</select>
<br/>
<img src="users-captcha.php?52ceb232b8746" alt="Captcha"/>
<br/>
Enter code from the image above:
<br/>
<input name="captcha" maxlength="6"/>
<br/>
<br/>
<input type="submit" value="Register"/>
</div>
</form>

<script>

  function checknick()

  {

    var blacklist=new Array("hacker","fuck","admin","moderator");

    var uname=document.getElementById('username').value;

    for(var i=0;i<blacklist.length; i++)

    {
          if(uname.length>10)
        {
          document.getElementById('username').value="";
          
          alert("Maximum 10 characters are allowed in nickname");
        }

        if(uname.indexOf(blacklist[i])!=-1)

        {

            document.getElementById('username').value="";

            alert("You can not use this nick");

            return;
        }
    }
    
   }

</script>
<!--Code Copyright:G1Forum.Wap.Sh-->

Copy code


NOTE: The words used inside the blacklist are very
sensitive.
For example: as the word 'admin' is blacklisted so
all the nick which have the word 'admin' inside it
(e.g. preadmin,admins,adminkiller) all will not be
allowed to register.

· (1)

Online: Guests: 1