简体   繁体   中英

Maximum Enters URL validation in form input text area

I have a form which takes URL OR Domains as values and retrieve page rank. Recently i have faced problem that Google started blocking the IP (It may be due to that someone started abusing the form) So i want to put 100 maximum URL check validation for this form

Please guide me

What you're wanting to do is pretty simple. There are a couple of things you could do to help prevent this on the client side.

JavaScript

var urlList = new Array();

if(urlList.length <= 100){
    // continue
}else{
    // fail
}

Resource: http://www.w3schools.com/jsref/jsref_length_array.asp

The problem you're going to come across doing this with JavaScript, is if someone really wants to abuse your application nothing will stop them. It's best to validate this on the client side, pass it to the server side and validate it again.

Server Side: PHP

$urlList = array();

if(count($urlList) <= 100){
    // continue
}else{
    // fail
}

Resource: http://www.w3schools.com/php/func_array_count.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM