<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" ?>\n";
#
# SCRIPT : WapError
# VERSION : 1.0
# AUTHOR : Marcus S. Xenakis
# EMAIL : Marcus@xenakis.net
# DATE : 10/11/2000
#
# COPYRIGHT : You are free to modify this script, please leave the author and
# email lines in. In fact after successful install, delete all
# unnecessary comment lines for performance.
#
# DESCRIPTION : A simple Errorbot to catch 401, 403 404 and 500 errors.
# NOTE: This has only been tested with an Apache webserver running PHP
#
# INSTALLATION : Insert the following in your .htaccess file
# (for some reason we could only get it to work with a complete url)
# --------------------------------------------------------------------
# ErrorDocument 401 http://yourdomain.com/wap/waperror.php?error=401
# ErrorDocument 403 http://yourdomain.com/wap/waperror.php?error=403
# ErrorDocument 404 http://yourdomain.com/wap/waperror.php?error=404
# ErrorDocument 500 http://yourdomain.com/wap/waperror.php?error=500
# ---------------------------------------------------------------------
#
# Your .htaccess file should have the WAP entries.
# Your provider may have entered them at the server level.
#
# Appache .htacess WAP directives:
# ---------------------------------------------------------------------
# DirectoryIndex index.wml
# AddType text/vnd.wap.wml .wml
# AddType image/vnd.wap.wbmp .wbmp
# AddType application/vnd.wap.wmlc .wmlc
# AddType text/vnd.wap.wmlscript .wmls
# AddType application/vnd.wap.wmlscriptc .wmlsc
# ---------------------------------------------------------------------
#
# Within each error case you can set the variable
# $sendmail to True or False to determine if the
# webmaster is to receive an email notification
# of the error.
#
# --- Initialize Variables ------------------------------------------
# $title : the title of your WapEerror pages
# $admin_mail : email-address of the administrator to send the notifications to
# $admin_name : the name of the administrator
# $sender_name : the name that appears as From: in the notifications
# $sender_mail : email-address where the notifications are sent from
# $mainpage : URL to your main wap page.
# If you have an image modify and uncomment the follwoing line
# echo "<img alt=\"Your Image\" src=\"myimage.wbmp\" align=\"bottom\" hspace=\"0\"
vspace=\"0\"><br/>\n";
# --- Output Card Body for Errors ---
switch ($error) {
case("400"):
$errortype = "Bad Request";
$sendmail = True;
echo "<b>" . $errortype . "</b><br/><small>\n";
echo "Your browser sent a request that this server could not understand.<br/>\n";
PrintLoc ($location);
break;
case("401"):
if (!$user) {
break;
}
$errortype = "Unauthorized";
$sendmail= True;
echo "<b>" . $errortype . "</b><br/><small>\n";
echo "The document you requested ";
PrintLoc ($location);
echo " has been password locked for a reason. ";
echo "If you have misplaced your password, or have a compelling reason to view ";
echo "the restricted information, please contact the ";
echo "site administrator.";
break;
case("403"):
$errortype = "Access Forbidden";
$sendmail = True;
echo "<b>" . $errortype . "</b><br/><small>\n";
echo "The access to this location ";
PrintLoc ($location);
echo "is denied. Please contact the ";
echo "webmaster if you think you should be allowed to access ";
echo "the information at this location.";
break;
case("404"):
$errortype = "File Not Found";
$sendmail = True;
echo "<b>" . $errortype . "</b><br/><small>\n";
echo "The document ";
PrintLoc ($location);
echo "you were searching for has either expired or migrated elsewhere. ";
echo "To find documents which have moved, we suggest you start at our ";
echo "home page.";
break;
case("500"):
$errortype = "Internal Server Error";
$sendmail = True;
echo "<b>" . $errortype . "</b><br/><small>\n";
echo "The script ";
PrintLoc ($location);
echo "you're trying to access has suffered a fatal error. ";
echo "Please try again at a later time. The site administrator has ";
echo "already been notified of the error. ";
echo "It may be helpful if you could contact our ";
echo "webmaster with any additional information about your form input.";
break;
default:
$errortype = "Unknown Error";
$sendmail = True;
echo "<b>" . $errortype . "</b><br/><small>\n";
echo "There was an unexplained error in retrieving your requested file ";
PrintLoc ($location);
echo "You may wish to try again from our main page.";