Skip to content

Instantly share code, notes, and snippets.

@Repflez
Created June 20, 2012 22:22
Show Gist options
  • Save Repflez/2962588 to your computer and use it in GitHub Desktop.
Save Repflez/2962588 to your computer and use it in GitHub Desktop.
Personal ABXD upgrade.php
<?php
require('lib/common.php');
// Get user IP. Source: http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
if($loguser['powerlevel'] < 4) // Only founders can upgrade the board.
{
$qIPBan = "insert into {$dbpref}ipbans (ip, reason, date) values ('".getRealIpAddr()."', 'He didn\'t listened', " . (time() + 86400) . ")";
// The ban is for 24 hours.
$rIPBan = Query($qIPBan);
die("This is what we call not listening to the admin.");
}
Upgrade();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment