如何检查用户注册perl脚本中的所有字段 [英] how to check for all the fields in user registrations perl script

查看:52
本文介绍了如何检查用户注册perl脚本中的所有字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我修改了用户注册脚本,但不确定如何在防止垃圾注册和无效字符方面检查每个变量?

以下两个代码:

a)html

b)perl脚本(打印并插入数据库)


干杯......

Andrew


a)html

=====

展开 | 选择 | Wrap | 行号

解决方案

至于检查输入信息,你将无法真正阻止垃圾。信息,但您想要检查输入的格式。即:检查电子邮件地址的格式是否正确。检查您预期的位置是两个数字,输入了两个数字等。检查选择事物的字段(通过复选框,单选按钮或下拉菜单),选择或选择。


对于有效的电子邮件地址,您可以执行尽可能多的站点并发送验证电子邮件,以便以适当的方式进行响应以获得验证和完整注册。


你怎么做取决于你,但这一切都取决于你想对你的数据如何肛门。


问候,


Jeff


对于电子邮件地址,我建议您使用Email :: Valid模块。对于表单文件的其余部分很难说,只有你可以定义防止垃圾注册和无效字符。对你和你的特殊要求意味着。


一般的方法是使用常规的exressions来评估表单字段数据

展开 | 选择 | Wrap | 行号


如果你不熟悉正则表达式,我建议你看看CPAN的模块来帮助你。

FormValidator :: Simple
Data :: FormValidator


--Kevin

Hi All,

I modified the user registration script, but not sure how to make it check for each variable in terms of preventing junk registration and invalid characters?
Two codes below :
a) html
b) perl script (print and inserting into database)

Cheers...
Andrew

a) html
=====

Expand|Select|Wrap|Line Numbers

解决方案

As far as checking the input information, you won''t be able to really prevent "junk" information, but you will instead want to check the format of what has been entered. ie: Check that the email address is in the correct format. Check that where you expected two numbers, two numbers were entered, etc. Check that fields where things were to be selected (either by check boxes, radio buttons or dropdowns), that a selection or selections were made.

For the valid email address, you could do as many sites to and send a verification email that they need to respond to in an appropriate manner to get verified and complete registration.

How you do it is up to you, but it all depends on how anal you want to be about your data.

Regards,

Jeff


For an email address I recommend you use the Email::Valid module. For the rest of your form fileds its hard to say, only you can define what "preventing junk registration and invalid characters" means to you and your particular requirements.

The general method is to use regular exressions to evaluate the form field data

Expand|Select|Wrap|Line Numbers


I would suggest that you look at CPAN for a module to help you if you are not good with regular expressions.

FormValidator::Simple
Data::FormValidator


--Kevin


这篇关于如何检查用户注册perl脚本中的所有字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