Use this code and it will work.
Code:<?php
// Begin PHP Code
// FILENAME: FUNCTIONS.INC.PHP
function is_reported()
{
// SET THE DOMAIN NAME BELOW (without the 'http://' or 'www' bits)
$domain = 'able2know.com';
// ---------------------------------------------------------------
if( isset($_COOKIE['http_errors']) )
{
$_COOKIE['http_errors'] = unserialize( base64_decode($_COOKIE['http_errors']) );
if( in_array($_SERVER['REQUEST_URI'], $_COOKIE['http_errors']) )
{
// this error page / url has been reported by this person before
return TRUE;
}
}
// this person has either NEVER reported an error before
// or this is a NEW url error to report
$_COOKIE['http_errors'][] = $_SERVER['REQUEST_URI'];
$value = serialize( $_COOKIE['http_errors'] );
setcookie( 'http_errors', base64_encode($value), time() + 24*60*60, '/', '.'.$domain, 0 );
unset( $domain, $value );
return FALSE;
}
function send_error_email( $error_code='Undefined' )
{
if( !is_reported() )
{
// set the TO: email address
$to = 'test@emaildomain.com';
$referred_by = ( isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'Unknown' );
// set the SUBJECT: e-mail
$subject = "An error has occured - type: $error_code";
// set the MESSAGE: e-mail
$message = "The following error has occured:\r\n"
."--------------------------------\r\n\r\n"
." Type: $error_code\r\n"
." Page: {$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}\r\n"
." Time: ".date('d/m/Y H:i:s')."\r\n"
." From IP: {$_SERVER['REMOTE_ADDR']}\r\n\r\n"
." Referring Page: $referred_by \r\n"
."Regards,\r\n"
."Your hard-working web server.";
$headers = "From: webserver@{$_SERVER['SERVER_NAME']}\n"
."Reply-To: webserver@{$_SERVER['SERVER_NAME']}\n"
."X-Mailer: PHP/".phpversion();
// send the email
mail( $to, $subject, $message, $headers );
}
}
// End PHP Code
?>