简体   繁体   English

最多在表单输入文本区域中输入URL验证

[英]Maximum Enters URL validation in form input text area

I have a form which takes URL OR Domains as values and retrieve page rank. 我有一个将URL或域作为值并检索页面排名的表格。 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 最近,我遇到了一个问题,即Google开始阻止IP(可能是由于有人开始滥用该表单),所以我想对此表单进行100个最大的URL检查验证

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 的JavaScript

var urlList = new Array();

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

Resource: http://www.w3schools.com/jsref/jsref_length_array.asp 资源: 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. 你会遇到使用JavaScript这样做的问题是,如果有人真的想糟蹋自己的应用程序没有什么会阻止他们。 It's best to validate this on the client side, pass it to the server side and validate it again. 最好在客户端进行验证,然后将其传递给服务器端,然后再次进行验证。

Server Side: PHP 服务器端:PHP

$urlList = array();

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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