coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: gaoyan528 on September 02, 2008, 08:34:00 PM

Title: [Solved]: How can I ban user by username not IP
Post by: gaoyan528 on September 02, 2008, 08:34:00 PM
Hi all, I am using CPG 1.4.x, just thinking how to ban users only by ban the login name not ban the IP address.
Thanks
Title: Re: How can I ban user by username not IP
Post by: Nibbler on September 02, 2008, 08:41:33 PM
Go to the banning page, enter the username and click 'add'. What's the problem?
Title: Re: How can I ban user by username not IP
Post by: gaoyan528 on September 02, 2008, 08:51:07 PM
Sorry, I mean, when a user has been banned. next time, when the banned user log in, system shows a banned mesaage, systems get stuck, and the user can not log off.
So, I would like to know, how can I log off when a banned user loged in.

Thanks
Title: Re: How can I ban user by username not IP
Post by: Nibbler on September 02, 2008, 09:00:38 PM
You could skip the ban check for the logout page I suppose. Edit include/init.inc.php, find


// Check if the user is banned
$user_id = USER_ID;
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_BANNED']} WHERE (ip_addr='$raw_ip' OR ip_addr='$hdr_ip' OR user_id=$user_id) AND brute_force=0");
if (mysql_num_rows($result)) {
        pageheader($lang_error);
        msg_box($lang_info, $lang_errors['banned']);
        pagefooter();
        exit;
}
mysql_free_result($result);


And add a check around it like:


if (!defined('LOGOUT_PHP')) {

// Check if the user is banned
$user_id = USER_ID;
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_BANNED']} WHERE (ip_addr='$raw_ip' OR ip_addr='$hdr_ip' OR user_id=$user_id) AND brute_force=0");
if (mysql_num_rows($result)) {
        pageheader($lang_error);
        msg_box($lang_info, $lang_errors['banned']);
        pagefooter();
        exit;
}
mysql_free_result($result);
}
Title: Re: How can I ban user by username not IP
Post by: gaoyan528 on September 02, 2008, 11:11:48 PM
It works, Thank you so much.

Also, any idea, if I set password to my album, how can I let register user to see my album, and user password to open my album?
Title: Re: [Solved]: How can I ban user by username not IP
Post by: Nibbler on September 03, 2008, 12:19:23 AM
Enable config option 'Show private album Icon to unlogged user'.

One question per thread please.
Title: Re: [Solved]: How can I ban user by username not IP
Post by: Joachim Müller on September 03, 2008, 09:21:19 AM
Locking