%
#Add an extra hit on this page to the hit table
$errors = array();
$my_page_number = 1000;
function send_mail($page){
# send a copy of the error information to the webmaster
global $errors;
$mailbody = "Errors on Recording hit on page " . $page . "\n\n";
while (list($key,$val) = each ($errors)) {
$mailbody .= $val . "
\n";
}
$subject = "Kandahar Web Error ";
$headers = "From: Kandahar Website \n";
$headers .= "Reply-To: \n";
$headers .= "X-Mailer: PHP\n";
$headers .= "Return-Path: \n"; // Return path for errors
mail("webmaster@kandahar.org.uk" , $subject, $mailbody, $headers);
} //function sendmail
$link = mysql_connect("localhost","unknown","unknown");
$db = mysql_select_db("http_auth",$link);
# We have to do this the long way round as "ON DUPLICATE KEY" does not work on the version of MYSQL on teh site
$stmt = "INSERT INTO k_hit_summary (hit_year, hit_month, hit_page, n_hits) VALUES (YEAR(now()),MONTH(now()),". $my_page_number.",1)";
$result = ( mysql_query( $stmt, $link));
if (!$result) {
$stmt = "UPDATE k_hit_summary SET n_hits = n_hits+1 WHERE hit_year = YEAR(now()) AND hit_month = MONTH(now()) AND hit_page = ".$my_page_number;
$result = ( mysql_query( $stmt, $link));
if (!$result) {
$errors[] = mysql_error($link);
send_mail($my_page_number);
}
}
mysql_close($link);
%>
Apologies! The members' web site
is temporarily down.
We are working hard to restore it.
|