Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: joecool85 - joulukuu 31, 2013, 11:56:44 AP

Otsikko: Display IP address in "banned" notice on site?
Kirjoitti: joecool85 - joulukuu 31, 2013, 11:56:44 AP
Is there a way to have the user's current IP shown on the "banned" message on the site?  This would make it easier when I am troubleshooting for folks that are banned by accident (spammers have caused us to block a handful of IP ranges).
Otsikko: Re: Display IP address in "banned" notice on site?
Kirjoitti: margarett - tammikuu 06, 2014, 07:09:06 IP
You can do this in Sources/Security.php

Find:

// You banned, sucka!
fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']), 'user');

Replace with:

// You banned, sucka!
fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']) . '<br /> Registered IP: ' . $user_info['ip'], 'user');
Otsikko: Re: Display IP address in "banned" notice on site?
Kirjoitti: joecool85 - tammikuu 07, 2014, 12:26:53 IP
Lainaus käyttäjältä: margarett - tammikuu 06, 2014, 07:09:06 IP
You can do this in Sources/Security.php

Find:

// You banned, sucka!
fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']), 'user');

Replace with:

// You banned, sucka!
fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']) . '<br /> Registered IP: ' . $user_info['ip'], 'user');


Perfect!  Thanks!