Dragonfly CMS logo Server sponsored and hosted by
DedicatedNOW
CVS logo  
.:: Home :: Dev. Resources :: Forums ::.
Dragonfly CMS CVS Repository
 Location: / cvs / html / error.php
This is a web interface to the Dragonfly CMS CVS tree. You can browse the file hierarchy by picking directories. If you pick a file, you will see the revision history for that file.
Selecting a revision number will show that revision of the file. There are links at each revision to display diffs, annotate and download.
Note: Info about CVS and our commits can be found at our CVS Info Forum
File name: html/error.php
Revision : 9.3 (5 years 6 months 2 weeks 1 days 3 hours 50 minutes 16 seconds ago) by trevor
Changed : +4 -4 lines
Comment: Small cleanup


# Author Rev Line
1 djmaze 1.1 <?php
2 trevor 1.3 /*********************************************
3 djmaze 9.2 CPG Dragonfly™ CMS
4 trevor 1.3 ********************************************
5 djmaze 9.2 Copyright © 2004 - 2005 by CPG-Nuke Dev Team
6 djmaze 8.5 http://www.dragonflycms.com
7 trevor 1.3  
8 djmaze 8.5 Dragonfly is released under the terms and conditions
9 djmaze 8.2 of the GNU GPL version 2 or any later version
10 trevor 1.3  
11 trevor 9.3 $Source: /cvs/html/error.php,v $
12 trevor 9.3 $Revision: 9.2 $
13 djmaze 8.5 $Author: djmaze $
14 trevor 9.3 $Date: 2005/02/07 09:26:12 $
15 djmaze 8.5 **********************************************/
16 djmaze 9.1 error_reporting(0);
17 djmaze 9.1 $notify = 'webmaster@'.$_SERVER['SERVER_NAME'];
18 djmaze 9.1 $notifyfrom = 'noreply@'.$_SERVER['SERVER_NAME'];
19 akamu 8.1 $returnsite = $_SERVER['HTTP_HOST'];
20 djmaze 1.1 $email = false;
21 trevor 8.3 # to activate error logging, you must CHMOD cpg_error.log 600 (622 if 600 fails)
22 djmaze 1.1 $error_log = false;
23 djmaze 1.1 $sitename = 'My Web Site';
24 trevor 8.4 $returnLink = 'Please <a href="http://'.$returnsite.'">return to the homepage</a>';
25 trevor 1.8 $image = '/images/error.gif';
26 djmaze 1.1  
27 djmaze 1.1 $webMsg = array();
28 djmaze 1.1 // English
29 trevor 1.3 $webMsg['400'] = 'The URL that you requested, '.$_SERVER['REQUEST_URI'].', was a bad request.';
30 trevor 1.3 $webMsg['401'] = 'The URL that you requested, '.$_SERVER['REQUEST_URI'].', requires preauthorization to access.';
31 djmaze 1.1 $webMsg['403'] = 'Access to the URL that you requested, '.$_SERVER['REQUEST_URI'].', is forbidden.';
32 trevor 8.4 $webMsg['404'] = 'The URL that you requested, '.$_SERVER['REQUEST_URI'].', could not be found. Perhaps you either mistyped the URL or we have a broken link.'.(($error_log || $email) ? '<br /><br />We have logged this error and will correct the problem if it is a broken link.' : '');
33 trevor 1.3 $webMsg['500'] = 'The URL that you requested, '.$_SERVER['REQUEST_URI'].', resulted in a server configuration error. It is possible that the condition causing the problem will be gone by the time you finish reading this.<br /><br />We have logged this error and will correct the problem.';
34 djmaze 1.1  
35 djmaze 1.1 $css = '
36 djmaze 1.1 body {
37 djmaze 1.1 background-color: #fff;
38 trevor 8.4 font-family: Verdana,Helvetica;
39 trevor 8.4 font-size: 10px;
40 djmaze 1.1 color: #000;
41 djmaze 1.1 }
42 djmaze 1.1 a:link,a:active,a:visited {
43 djmaze 1.1 font-weight: bold;
44 djmaze 1.1 text-decoration: none;
45 djmaze 1.1 color: blue;
46 djmaze 1.1 }
47 djmaze 1.1 a:hover {
48 djmaze 1.1 font-weight: bold;
49 djmaze 1.1 text-decoration: underline;
50 djmaze 1.1 color: blue;
51 djmaze 1.1 }
52 djmaze 1.1 div.container {
53 djmaze 1.1 width: 550px;
54 djmaze 1.1 text-align: center;
55 djmaze 1.1 margin-left: auto;
56 djmaze 1.1 margin-right: auto;
57 djmaze 1.1 margin-top: 150px;
58 djmaze 1.1 border: thin solid #000;
59 djmaze 1.1 }
60 djmaze 1.1 div.imageBox {
61 djmaze 1.1 background-color: #fff;
62 djmaze 1.1 float: left;
63 djmaze 1.1 width: 30%;
64 djmaze 1.1 border-right: thin solid #000;
65 djmaze 1.1 height: 250px;
66 djmaze 1.1 padding: 5px;
67 djmaze 1.1 }
68 djmaze 1.1 div.textBox {
69 djmaze 1.1 padding: 5px;
70 djmaze 1.1 background-color: #dedef6;
71 djmaze 1.1 text-align: center;
72 djmaze 1.1 height: 250px;
73 djmaze 1.1 }
74 djmaze 1.1 div.errorHeader {
75 trevor 8.4 color: #666;
76 trevor 8.4 font-size: 11px;
77 trevor 8.4 margin-bottom: 10px;
78 trevor 8.4 }
79 trevor 8.4 div.errorNotes {
80 djmaze 1.1 color: #dd0101;
81 djmaze 1.1 font-weight: bold;
82 trevor 8.4 font-size: 12px;
83 djmaze 1.1 margin-bottom: 10px;
84 djmaze 1.1 }
85 djmaze 1.1 div.error {
86 djmaze 1.1 font-weight: bold;
87 djmaze 1.1 margin-bottom: 10px;
88 djmaze 1.1 }
89 djmaze 1.1 div.errorDetails {
90 djmaze 1.1 font-size: small;
91 djmaze 1.1 font-weight: bold;
92 djmaze 1.1 }
93 djmaze 1.1 div.return {
94 djmaze 1.1 font-weight: small;
95 djmaze 1.1 }';
96 djmaze 1.1  
97 djmaze 1.6 print_page();
98 djmaze 1.6 if ($email) notify();
99 djmaze 1.6 if ($error_log) cpg_error_log();
100 djmaze 1.1  
101 djmaze 1.1 function print_page()
102 djmaze 1.1 {
103 djmaze 1.1 global $image, $webMsg, $css, $sitename, $returnLink;
104 djmaze 1.1 // take off the path to the script, we don't want them to see that
105 trevor 8.4 $error_notes = ucfirst(preg_replace('/:.*/', '', $_SERVER['REDIRECT_ERROR_NOTES']));
106 djmaze 1.1 $errorCode = $_SERVER['REDIRECT_STATUS'];// $_SERVER['QUERY_STRING'];
107 djmaze 1.1 $webMsg = $webMsg[$errorCode];
108 djmaze 1.1 if (eregi('My_eGallery', $_SERVER['REQUEST_URI'])) {
109 trevor 9.3 $webMsg = 'Do you think we are really that stupid to run My eGallery so that you can hack it?<br />Think again. Coppermine rules!';
110 djmaze 1.1 } else if (eregi('modules/coppermine', $_SERVER['REQUEST_URI'])) {
111 trevor 1.4 $webMsg = 'Your hack attempt has been recorded.<br />The IP Address that you used for this attempt, '.$_SERVER['REMOTE_ADDR'].', will be sent to your ISP.';
112 trevor 8.4 header('HTTP/1.0 404 Not Found');
113 djmaze 1.1 }
114 djmaze 1.1  
115 djmaze 1.1 echo <<< EOT
116 trevor 8.4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
117 trevor 8.4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
118 djmaze 1.1 <html>
119 djmaze 1.1 <head>
120 trevor 8.4 <title>$errorCode Error</title>
121 trevor 8.4 <style type="text/css">
122 djmaze 1.1 $css
123 djmaze 1.1 </style>
124 djmaze 1.1 </head>
125 djmaze 1.1 </html>
126 djmaze 1.1 <body>
127 djmaze 1.1 <div class="container">
128 trevor 8.4 <div class="imageBox"><img src="$image" alt="" /></div>
129 djmaze 1.1 <div class="textBox">
130 trevor 8.4 <div class="errorHeader">More than a billion websites, and you had to pick this one</div><br />
131 trevor 8.4 <div class="errorNotes">$error_notes</div>
132 trevor 8.4 <div class="error">$webMsg</div><br />
133 djmaze 1.1 <div class="return">$returnLink</div>
134 djmaze 1.1 </div>
135 djmaze 1.1 </div>
136 djmaze 1.1 </body>
137 djmaze 1.1 </html>
138 djmaze 1.1 EOT;
139 djmaze 1.1 }
140 djmaze 1.1  
141 trevor 8.4 function notify() {
142 djmaze 1.1 global $notify, $sitename, $notifyfrom;
143 djmaze 1.1 $date = date('D M j G:i:s T Y');
144 djmaze 1.1 $message = "
145 djmaze 1.1 ------------------------------------------------------------------------------
146 djmaze 1.1 Site:\t\t$sitename ({$_SERVER['SERVER_NAME']})
147 djmaze 9.1 Error Code:\t{$_SERVER['REDIRECT_STATUS']} ({$_SERVER['REDIRECT_ERROR_NOTES']})
148 djmaze 1.1 Occurred:\t$date
149 djmaze 1.1 Requested URL:\t{$_SERVER['REQUEST_URI']}
150 djmaze 1.1 User Address:\t{$_SERVER['REMOTE_ADDR']}
151 djmaze 1.1 User Agent:\t{$_SERVER['HTTP_USER_AGENT']}
152 djmaze 1.1 Referer:\t{$_SERVER['HTTP_REFERER']}
153 djmaze 1.1 ------------------------------------------------------------------------------";
154 djmaze 1.1 mail($notify, "[ $sitename Error: 404 ]", $message, "From: $notifyfrom");
155 djmaze 1.1 }
156 trevor 8.4 function cpg_error_log() {
157 djmaze 1.1 global $notify, $sitename, $notifyfrom,$errorCode;
158 djmaze 1.1 $date = date('D M j G:i:s T Y');
159 djmaze 1.1 $message = "
160 djmaze 1.1 ------------------------------------------------------------------------------
161 djmaze 9.1 Error Code:\t{$_SERVER['REDIRECT_STATUS']} ({$_SERVER['REDIRECT_ERROR_NOTES']})
162 djmaze 1.1 Occurred:\t$date
163 djmaze 1.1 Requested URL:\t{$_SERVER['REQUEST_URI']}
164 djmaze 1.1 User Address:\t{$_SERVER['REMOTE_ADDR']}
165 djmaze 1.1 User Agent:\t{$_SERVER['HTTP_USER_AGENT']}
166 djmaze 1.1 Referer:\t{$_SERVER['HTTP_REFERER']}
167 djmaze 1.1 ------------------------------------------------------------------------------";
168 djmaze 9.1 if (!($fp = fopen("cpg_error.log", "a"))) exit;
169 djmaze 1.1 flock( $fp, LOCK_EX ); // exclusive lock
170 djmaze 1.1 // write to the file
171 djmaze 1.1 fwrite( $fp, $message );
172 djmaze 1.1 flock( $fp, LOCK_UN ); // release the lock
173 djmaze 1.1 fclose( $fp );
174 djmaze 9.1 }


Code Credits - Privacy Policy