var incorrect for URLs

i'm trying to use filter_var to validate URLs that have been entered by a user, but it seems not to work in all cases. I've requested a fix for this some time ago on PHP.net, but to no avail. Besides regexes (yes, a few have been posted on stackoverflow), is there a PHP version that does work or any other method? The problem I'm facing is that the following string get's valid

var对URL不正确

我试图使用filter_var来验证用户输入的URL,但它似乎不适用于所有情况。 我前段时间在PHP.net上请求了一个修复程序,但无济于事。 除了正则表达式(是的,有一些已经发布在stackoverflow上),是否有PHP版本可以工作或者其他方法? 我面临的问题是下面的字符串得到验证,不应该: http://http://www.google.com 测试脚本: $url = $_REQUEST['url']; if (filter_var("http://" . $url, FILTER_VALIDATE_URL)) $filt

PHP filter

I'm attempting to use filter_input_array() to validate some post data. Despite my best efforts the function seems to return null values inside of the $filter array(passing the condition) as opposed to failing the validation and returning false as I expect. Here's an example of the code implementation: $filters = array( 'phone' => FILTER_VALIDATE_INT, 'email' => FILTER_VALIDA

PHP过滤器

我试图使用filter_input_array()来验证一些发布数据。 尽管我尽了最大的努力,但函数似乎在$ filter数组内部传递null值(传递条件),而不是按照我的预期验证并返回false。 这是一个代码实现的例子: $filters = array( 'phone' => FILTER_VALIDATE_INT, 'email' => FILTER_VALIDATE_EMAIL ); if(filter_input_array(INPUT_POST, $filters)){ //filters are validated insert to database } else{ //filters

Regex Problem in PHP

I'm attempting to utilize the following Regex pattern: $regex = '/Name: [a-zA-Z ]*] [0-9]/'; When testing it in Rubular, it works fine, but when using PHP the expression never returns true, even when it should. Incidentally, if I remove the "[0-9]" part, it works fine. Is there some difference in PHP's regex syntax that I'm overlooking? Edit: I'm looking for the ch

PHP中的正则表达式问题

我试图利用以下正则表达式模式: $regex = '/Name: [a-zA-Z ]*] [0-9]/'; 在Rubular中进行测试时,它可以正常工作,但使用PHP时,表达式永远不会返回true,即使它应该如此。 顺便说一句,如果我删除了“[0-9]”部分,它工作正常。 我忽略了PHP的正则表达式有一些区别吗? 编辑:我正在寻找字符“名称:”,然后是包含任意数量的字母或空格的名称,然后是“]”,然后是空格,然后是单个数字。 所以“名称:克里斯”5“将返回true,”

Undefined PHP function filter

I am trying to use the predefined function in PHP filter_input But I get the following: Call to undefined function filter_input()... The line it fails on is: $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL); I can confirm there is a $_POST['email'] that has a value and that I am using PHP 5.5.12 and the filter extension was enabled by default in 5.2.0 . I'm not

未定义的PHP函数过滤器

