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: [Solved]: How can I ban user by username not IP  (Read 2583 times)

0 Members and 1 Guest are viewing this topic.

gaoyan528

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
[Solved]: How can I ban user by username not IP
« 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
« Last Edit: September 03, 2008, 12:18:01 am by Nibbler »
Logged

Nibbler

  • Guest
Re: How can I ban user by username not IP
« Reply #1 on: September 02, 2008, 08:41:33 pm »

Go to the banning page, enter the username and click 'add'. What's the problem?
Logged

gaoyan528

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: How can I ban user by username not IP
« Reply #2 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
Logged

Nibbler

  • Guest
Re: How can I ban user by username not IP
« Reply #3 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

Code: [Select]
// 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:

Code: [Select]
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);
}
Logged

gaoyan528

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: How can I ban user by username not IP
« Reply #4 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?
Logged

Nibbler

  • Guest
Re: [Solved]: How can I ban user by username not IP
« Reply #5 on: September 03, 2008, 12:19:23 am »

Enable config option 'Show private album Icon to unlogged user'.

One question per thread please.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: How can I ban user by username not IP
« Reply #6 on: September 03, 2008, 09:21:19 am »

Locking
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.