<?php
	function error_email() {
		// Variables
		$email = get_bloginfo('admin_email');
		$website = get_bloginfo('url');
		$name = get_bloginfo('name');

		// Compile Message
		$message = "Someone, probably a legitimate user, tried to go to ".$_SERVER['REQUEST_URI']." and received a 404 (file not found) error. They came from ".$_SERVER['HTTP_REFERER'];
		$message .= "It likely wasn't the visitor's fault, so please try to fix this as soon as possible.\r\n\r\n";
		$message .= "Visitor Details \r\n\r\nIP: ".$_SERVER['REMOTE_ADDR']."\r\n";
		$message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT'];

		// Mail
		mail($email, "404 Error Notice For ".$_SERVER['REQUEST_URI'],$message, "From: $websitename <noreply@".(str_replace("www.", "", str_replace("http://", "", $website))).">");
	}

	function error_message() {
		$message = "I'm sorry, but the page or file you were looking for at ".$_SERVER['REQUEST_URI']." could not be found. The site administrator has been emailed about this problem and will try to fix it as soon as possible.";
		return $message;
	}
?>