<? require_once("../ihs/config.php"); ?>
<? require_once("top_inc.php"); ?>
<?
	$link = mysql_connect($db_server, $db_user, $db_password) or die("Could not connect");
	mysql_select_db($db_name) or die("Could not select database");

	// checked for list
	$ips = $_POST['ips'];
	$submitButton = $_POST['submit'];
	if ($ips != "" || $submitButton != "") {
		mysql_query("delete from blocked") or die("Query failed");
		$array = preg_split( "/\r\n/", $ips );
		foreach ($array as $ip) {
			if ($ip != "") {
				mysql_query("insert into blocked (ip) values ('$ip')") or die("Query failed");
			}
		}
	}

	// get blocked ip addresses
	$query = "SELECT ip from blocked order by ip";
    $result = mysql_query($query) or die("Query failed");
?>
&nbsp;&nbsp;<span class="ctracks">BLOCKED IP ADDRESSES</span><br>
<br>
<hr>
<br>
<div align="center">Enter IP addresses, one per line, and they will be blocked from uploading images.<br>
<br>
<br>
xxx.xxx.xxx.xxx<br>
<form name="blocked" action="<?= $_SERVER['PHP_SELF'] ?>" method="post" style="margin-top: 0px; margin-bottom: 0px;">
<textarea name="ips" cols="18" rows="15">
<?
    while ($line = mysql_fetch_array($result)) {
?>
<?= $line[ip] . "\n" ?>
<?
	}
?>
</textarea>
<br>
<input type="submit" name="submit" value="save list" style="font-size: smaller;">
</form>
</div>
<?
    mysql_free_result($result);
	mysql_close($link);
?>
<? require_once("bottom_inc.php"); ?>