I m 开发一种PHP功能,从网络形式处理提交材料。
Allowed characters are strictly alphanumeric, a-b, 0-9.
在处理和输入数据库之前,是否安全地依靠预先选择的定期表述来清理这些数据。
我认为,从一开始便可以减少任何与甲型六氯环己烷/[^a-zA-Zs-0-9.,]相对而言的。
我在这里的正确轨道?
I m 开发一种PHP功能,从网络形式处理提交材料。
Allowed characters are strictly alphanumeric, a-b, 0-9.
在处理和输入数据库之前,是否安全地依靠预先选择的定期表述来清理这些数据。
我认为,从一开始便可以减少任何与甲型六氯环己烷/[^a-zA-Zs-0-9.,]相对而言的。
我在这里的正确轨道?
如果你只允许将甲型数字特性储存在你的数据库中,而不是排除无效特性,那么你就能够更好地将错误退回到用户,因为后者提供了无效的投入。 这样,如果用户看到其数据以不同于其原始数据的形式向用户展示,那么他们就会感到迷惑。
换言之,用<代码>preg_match()验证输入,以确保其符合您的要求,如果没有,则将错误退回用户,以便予以确定。 然后从数据库中删除,或使用准备的报表。
if (!preg_match( /^[a-z0-9., ]$/i , $input)) {
// error Invalid input. Please use only letters and numbers
}
else {
// call escape function on $input or insert it with a prepared statement
// whatever is the appropriate method for your RDBMS api.
}
I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...