Home Private Messages Search
CPG Dragonfly™ CMS stopsoftwarepatents.eu petition banner
Toggle Content
 
Forums ⇒ CMS (All) ⇒ Security :: Archives ⇒ error.php write to log :: Archived


error.php write to log :: Archived
Post any security related questions in here.
Please send discovered reports to security @ cpgnuke.com
Do Not post links to exploits or hacker sites - your post will be edited/deleted.
If you think you've been hacked, FIRST go through your server logs.

Post new topic    Revive this topic    Printer Friendly Page     Forum Index ⇒  Security

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

Offline Offline
Joined: Apr 19, 2004
Posts: 2048
Location: Dragonfly CMS Tribe
PostPosted: 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
PHP:
$email = false;
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
Code::
?>
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
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
NEMINI
Diamond Supporter
Diamond Supporter

Offline Offline
Joined: Apr 22, 2004
Posts: 4551

PostPosted: 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
View user's profile Visit poster's website Photo Gallery
NEMINI
Diamond Supporter
Diamond Supporter

Offline Offline
Joined: Apr 22, 2004
Posts: 4551

PostPosted: 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
View user's profile Visit poster's website Photo Gallery
alexm
500+ Posts Club
500+ Posts Club

Offline Offline
Joined: Apr 20, 2004
Posts: 574
Location: Lafayette, LA USA
PostPosted: 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
View user's profile Visit poster's website Photo Gallery
kegobeer
Heavy poster
Heavy poster

Offline Offline
Joined: Apr 19, 2004
Posts: 229

PostPosted: 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! Crying or Very sad
Back to top
View user's profile Visit poster's website
Jeruvy
Security Team
Security Team

Offline Offline
Joined: Apr 23, 2004
Posts: 1432
Location: Canada
PostPosted: 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 Exclamation

Thanks Wink

_________________
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
View user's profile ICQ Number Yahoo Messenger Photo Gallery
mazhive
Newbie
Newbie

Offline Offline
Joined: Sep 28, 2004
Posts: 30

PostPosted: 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
View user's profile Visit poster's website
NEMINI
Diamond Supporter
Diamond Supporter

Offline Offline
Joined: Apr 22, 2004
Posts: 4551

PostPosted: 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
View user's profile Visit poster's website Photo Gallery
mazhive
Newbie
Newbie

Offline Offline
Joined: Sep 28, 2004
Posts: 30

PostPosted: 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
View user's profile Visit poster's website
NEMINI
Diamond Supporter
Diamond Supporter

Offline Offline
Joined: Apr 22, 2004
Posts: 4551

PostPosted: 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
View user's profile Visit poster's website Photo Gallery
mazhive
Newbie
Newbie

Offline Offline
Joined: Sep 28, 2004
Posts: 30

PostPosted: 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 Smile


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
View user's profile Visit poster's website
Display posts from previous:   
Post new topic    Revive this topic    Printer Friendly Page    Forum Index ⇒  Security
Page 1 of 1
All times are GMT

Archive Revive
Username:
This is an archived topic - your reply will not be appended here.
Instead, a new topic will be generated in the active forum.
The new topic will provide a reference link to this archived topic.
 
   Toggle Content User Info

Welcome Anonymous

Nickname
Password
(Register)

   Toggle Content Last CVS commits
· Fixed .ico Expires header.
· Removed domain name from cookies so subdomains wont access them anymore.
· CSS and JS, case insensitives.
· CSS and JS, send correct HTTP 1.1 headers and fixed issues where themes and...
· Further security class improvements.
· 301 redirects on LEO changes
· Option to force 3xx http status codes
· Validate googlebot.com and google.com crawlers.
· CCBot
· Rss with etag and atom.

lesa meira...

   Toggle Content Community

Support for DragonflyCMS in a other languages:

Deutsch
Español

   Toggle Content X-links
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
Interactive software released under GNU GPL, Code Credits, Privacy Policy