I'm very new to PHP and am trying to figure out how to parse out a
variable "HTTP_REFER ER". My reason for this is my site was recently
"FEATURED" (sic) on a website called FARK.COM. Because of this I
received over 100,000 Hits in less then one hour and it caused my host's
server farm to crash. While I understand that I could move to a more
robust Web Host, I would rather trap any further links from FARK and
redirect them to a rejection page at the following URL.
In doing this I should be able to avoid another crash and save myself
some phenomenal bandwidth charges.
I tried the following code to attempt to isolate the word FARK from
HTTP_REFERER thinking that the 2nd element of the array would be FARK
(assuming that the HTTP_REFERER = "http://www.fark.com")
My expected output would be
$refer_array(1) = http://www
$refer_array(2) = fark
$refer_array(3) = com
However what I get is the following message
Parse error: parse error in /refer_test.php on line 11
Here is the Code I'm using to display the results
-------------------------------------------------------------------------------------------
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php //PHP ADODB document - made with PHAkt 2.2.0
PRINT HTTP_REFERER
$refer_array = split(".",HTTP_ REFERER);
foreach ( $refer_array as $item )
print "$item<BR>" ;
?>
</body>
</html>
---------------------------------------------------------------------------------------------
Any help anyone could offer would be greatly appreciated by this
bumbling n00bie
Thanks
John
variable "HTTP_REFER ER". My reason for this is my site was recently
"FEATURED" (sic) on a website called FARK.COM. Because of this I
received over 100,000 Hits in less then one hour and it caused my host's
server farm to crash. While I understand that I could move to a more
robust Web Host, I would rather trap any further links from FARK and
redirect them to a rejection page at the following URL.
In doing this I should be able to avoid another crash and save myself
some phenomenal bandwidth charges.
I tried the following code to attempt to isolate the word FARK from
HTTP_REFERER thinking that the 2nd element of the array would be FARK
(assuming that the HTTP_REFERER = "http://www.fark.com")
My expected output would be
$refer_array(1) = http://www
$refer_array(2) = fark
$refer_array(3) = com
However what I get is the following message
Parse error: parse error in /refer_test.php on line 11
Here is the Code I'm using to display the results
-------------------------------------------------------------------------------------------
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php //PHP ADODB document - made with PHAkt 2.2.0
PRINT HTTP_REFERER
$refer_array = split(".",HTTP_ REFERER);
foreach ( $refer_array as $item )
print "$item<BR>" ;
?>
</body>
</html>
---------------------------------------------------------------------------------------------
Any help anyone could offer would be greatly appreciated by this
bumbling n00bie
Thanks
John
Comment