forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Yabba on October 07, 2006, 04:41:27 am

Title: Add or find the log for ip addresses
Post by: Yabba on October 07, 2006, 04:41:27 am
Hi all

Im looking for the function to log the ip addresses in a log file like the security, database, access view in view log files menu. When users log in to the coppermine album.
GauGau has one topic that handles the vote stats on: http://forum.coppermine-gallery.net/index.php?topic=36276.0  he is able to sort out the ip addresses in that topic.

So basicly my question is to add an extra log file with just logins that includes the namne, time, ip-address

Today there is a log file (se attachment) for bad logins  I would like the same structure but an extra log with successful logins instead
Thanks in advanced
Yabba

EDIT: Just to clear it up. I do not wanna know where the user has been on the album just that he/she has logged in and i can see the logg with namen and ip address, i dont have anonymous logins only registered users.
Title: Yes, I need this function too!
Post by: alexunder on January 23, 2008, 09:00:04 am
Does anybody know, how to do it? I've real attack on my site and I need to block some IP's.

Thank you!
Title: Re: Add or find the log for ip addresses
Post by: Joachim Müller on January 23, 2008, 09:15:24 am
Coppermine doesn't log them. Review your server's access logs.
Title: Re: Add or find the log for ip addresses
Post by: alexunder on January 23, 2008, 09:21:51 am
No, I'd like to repeat: my question is to add an extra log file with just logins that includes the namne, time, ip-address (from first post)

Thank you!
Title: Re: Add or find the log for ip addresses
Post by: Joachim Müller on January 23, 2008, 09:24:53 am
Coppermine doesn't log that piece of information. If you need those logs written, you'll have to write that piece of extra code that does this.
Title: Re: Add or find the log for ip addresses
Post by: alexunder on January 23, 2008, 09:31:51 am
You probably understand, that I can't write it.. Just don't know how.

To whom I can ask about, even if I'll have to pay for that?

Thank you very much!
Title: Re: Add or find the log for ip addresses
Post by: Joachim Müller on January 23, 2008, 09:37:28 am
You're welcome to come up with a posting on the board "Looking for Freelancers / Paid help (http://forum.coppermine-gallery.net/index.php?board=30.0)". Read the sticky thread "sub-board rules, read first! (http://forum.coppermine-gallery.net/index.php?topic=8170.0)" on that board first.
Title: Re: Add or find the log for ip addresses
Post by: cpinetree on July 24, 2008, 02:17:40 am
I don't know how safe this code is but it does work:
file to change is:   
login.php

the change I made, and it seems to work with all logging turned on, is as follows:


Code: [Select]
log_write("Success login with Username: {$_POST['username']} from IP {$_SERVER['REMOTE_ADDR']} on " . localised_date(-1,$log_date_fmt),CPG_SECURITY_LOG);
I pasted the above code after :

Code: [Select]
$cookie_warning = '';

if (isset($_POST['submitted'])) {
    if ( $USER_DATA = $cpg_udb->login( addslashes($_POST['username']), addslashes($_POST['password']), isset($_POST['remember_me']) ) ) {
        $referer=preg_replace("'&'","&",$referer);
        pageheader($lang_login_php['login'], "<META http-equiv=\"refresh\" content=\"3;url=$referer\">");
        msg_box($lang_login_php['login'], sprintf($lang_login_php['welcome'], $USER_DATA['user_name']), $lang_continue, $referer);

--------------------added code here approx line # 43-----------------

and before:

Code: [Select]
pagefooter();
        exit;
    } else {
        log_write("Failed login attempt with Username: {$_POST['username']} from IP {$_SERVER['REMOTE_ADDR']} on " . localised_date(-1,$log_date_fmt),CPG_SECURITY_LOG);


hope that helps and makes sense to you.
Title: Re: Add or find the log for ip addresses
Post by: Joachim Müller on July 24, 2008, 07:13:22 am
Edited your posting, adding some bbcode code tags to make it more readable.
Title: Re: Add or find the log for ip addresses
Post by: cpinetree on July 24, 2008, 06:19:49 pm
thanks for the edit, I am kind of new to forum use.
much more readable now,
   thanks again.