Jump to content

[SOLVED] preg_match help


tqla

Recommended Posts

I am trying to do a preg_match to see if the HTTP_REFERER is from within my domain or from an external link.

 

$site_url = http://(my website url is here);

if(isset ($HTTP_REFERER)) {
$ref = $HTTP_REFERER; 

if (preg_match($site_url, $ref)) {

echo "match";

} else {

echo "no match found";

}	

}

 

But I get this error and "no match" when it should be a match in my test:

 


Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash on line 6

 

What am I doing wrong?  ???

Link to comment
https://forums.phpfreaks.com/topic/140872-solved-preg_match-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.