filter-var Questions

3

Solved

I'm trying to check whether or not an IP address is an internal-only (i.e. private) IP, but I'm getting a curious result: filter_var('173.194.66.94', FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)...
Jo asked 17/6, 2013 at 14:33

4

I'm using filter_var to validate boolean values but I did not expect it to not recognize FALSE. Why does this happen? filter_var(FALSE, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) returns n...
Chemosynthesis asked 3/2, 2012 at 16:51

5

Solved

I'm using PHP 5.3.10. This is the code: <?php $email = "[email protected]"; if (filter_var($email, FILTER_VALIDATE_EMAIL)) echo "Email: ".$email." correct"; else echo "email not correct"...
Amphitheater asked 7/10, 2013 at 8:30

6

Solved

I am using the PHP filter_validate_int to perform a simple telephone validation. The length should be exactly 10 chars and all should be numeric. However as most of the telephone numbers start with...
Buseck asked 20/9, 2013 at 8:23

2

Solved

I always use filter_var($var, FILTER, FLAG); when I get data from $_GET, $_POST and so on, but now this data is a JSON string but I didn't find any filter to sanitize JSON. Anyone know how to imple...
Deontology asked 30/5, 2016 at 20:21

5

Solved

$str = '"mynam@blabl"@domanin.com'; filter_var($str, FILTER_VALIDATE_EMAIL);//return valid email. the above email returns true... Fair enough that RFC 2822 says it's a legal email address. my q...
Cockneyism asked 11/11, 2010 at 13:6

3

Solved

The FILTER_VALIDATE_URL filter seems to have some trouble validating non-ASCII URLs: var_dump(filter_var('http://pt.wikipedia.org/wiki/', FILTER_VALIDATE_URL)); // http://pt.wikipedia.org/wiki/ va...
Adust asked 26/1, 2010 at 1:51

1

I think I found a bug in PHP 5.4.23, but I suppose it is possible expected behavior as well. I am expecting a filter_var call to return null, but it isn't. Is this code correct, and is my assumptio...
Viticulture asked 30/1, 2014 at 23:1

1

Why does filter_var() accepts and validate this URL http://http://www.google.com? $website = "http://http://www.google.com"; echo filter_var($website, FILTER_VALIDATE_URL); // This outputs the va...
Melanesian asked 27/6, 2013 at 2:31

3

Solved

I have very limited experience with PHP and I'm really hoping someone can help me. What I want to do is sanitize/validate the phone number input so that only numbers are allowed. I think I need t...
Multiform asked 12/4, 2013 at 18:45

1

Solved

I'm practicing my beginner php skills and would like to know why this script always returns FALSE? What am i doing wrong? $namefields = '/[a-zA-Z\s]/'; $value = 'john'; if (!filter_var($value,F...
Leahy asked 12/6, 2012 at 9:2

1

Solved

I want the input to accpet 'true' or 'false' only, so I am trying to use FILTER_VALIDATE_BOOLEAN to do that, if (!filter_var('false', FILTER_VALIDATE_BOOLEAN)) { $error = true; echo 'error'; } ...
Lurid asked 2/2, 2012 at 15:51

2

Solved

I use the filter_var PHP function to validate email address when a user signs up to my site. I use this code from the post: $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL); then lat...
Wesleyanism asked 18/12, 2011 at 16:22

1

Solved

Hello I am writing a profile page script, in this script I check the value of an incoming $_GET variable and validate that it is an integer, I then validate this value against a $_SESSION value to ...
Windhover asked 14/10, 2011 at 15:18

1

Solved

Of Zend_Validate_EmailAddress and filter_var(..., FILTER_VALIDATE_EMAIL), which is better when validating an email address and why?
1

© 2022 - 2024 — McMap. All rights reserved.