Jump to content
MakeWebGames

Recommended Posts

Posted

Okay I have added the IP ban manager and view ban manager from this site, It's one mod not two.

I have people on my game (Admins) banning people and I want to see what IP they ban and have it added to the staff log I have got this far and I will tell you the errors of the code that I have provided

 

function ipban()
{
?><h3>Ban an IP</h3>
<form action='staff.php?action=ipbancon' method='post'>
<input type="text" name="ip" />
<input type='submit' value='BAN!' /></form>
<hr width="50%" />
[url="staff.php?action=ipbanview"][b]Click to view current IP bans[/b][/url]
stafflog_add("Banned a IP");
<?
}
function ipbancon()
{
$filename='/home/ganja360/public_html/ipbans/'.$_POST['ip'];
$file=fopen($filename,w) or die("Error Creating File");
fclose($file);
?>Done 

[url="staff.php?action=ipbanview"][b]Back[/b][/url]<?
}
function ipbanview()
{
$dir = "/home/ganja360/public_html/ipbans/";
?>
<h3>Viewing banned IP's</h3>
<table border="1">
<tr>
<th>
IP
</th>
<th>
Delete?
</th>
</tr><?
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (strlen($file)>4)
{
?>
<tr>
<td>
<? echo $file; ?>
</td>
<td>
[url="staff.php?action=ipbanremove&ip=<? echo $file; ?>"][b][img=imageicons/decline.png][/b][/url]
stafflog_add("Viewed the banned IP page");

</td>
</tr>
<?
}
}
closedir($dh);
}
}
?></table>

[url="staff.php"][b]Back[/b][/url]


<?

}
function ipbanremove()
{
$file=$_GET['ip'];
$filepath = "/home/ganja360/public_html/ipbans/".$file;
if (! unlink ($filepath)) {
echo "Couldn't delete file";
} else {
echo "Removed IP: ".$file;
stafflog_add("Removed a banned IP");
}
?>

[url="staff.php?action=ipbanview"][b]Back[/b][/url]

<?
}
function lstaffaps()
{
global $db,$ir,$c,$h,$userid,$set;
if($ir['user_level'] != 2)
{
die("403");
}
$_GET['lock'] = abs((int) $_GET['lock']);
if($_GET['lock'] == '1')
{
$db->query("UPDATE `settings` SET conf_value='Locked' WHERE conf_name='stafflock'");
stafflog_add("Locked Staff Applications.");
echo "Staff applications are now locked.
>[url='staff.php']Go Back[/url]";
$h->endpage();
exit;
}
else if($_GET['lock'] == '2')
{
$db->query("UPDATE `settings` SET conf_value='Unlocked' WHERE conf_name='stafflock'");
stafflog_add("Unlocked Staff Applications.");
echo "Staff applications are now unlocked.
>[url='staff.php']Go Back[/url]";
$h->endpage();
exit;
}
}

 

The error in that code is that when I ban a IP it says Back then it says right beside that stafflog add etc. Then viewing a banned IP I also see the stafflog add stuff. The only code on that that works is the removeale. When I remove one it actually pastes it into the staff log saying Removed a IP.

I would like it to display what IP's are added to the ban manger and what IP was removed is that possible guys???

I tried to do this before to the same mod and I couldn't do it I think I have the stafflog_add(blah); in the wrong place.

?(

  • 1 month later...
Posted

replace with the following and edit your hyperlinks to staff.php instead of mine with is staff_special.php as appropriate and the "/home/ganja360/public_html/ipbans/ bits as mine obviously differ

This code will log which admin banned aswell as the ip and time in staff logs

This code will log which admin unbanned aswell as the ip and time in staff logs

Hope this helps old post with no replys if you ever get it

function ipban() 
{ 
?><h3>Ban an IP</h3> 
<form action='staff_special.php?action=ipbancon' method='post'> 
<input type="text" name="ip" /> 
<input type='submit' value='BAN!' /></form> 
<hr width="50%" /> 
<a href="staff_special.php?action=ipbanview">[b]Click to view current IP bans[/b]

[url="staff.php"][b]Back To Staff Pannel[/b][/url] 
<? 
} 
function ipbancon() 
{ 
$filename='/home/tenterfi/public_html/testing/ipbans/'.$_POST['ip']; 
$file=fopen($filename,w) or die("Error Creating File"); 
fclose($file); 
?>IP added to banlist

[url="staff_special.php?action=ipbanview"][b]Back[/b][/url]<? 
stafflog_add("Banned IP {$_POST['ip']}"); 
} 
function ipbanview() 
{ 
$dir = "/home/tenterfi/public_html/testing/ipbans/"; 
?> 
<h3>Viewing banned IP's</h3> 
<table border="1"> 
<tr> 
<th> 
IP 
</th> 
<th> 
Delete? 
</th> 
</tr><? 
if (is_dir($dir)) { 
if ($dh = opendir($dir)) { 
while (($file = readdir($dh)) !== false) { 
if (strlen($file)>4) 
{ 
?> 
<tr> 
<td> 
<? echo $file; ?> 
</td> 
<td> 
[url="staff_special.php?action=ipbanremove&ip=<? echo $file; ?>"][b]Delete[/b][/url] 
</td> 
</tr> 
<? 
} 
} 
closedir($dh); 
} 
} 
?></table>

[url="staff_special.php?action=ipban"][b]Back To Ban IP[/b][/url]

[url="staff.php"][b]Back To Staff Panel[/b][/url]
<? 

} 
function ipbanremove() 
{ 
$file=$_GET['ip']; 
$filepath = "/home/tenterfi/public_html/testing/ipbans/".$file; 
if (! unlink ($filepath)) { 
echo "Couldn't delete file"; 
} else { 
echo "IP $file removed from banlist"; 
stafflog_add("Unbanned IP $file"); 
} 
?>

[url="staff_special.php?action=ipbanview"][b]Back[/b][/url]<? 
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...