Reputation: 91
I get this error on my site and i dont know why:
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash
The error is in this function:
if (isset($_REQUEST['page']) AND preg_match("\.\.", $_REQUEST['page'])) {
Header("Location: index.php");
die();
}
Upvotes: 1
Views: 5555
Reputation: 14882
PHP has an interesting requirement when supplying a pattern for a regex operation (such as preg_match), that the pattern needs to have a character delimiter at the start and end of the string. This can be any character, but should not be used in the pattern. For example, you may use the hash symbol as your delimiter:
if (isset($_REQUEST['page']) AND preg_match("#\.\.#", $_REQUEST['page'])) {
Upvotes: 0
Reputation: 33531
You have to enclose the regular expression in delimiters:
if (isset($_REQUEST['page']) AND preg_match("/\.\./", $_REQUEST['page'])) {
Header("Location: index.php");
die();
}
Upvotes: 3