Hi Everyone,
I am having an issue with a preg_match.
It seems to be finding false positives, this is almost certainly down to a mistake on my part in the pattern, can someone cast their eyes over it and give me tips
I am trying to cause different behaviour in a file included everywhere on the site except in the two pages mentioned.
The next line of the code is
Now when i access a pages called
areaList.php?chapterid=3
and echo the value of $pos, it says 1, which would indicate a match on the preg_match, wouldn't it?
Thank in advance,
Jez
I am having an issue with a preg_match.
It seems to be finding false positives, this is almost certainly down to a mistake on my part in the pattern, can someone cast their eyes over it and give me tips
Code:
$compareStr = basename($_SERVER['PHP_SELF']);
$pattern = "/[login.php|forgottenPassword.php]/i";
$pos = preg_match($pattern, $compareStr);
I am trying to cause different behaviour in a file included everywhere on the site except in the two pages mentioned.
The next line of the code is
Code:
if($pos < 1){
header("Location: ". BASE_URL);
}
Now when i access a pages called
areaList.php?chapterid=3
and echo the value of $pos, it says 1, which would indicate a match on the preg_match, wouldn't it?
Thank in advance,
Jez