| Topic Archived |
View previous topic :: View next topic |
| Author |
Message |
Śyama_Dāsa Developer


Offline Joined: Apr 19, 2004 Posts: 2048 Location: Dragonfly CMS Tribe
|
Posted: Sat Jun 12, 2004 5:54 am Post subject: error.php write to log |
|
The email feature is a good idea except you get bombarded with email The following is a mod to write to file:
find line 6
replace with
| PHP: |
$email = false; $error_log = true;
|
find line 91
| PHP: |
if ($email) notify();
|
replace with
| PHP: |
if ($email) notify(); if ($error_log) cpg_error_log();
|
at the end of the filee find
replace with:
| Code:: |
function cpg_error_log(){
global $notify, $sitename, $notifyfrom,$errorCode;
$date = date('D M j G:i:s T Y');
$message = "
------------------------------------------------------------------------------
Error Code:\t {$_SERVER['REDIRECT_STATUS']} ({$_SERVER['REDIRECT_ERROR_NOTES']})
Occurred:\t$date
Requested URL:\t{$_SERVER['REQUEST_URI']}
User Address:\t{$_SERVER['REMOTE_ADDR']}
User Agent:\t{$_SERVER['HTTP_USER_AGENT']}
Referer:\t{$_SERVER['HTTP_REFERER']}
------------------------------------------------------------------------------";
$fp = fopen( "cpg_error.log", "a" ) or die("couldn't open");
flock( $fp, LOCK_EX ); // exclusive lock
// write to the file
fwrite( $fp, $message );
flock( $fp, LOCK_UN ); // release the lock
fclose( $fp );
}
?> |
create a blank file in your root called cpg_error.log and chmod 722
_________________ AKA Akamu / Read these and your life will be successful | Find a Repair
--
Mods and Professional Support via YIM
Śyama_Dāsa's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) win32 / Apache 1.3.33 / MySQL 4.1.16/PHP 4.4/CPG-CVS ( browsers: Mozilla 1.7.x / IE6 / Opera 8.0)
|
|
| Back to top |
|
 |
NEMINI Diamond Supporter


Offline Joined: Apr 22, 2004 Posts: 4551
|
Posted: Sat Jun 12, 2004 5:56 am Post subject: Re: error.php write to log |
|
yep I will definately be testing this out, thaanks akamu.
_________________ NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org
NEMINI's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) 1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS
|
|
| Back to top |
|
 |
NEMINI Diamond Supporter


Offline Joined: Apr 22, 2004 Posts: 4551
|
Posted: Sun Jun 13, 2004 4:39 pm Post subject: Re: error.php write to log |
|
I hope this gets added to cvs and future releases, its a wonderful option
_________________ NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org
NEMINI's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) 1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS
|
|
| Back to top |
|
 |
alexm 500+ Posts Club


Offline Joined: Apr 20, 2004 Posts: 574 Location: Lafayette, LA USA
|
Posted: Sun Jun 13, 2004 5:30 pm Post subject: Re: error.php write to log |
|
| akamu wrote: |
| The email feature is a good idea except you get bombarded with email The following is a mod to write to file: |
Just out of curiosity... Is there a reason this wasn't "write to a database log?" (cms_errorlog)??
alexm's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Shared Host / Linux / Apache 1.3.23 / Mysql 3.23.58 / PHP 4.3.3 / CPG 8.2b & 8.3CVS
|
|
| Back to top |
|
 |
kegobeer Heavy poster


Offline Joined: Apr 19, 2004 Posts: 229
|
Posted: Sun Jun 13, 2004 5:59 pm Post subject: Re: error.php write to log |
|
When I get hit over 150 times in a minute, I know I don't want my db going into overdrive! I'd much rather a text file get written to. Plus, it's much easier to get rid of, IMO.
_________________ Don't PM questions to me. Instead, post them in the forums. That's the best way to help the CPGNuke community!
kegobeer please enter your server specs in your user profile!
|
|
| Back to top |
|
 |
Jeruvy Security Team


Offline Joined: Apr 23, 2004 Posts: 1432 Location: Canada
|
Posted: Tue Jun 15, 2004 5:30 pm Post subject: Re: error.php write to log |
|
Will this be an option in config?
I personally prefer the email, since I farm that process off server.
But I certainly see your point kegobeer
Thanks
_________________ J.
j e r u v y a t y a h o o d o t c o m
Need help? Look here: www.dragonflycms.org/W...d=112.html
Need to chat? Look for me on irc.freenode.net
Jeruvy's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Ubuntu7.10/Debian3.1 - 2.2.3/1.3.37 - 5.0.38/4.0.27 - 5.2.1/4.4.7 - CVS/9.1.2}
|
|
| Back to top |
|
 |
mazhive Newbie


Offline Joined: Sep 28, 2004 Posts: 30
|
Posted: Tue Sep 28, 2004 8:06 pm Post subject: Re: error.php write to log |
|
nice feature but after applying i get this message..
Fatal error: Cannot redeclare cpg_error_log() (previously declared in /home/vanvoorn/public_html/error.php:158) in
do i need to inclose the error.php ??
mazhive's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) linux/1.3.31 /4.0.20 /4.3.8/8.2b
|
|
| Back to top |
|
 |
NEMINI Diamond Supporter


Offline Joined: Apr 22, 2004 Posts: 4551
|
Posted: Tue Sep 28, 2004 8:14 pm Post subject: Re: error.php write to log |
|
did you go to error.php to enable the error log or did you manually make edits? if the latter undo then and just go to error.php, the feature should already be there.
_________________ NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org
NEMINI's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) 1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS
|
|
| Back to top |
|
 |
mazhive Newbie


Offline Joined: Sep 28, 2004 Posts: 30
|
Posted: Tue Sep 28, 2004 8:47 pm Post subject: Re: error.php write to log |
|
i manually editit in notepad
i use the latest version of cpgnuke
mazhive's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) linux/1.3.31 /4.0.20 /4.3.8/8.2b
Last edited by mazhive on Tue Sep 28, 2004 8:51 pm; edited 1 time in total |
|
| Back to top |
|
 |
NEMINI Diamond Supporter


Offline Joined: Apr 22, 2004 Posts: 4551
|
Posted: Tue Sep 28, 2004 8:50 pm Post subject: Re: error.php write to log |
|
you do not need to edit files you simply need to setup the proper values in error.php
| PHP: |
$notify = 'myname@website.com'; $notifyfrom = 'webmaster@website.com'; $returnsite = 'http://www.website.com'; $email = false; # to use this you must create cpg_error.log # and chmod cpg_error.log 722 $error_log = true; $sitename = 'My Web Site'; $returnLink = 'Please <a href="'.$returnsite.'">click here</a> to return to the homepage.'; $image = '/images/error.gif';
|
_________________ NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org
NEMINI's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) 1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS
|
|
| Back to top |
|
 |
mazhive Newbie


Offline Joined: Sep 28, 2004 Posts: 30
|
Posted: Tue Sep 28, 2004 9:00 pm Post subject: Re: error.php write to log |
|
oh well oke.. i see.. i thought some other kind of message was returning to the screen then
A billion websites, and you had to pick this one.
My Web Site Error 403
Access to the URL that you requested, /config.php, is forbidden.
(client denied by server configuration)
Please click here to return to the homepage.
something like ... we have been loging your ip and will send it to.... blablba... but .. i gues this is only in the email variant enabled.. ?? not the file logging enabled. ....
well it seems to work after i made an empty file with the name cpg_error.log so thanx for your fast reply
mazhive's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) linux/1.3.31 /4.0.20 /4.3.8/8.2b
|
|
| Back to top |
|
 |
|
|