|
|
|
<?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.
$title = "Your Title";
$admin_mail = "webmater@yourdomain.com";
$admin_name = "Webmaster";
$sender_name = "WapError";
$sender_mail = "waperrorbot@yourdomain.com";
$mainpage = "http://yourdomain.com/wap/";
$location=getenv("REDIRECT_URL");
$host=getenv("HTTP_HOST");
$remote=getenv("REMOTE_HOST");
$referer=getenv("HTTP_REFERER");
$user=getenv("REMOTE_USER");
$addr=getenv("REMOTE_ADDR");
$date=date("m/d/y h:i a");
Function PrintLoc ($location) {
if($location) {
echo $location;
}
}
# Output Common Card Header
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"
\"http://www.wapforum.org//DTD//wml_1.1.xml\">\n";
echo "<wml>\n";
echo "<template>\n<do type=\"prev\" label=\"Back\">\n";
echo "<prev/>\n</do>\n</template>\n";
echo "<card id=\"about\" title=\"";
echo $title;
echo "\" ordered=\"true\" newcontext=\"false\">\n";
echo "<p align=\"left\">\n";
# 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.";
}
# Output Common Footer
echo "</small><br/><A HREF=\"" . $mainpage . "\">Main Page</A>";
echo "</card>\n</wml>\n";
# send a notice to webmaster if set by switch
if ($sendmail) {
mail("$admin_name <$admin_mail>","$title $error-$errortype","Date Time : $date \nReport:
Error $error : $errortype \nLocation: $location2 \nVisitor: $remote \nAddress: $addr
\nReferer: $referer\nUser: $user", "From: $sender_name <$sender_mail>\nReply-To:
$sender_name <$sender_mail>\nContent-type: text/plain\nX-Mailer: PHP/" . phpversion());
}
?> |
|
| Multi-table database search for your WAP-enabled device. Uses PHP and MySQL. No WMLscript. Categories : WAP, WML, PHP, MySQL | | | wap device's headers on-line on wap phone Categories : WAP, WML, PHP | | | php embeded with wml ,wmlscript ,simple example U can add mysql Categories : WAP, PHP, WML | | | Sample WML Mailer Categories : PHP, WAP, WML, Email | | | Simple phone list search for your WAP device. Uses PHP and MySQL. Also lets you dial out to your entries using wtai://wp/mc if your phone supports it. No WMLscript. Categories : PHP, MySQL, WAP | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | A PHP function to encrypt and decrypt a number or string or a combination of the two. Categories : PHP, Encryption, Security | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | Authorize.net AIM Interface Class v1.0.0 Categories : PHP, PHP Classes, Ecommerce, Payment Gateways | | | Cut your MySQL Connections to 1 line of code Categories : PHP, Beginner Guides, Databases, MySQL | | | A simple class with some HTML output functions that would come in handy for consistent page layout etc. Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation | | | recode -- Recode a string according to a recode request Categories : PHP, PHP Functions, Recode | |
|
|
|