我正尝试在PHP filter_input使用预定义的函数 但我得到以下内容: Call to undefined function filter_input()... 失败的路线是: $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL); 我可以确认是否有一个$_POST['email']具有值,并且我使用的是PHP 5.5.12,并且过滤器扩展在5.2.0中默认启用。 我不确定我缺少什么来访问应该已经可以访问的函数。 $error_msg = ""; if (isset($_POS

Alternative to filter

Possible Duplicate: filter_var in php 5.3.8 I recently upgraded to php 5.3.8 and I am having problem validating an email address a user enters into a registration form using "filter_var". I want to ensure that when a valid email address is entered I post it to a database and if for some reason the format of the email address is incorrect I inform the user to enter a valid email add

替代过滤器

可能重复: filter_var in php 5.3.8 我最近升级到PHP 5.3.8,我有问题验证用户使用“filter_var”进入注册表单的电子邮件地址。 我想确保在输入有效的电子邮件地址时将其发布到数据库,如果由于某种原因电子邮件地址的格式不正确,我通知用户输入一个有效的电子邮件地址。 所以我检查了php.net,事实证明filter_var不存在于PHP 5.3.8有没有人知道在PHP 5.3.8中filter_var的替代方法 如果您只关心提供的电子邮件地址在语法上

Customer group ID not sent on admin email after registration in Magento

I'm having problem when sending Transactional Email after customer register on the system, I need to show the group of the user registration as I have module for Wholesale registration and the group ID as well as password is sending only on customer email and not on the admin email as shown on the images attached. This is the email sent to customer This is the email sent to admin Why th

在Magento注册后,客户组ID不会在管理员电子邮件中发送

在客户在系统上注册后发送交易电子邮件时,我遇到问题,我需要显示用户注册的群组,因为我有批发注册的模块,群组ID和密码仅在客户电子邮件上发送,而不是在管理员电子邮件,如附图所示。 这是发送给客户的电子邮件 这是发送给管理员的电子邮件 为什么他们没有发送相同的内容?

Laravel 5.4: Password reset token custom length?

I am using laravel 5.4 building an API where I email the user a token on password reset if user verified, which user provides before resetting password. Currently the sent token has 64 characters and too large for user to grab, and I'm not sure if laravel has configuration to give a custom length to token? The solution is a little bit tricky, ill try to explain the procedure as clearly as

Laravel 5.4:密码重置令牌自定义长度?

我正在使用laravel 5.4构建一个API,在用户验证后,如果用户通过密码重置向用户发送令牌,并在重置密码之前提供了该令牌,则该令牌将通过该令牌发送给用户 目前发送的令牌有64个字符,对于用户来说太大了,我不确定laravel是否有配置给令牌定制长度? 该解决方案有点棘手,尽可能清楚地解释该过程: 第1步 - 扩展标准DatabaseTokenRepository 创建一个扩展IlluminateAuthPasswordsDatabaseTokenRepository的类来定义一个

validate membership before or after?

The process works like this. If login fails 5x they are required to reset the password and are sent to the password reset page. User enters email address Link is sent to the email address provided. Token, email and time is recorded. Back at the site, if token is valid, db is checked to find if email addr is actual member. If they are a member then password reset continues, otherwise th

在之前或之后验证会员资格?

这个过程就像这样。 如果登录失败5x,则需要重置密码并发送到密码重置页面。 用户输入邮箱地址 链接发送到提供的电子邮件地址。 记录令牌,电子邮件和时间。 回到网站,如果令牌有效,将检查数据库以查找电子邮件地址是否为实际成员。 如果他们是会员,那么密码重置将继续,否则他们将处于死胡同。 但在得到这个书面后,我想知道是否应该在发送电子邮件之前检查电子邮件地址是否与实际会员帐户相关联。 所以这是

Consequences of not using server side validation?

What are the consequences of not validating a simple email form on the server. Keep in mind that: javascript validation is being carried out there is no database in question, this is a simple email form The PHP code I would like to use is this: <?php $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS ); $full_name = $post_data["full_name"]; $email_

不使用服务器端验证的后果?

不验证服务器上的简单电子邮件表单的后果是什么? 请记住: JavaScript验证正在进行中 没有问题的数据库,这是一个简单的电子邮件表单 我想使用的PHP代码是这样的: <?php $post_data = filter_input_array( INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS ); $full_name = $post_data["full_name"]; $email_address = $post_data["email_address"]; $gender = $post_data["gender"]; $message = $

How to check if an email address exists without sending an email?

I have come across this PHP code to check email address using SMTP without sending an email. Has anyone tried anything similar or does it work for you? Can you tell if an email customer / user enters is correct & exists? There are two methods you can sometimes use to determine if a recipient actually exists: You can connect to the server, and issue a VRFY command. Very few servers sup

如何检查电子邮件地址是否存在,而不发送电子邮件?

我遇到了这个PHP代码,使用SMTP检查电子邮件地址而不发送电子邮件。 有没有人试过类似的东西,或者它为你工作? 你可以告诉一个电子邮件客户/用户输入是否正确和存在? 有时可以使用两种方法来确定收件人是否确实存在: 您可以连接到服务器,并发出VRFY命令。 很少有服务器支持这个命令,但它是专门用于此目的的。 如果服务器以2.0.0 DSN响应,则该用户存在。 VRFY用户 您可以发出RCPT,并查看邮件是否被拒绝。