diff options
-rw-r--r-- | .htaccess | 36 | ||||
-rw-r--r-- | errors.php | 81 | ||||
-rw-r--r-- | globe.php | 18 | ||||
-rw-r--r-- | images/.htaccess | 4 | ||||
-rw-r--r-- | index.php | 26 | ||||
-rw-r--r-- | pages/admin.php | 13 | ||||
-rw-r--r-- | pages/cp.php | 4 | ||||
-rw-r--r-- | sounds/.htaccess | 15 |
8 files changed, 173 insertions, 24 deletions
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
+<filesMatch "\.(css|js)$">
+Header set Cache-Control "max-age=290304000, public"
+</filesMatch>
+
+
+<ifModule mod_gzip.c>
+ 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.*
+</ifModule>
\ No newline at end of file @@ -1,11 +1,80 @@ <?PHP
+include("globe.php");
-echo "You're here because of error: $_GET[error] ";
+// echo "You're here because of error: $_GET[error] ";
+// echo "<br />Directed from: $_SERVER[HTTP_REFERER]";
+// echo "<br />Requested: $_SERVER[REQUEST_URI]";
+// echo "<br />Loaded: $_SERVER[PHP_SELF]";
-echo "<br />Directed from: $_SERVER[HTTP_REFERER]";
-echo "<br />Requested: $_SERVER[REQUEST_URI]";
-echo "<br />Loaded: $_SERVER[PHP_SELF]";
-
-echo "<br /><a href='http://www.pathery.com'>Go back to Home</a>";
+//echo "<br /><a href='$mydomain'>Go back to Home</a>";
+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]
+");
?>
+<html>
+
+<head>
+<title>Pathery.com - Error</title>
+
+<style>
+body {
+background-color: #121212;
+color:#ddd
+}
+
+.update {
+ background-color: #222229;
+ margin:0 auto;
+ margin-top: 200px;
+ width:400px;
+ border: 0px outset #aaa;
+ padding: 10px;
+ border-radius: 25px;
+}
+h3 {
+ text-align: center;
+}
+
+.buttons a {
+ margin: 10px;
+ opacity: 0.7;
+ filter: alpha(opacity=70);
+}
+.buttons a:hover {
+ opacity: 1;
+ filter: alpha(opacity=100);
+}
+
+a {
+ text-decoration: underline;
+ color: #aaaa99;
+}
+a:hover {
+ text-decoration: underline;
+ color: #FFFFFF;
+}
+</style>
+
+</head>
+<body>
+
+<div class='update'>
+<h3>Oh bother. An Error occured.</h3>
+<p>Something happened.. Not sure what...
+<br />Well I know some things, but I just don't think you care about the details.
+<br />I logged the error and i'll look at it later. - But if this keeps happening please email me.
+<br /><a href='mailto:snap@pathery.com' target='top'>Snap@pathery.com</a>
+<br />
+</p>
+
+<p>
+<a href='<? echo $mydomain; ?>'>Back to <? echo $mydomain; ?></a>?
+</p>
+</div>
+
+</body>
+</html>
\ No newline at end of file @@ -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 '
<div>
<script src="sounds/script/soundmanager.js"></script>
<script type="text/javascript">soundManagerInit();</script>
@@ -24,7 +30,7 @@ return ' }
function soundManager2() {
-return "
+ return "
<script src='sounds/script/soundmanager2-nodebug-jsmin.js'></script>
<script>
soundManager.setup({
@@ -50,8 +56,6 @@ soundManager.setup({ }
-
-
function sql_clean($string) {
if (get_magic_quotes_gpc()) {
$string = stripslashes($string);
@@ -159,8 +163,8 @@ Function CheckAuth($page) { }
//TODO: Contains domain !!
-Function DoRedirect($message = "Thanks", $to = "http://www.pathery.com/", $duration = "3") {
- $to=(is_null($to)?'http://www.pathery.com/':$to);
+Function DoRedirect($message = "Thanks", $to = NULL, $duration = "3") {
+ $to=(is_null($to)?$mydomain:$to);
if ($duration == 0) {
header("Location: $to");
diff --git a/images/.htaccess b/images/.htaccess new file mode 100644 index 0000000..05bc7d9 --- /dev/null +++ b/images/.htaccess @@ -0,0 +1,4 @@ +# 480 weeks
+<filesMatch "\.(jpg|jpeg|png|gif)$">
+Header set Cache-Control "max-age=290304000, public"
+</filesMatch>
\ No newline at end of file @@ -200,21 +200,31 @@ switch ($request) { require 'pages/chat.php';
break;
-
case "admin":
- if ($_SESSION['isAdmin'] == true)
+ if ($_SESSION['isAdmin'] == true) {
require 'pages/admin.php';
- else
+ } else {
require 'pages/about.php';
- break;
+ }
+ break;
case "massemail":
- if ($_SESSION['isAdmin'] == true)
+ if ($_SESSION['isAdmin'] == true) {
require 'pages/massemail.php';
- else
+ } else {
require 'pages/about.php';
- break;
-
+ }
+ break;
+
+ case "errorlogs":
+ if ($_SESSION['isAdmin'] == true) {
+ header("Content-Type: text/plain");
+ require 'includes/errorlogs.txt';
+ } else {
+ require 'pages/about.php';
+ }
+ break;
+
case "home":
//No break here
Default:
diff --git a/pages/admin.php b/pages/admin.php index 630879a..bda527d 100644 --- a/pages/admin.php +++ b/pages/admin.php @@ -30,11 +30,17 @@ if ($_GET['applyall'] == 'true') { else if ($_GET['recalcStats'] == 'true') {
echo "Recalculating all player stats...";
flush(); //This sends the above echo
-
recalculateStatsForAllPlayers();
-
echo "Complete!";
}
+else if ($_GET['deleteErrors'] == 'true') {
+ echo "Deleting error log...";
+ flush(); //This sends the above echo
+ $today = date("Y-m-d H:i:s");
+ file_put_contents("includes/errorlogs.txt", "LOG START $today \n");
+
+ echo "Log restarted!";
+}
$sql = "SELECT `ID`, `displayName`, `dateJoined`, `dateLogin`, `email`, `isAdmin` FROM `users`";
@@ -47,7 +53,10 @@ echo ' <p>Buttons:<br />
<input type="button" value="Apply all achievements" onClick="parent.location=\'admin?applyall=true\'">
<input type="button" value="Recalculate all player stats" onClick="parent.location=\'admin?recalcStats=true\'">
+ <input type="button" value="Delete Errorlog" onClick="parent.location=\'admin?deleteErrors=true\'">
</p>
+<p>Links: <a href="errorlogs">View Errorlog.txt</a></p>
+
<p>Hello admins, this is our current userlist.</p>
</center>
<table style="padding-left:20px;">
diff --git a/pages/cp.php b/pages/cp.php index a807200..074a209 100644 --- a/pages/cp.php +++ b/pages/cp.php @@ -34,7 +34,9 @@ if (isset($_POST['displayName'])) { ";
mysql_query($sql);
$_SESSION['displayName'] = $inputname;
- echo "<br /><b>Name change success (Your name may take a moment to be updated)</b> <br />";
+ DoRedirect("Name change success!");
+ exit;
+ //echo "<br /><b>Name change success (Your name may take a moment to be updated)</b> <br />";
} else {
echo "<br />Invalid name";
}
diff --git a/sounds/.htaccess b/sounds/.htaccess new file mode 100644 index 0000000..657e345 --- /dev/null +++ b/sounds/.htaccess @@ -0,0 +1,15 @@ +# 480 weeks
+<FilesMatch "\.(mp3|flv|jpg|jpeg|png|gif|js|swf)$">
+Header set Cache-Control "max-age=290304000, public"
+</FilesMatch>
+
+<ifModule mod_gzip.c>
+ mod_gzip_on Yes
+ mod_gzip_dechunk Yes
+ mod_gzip_item_include file \.(swf|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.*
+</ifModule>
\ No newline at end of file |