UtopiaSoftware Forums

Full Version: Ban an IP from making comments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.

I have a site setup using newspro, and one person keeps spamming the comments with, well, spam. My brother has used newspro in the past, and told me he edited one of the files to make it so you couldn't post news from a set up, and instead a window poped up. Is this still possible?
If so, could someone please let me know how.

Thank you.
In comments.php, find:

PHP Code:
// +------------------------------------------------------------------+
// | Check Authorization                                              |
// +------------------------------------------------------------------+ 


Add this under it:

PHP Code:
$bannedip '192.168.0.1';
if (isset(
$_SERVER['HTTP_X_FORWARDED_FOR']))
{
    
$ipaddress $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif (isset(
$_SERVER['HTTP_CLIENT_IP']))
{
    
$ipaddress $_SERVER['HTTP_CLIENT_IP'];
}
else
{
    
$ipaddress $_SERVER['REMOTE_ADDR'];
}
if (
$ipaddress == $bannedip)
{
    
unp_msgBox('You are banned, nublet.');
    exit;


You can edit the $bannedip and the message displayed.

Thanks alot Brian.
Reference URL's