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
Go to the banning page, enter the username and click 'add'. What's the problem?
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
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);
}
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?
Enable config option 'Show private album Icon to unlogged user'.
One question per thread please.
Locking