From 27f1a758f0f312e6dedb18f47ce86a6fd1d05d12 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Thu, 31 Jan 2013 04:10:59 -0800 Subject: Error logging. .htaccess cacheing. Modified doredirect to use $mydomain --- .htaccess | 36 +++++++++++++++++++++++++ errors.php | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++----- globe.php | 18 ++++++++----- images/.htaccess | 4 +++ index.php | 26 ++++++++++++------ pages/admin.php | 13 +++++++-- pages/cp.php | 4 ++- sounds/.htaccess | 15 +++++++++++ 8 files changed, 173 insertions(+), 24 deletions(-) create mode 100644 .htaccess create mode 100644 images/.htaccess create mode 100644 sounds/.htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..3bf8b20 --- /dev/null +++ b/.htaccess @@ -0,0 +1,36 @@ +AddType x-mapp-php5 .php + + +ErrorDocument 400 http://www.mazetd.4xg.net/error.php?error=400 +ErrorDocument 401 http://www.mazetd.4xg.net/error.php?error=401 +ErrorDocument 403 http://www.mazetd.4xg.net/error.php?error=403 +ErrorDocument 404 http://www.mazetd.4xg.net/error.php?error=404 +ErrorDocument 500 http://www.mazetd.4xg.net/error.php?error=500 + + +RewriteEngine on +RewriteBase / +RewriteRule ^([a-z]+)\.html$ /?page=$1 [R,L] + +# // For later use, when we get a domain that we want. +RewriteCond %{HTTP_HOST} ^mazetd.4xg\.net +RewriteRule (.*) http://www.mazetd.4xg.net/$1 [R,L] + +RewriteRule ^([a-z]+)$ /index\.php?page=$1 [QSA,NC] + +# 480 weeks + +Header set Cache-Control "max-age=290304000, public" + + + + + mod_gzip_on Yes + mod_gzip_dechunk Yes + mod_gzip_item_include file \.(txt|css|js)$ + mod_gzip_item_include handler ^cgi-script$ + mod_gzip_item_include mime ^text/.* + mod_gzip_item_include mime ^application/x-javascript.* + mod_gzip_item_exclude mime ^image/.* + mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* + \ No newline at end of file diff --git a/errors.php b/errors.php index 7b91633..e1621c9 100644 --- a/errors.php +++ b/errors.php @@ -1,11 +1,80 @@ Directed from: $_SERVER[HTTP_REFERER]"; +// echo "
Requested: $_SERVER[REQUEST_URI]"; +// echo "
Loaded: $_SERVER[PHP_SELF]"; -echo "
Directed from: $_SERVER[HTTP_REFERER]"; -echo "
Requested: $_SERVER[REQUEST_URI]"; -echo "
Loaded: $_SERVER[PHP_SELF]"; - -echo "
Go back to Home"; +//echo "
Go back to Home"; +LogError("Request Error: $_GET[error] + REQUEST_URI:$_SERVER[REQUEST_URI] + HTTP_REFERER: $_SERVER[HTTP_REFERER] + REDIRECT_URL: $_SERVER[REDIRECT_URL] + REMOTE_ADDR: $_SERVER[REMOTE_ADDR] +"); ?> + + + +Pathery.com - Error + + + + + + +
+

Oh bother. An Error occured.

+

Something happened.. Not sure what... +
Well I know some things, but I just don't think you care about the details. +
I logged the error and i'll look at it later. - But if this keeps happening please email me. +
Snap@pathery.com +
+

+ +

+Back to ? +

+
+ + + \ No newline at end of file diff --git a/globe.php b/globe.php index 45fd051..2e75a9a 100644 --- a/globe.php +++ b/globe.php @@ -11,11 +11,17 @@ if (!session_id()) //$mydomain = "http://www.mazetd.4xg.net/"; $mydomain = "http://www.pathery.com/"; -//include_once("./includes/header.php"); +function LogError($error) { + + $today = date("Y-m-d H:i:s"); + $fd = fopen("includes/errorlogs.txt", "a"); + fwrite($fd, "$today:$error\n"); + fclose($fd); +} function soundManager1() { -return ' + return '
@@ -24,7 +30,7 @@ return ' } function soundManager2() { -return " + return "