Page 1 of 1
if variable contains '..'
Posted: Sun Mar 23, 2003 10:15 pm
by phice
Looking for any function that will search a string for 2 dots (..), and if the dots are inside the string, then it will result in an error.
[need more information? just ask]
Posted: Sun Mar 23, 2003 10:21 pm
by hob_goblin
Code: Select all
if(strstr($string, "..")){
// ERROR
}
Posted: Mon Mar 24, 2003 10:31 am
by mchaggis
alternatively:
if (ereg('\.\.', $string)) {
// Erro
}
Posted: Mon Mar 24, 2003 11:27 am
by twigletmac
If you don't need more complicated pattern matching then ereg() is uneccessary. Also strpos() may be a better function to use than strstr() for this particular test:
http://www.php.net/manual/en/function.strpos.php
http://www.php.net/manual/en/function.strstr.php
Mac