Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Add or find the log for ip addresses  (Read 6368 times)

0 Members and 1 Guest are viewing this topic.

Yabba

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Add or find the log for ip addresses
« 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.
« Last Edit: October 10, 2006, 07:56:36 am by Yabba »
Logged
We all cannot be pro on coding. (If so all professional programmers schould be unemployed)
Fortunately the rest of us are pro's on other stuff at least this applies to me

alexunder

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Art of Charm
Yes, I need this function too!
« Reply #1 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!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add or find the log for ip addresses
« Reply #2 on: January 23, 2008, 09:15:24 am »

Coppermine doesn't log them. Review your server's access logs.
Logged

alexunder

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Art of Charm
Re: Add or find the log for ip addresses
« Reply #3 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!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add or find the log for ip addresses
« Reply #4 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.
Logged

alexunder

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Art of Charm
Re: Add or find the log for ip addresses
« Reply #5 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!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add or find the log for ip addresses
« Reply #6 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". Read the sticky thread "sub-board rules, read first!" on that board first.
Logged

cpinetree

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Add or find the log for ip addresses
« Reply #7 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.
« Last Edit: July 24, 2008, 07:12:46 am by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add or find the log for ip addresses
« Reply #8 on: July 24, 2008, 07:13:22 am »

Edited your posting, adding some bbcode code tags to make it more readable.
Logged

cpinetree

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Add or find the log for ip addresses
« Reply #9 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.386 seconds with 20 queries.