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
-
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.
-
Does anybody know, how to do it? I've real attack on my site and I need to block some IP's.
Thank you!
-
Coppermine doesn't log them. Review your server's access logs.
-
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!
-
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.
-
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!
-
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.
-
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:
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 :
$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:
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.
-
Edited your posting, adding some bbcode code tags to make it more readable.
-
thanks for the edit, I am kind of new to forum use.
much more readable now,
thanks again.