:D this code is too hard for me :D ;D understood is_nimeric, but this is hard
Printable View
:D this code is too hard for me :D ;D understood is_nimeric, but this is hard
Frustrating means annoying and hard.
can you write me an example with $msg variable??
frustrating?
frus·trate (frstrt)
tr.v. frus·trat·ed, frus·trat·ing, frus·trates
1.
a. To prevent from accomplishing a purpose or fulfilling a desire; thwart: A persistent wind frustrated my attempt to rake the lawn.
b. To cause feelings of discouragement or bafflement in.
2. To make ineffectual or invalid; nullify.
[Middle English frustraten, from Latin frstrr, frstrt-, from frstr, in vain.]
frustrater n.
frustrating·ly adv.
please people, help me with this....
I have two variables $user and $pass
What php script will not let users to insert characters like .?/,|\][)(-+ into my login and pass inputs. Thanks
The following will say that there are strange characters if there is anything other than a capital or lower case letter. Spaces are also counted as a strange character in this snippet of code.
This is an example of PCRE (Perl Compatible Regular Expressions).PHP Code:<?php
$test='thisissometext';
if(preg_match('/[^a-zA-Z]/', $test)) {
echo "YES, odd characters were found";
}
else {echo "NO odd characters were found";}
?>
I have a tutorial on it here http://www.animeviews.com/article.ph...ry=programming
and here http://www.animeviews.com/article.ph...ry=programming
and have a page of examples here http://www.animeviews.com/article.ph...ry=programming
if(preg_match('/\W/', $password, $nick, $name, $telephone)) {
$value = '1';
}
What is wrong with this command? I got : Warning: preg_match() expects parameter 4 to be long, string given in /home//domains/l//register.php
I want to check these 4 strings if is symbols into them, how i have to change it?
You are trying to preg_match an array. I am pretty sure you can't do that. At least I can't read anywhere in the documentation where you can and I have not been able to do so. You can use arrays with preg_replace, but that is a different function and as you can probably guess it is a regular expression function designed to find matches and replace the matches found, but doesn't tell you IF a match was found.
What you are asking for can best be done with a loop like
Remember, though, \W will match letters numbers and the underscore _PHP Code:<?php
$num=0;
$all=array("th%is","that","& the next thing");
foreach($all as $t){$num++;
if(preg_match('/\W/', $t)) {
echo "value $num MATCHES<br>";
}
else echo"value $num DOES NOT MATCH<br>";}
?>
What about this?
it is working for me...PHP Code:if(preg_match('/\W/', $password)) {
echo "<center><font size='1' face='Verdana' color='blue'><b>!!! Symbols detected!!!</b></font></center>";
$string = '1';
} else {
if(preg_match('/\W/', $nick)) {
echo "<center><font size='1' face='Verdana' color='blue'><b>!!! Symbols detected !!!</b></font></center>";
$string = '1';
} else {
$string = '0';
...
if ($string == 1) {die} else {work}
else should be the last else listed. Previous else statements should be elseif.
curly brackets are not necessary if there is only on statement to execute. If there are two or more you will need to use the curly brackets, but you can use them if you want. I am just mentioning it in case you didn't know.PHP Code:if (preg_match('/\W/', $password)) {
echo "<center><font size='1' face='Verdana' color='blue'><b>!!! Symbols detected!!!</b></font></center>";
$string = '1';
}
elseif (preg_match('/\W/', $nick)) {
echo "<center><font size='1' face='Verdana' color='blue'><b>!!! Symbols detected !!!</b></font></center>";
$string = '1';
}
else $string = '0';
if ($string == 1) die;
else work;