<? include('checkcookie.php');
if(isset($_POST[del]))
{
	mysql_query("DELETE FROM seo_blacklist WHERE id='$_POST[del]'");
}
if(isset($_POST[add]))
{
	$reason=$_POST[add];
	$site=$_POST[urlsite];

$site=getHost($site);
$site=str_ireplace("www.","",$site);
mysql_query("INSERT INTO seo_blacklist (site,reason) values ('$site','$reason')") or die(mysql_error());
}
$sql=mysql_query("SELECT * FROM seo_blacklist");
?>
<table class='adn'>
<tr class='lineb'>
<td align=center>URL</td>
<td align=center>Причина</td>
<td align=center>Действие</td>
</tr>
<?
while($row=mysql_fetch_array($sql))
{
	?><tr class='liney ell'>
	<td align=center><a href='http://<?=$row[site]; ?>/' target='_blank'><?=$row[site]; ?></a>
	</td>
	<td align=center><?=$row[reason]; ?></td>
	<td align=center><form action='' method='post'><input type='hidden' name='del' value='<?=$row[id]; ?>'>
	<input type='submit' value='Удалить'>
	</form></td></tr><?
}
?></table><form action='' method='post' id='MainForm'>
<table class="adn">
<tr class="lineb">
<td align="left">Значение</td>
<td align="left"><table class="adn"><tr><td align="left" style="border: none; padding: 0">Описание</td><td align="right" style="border: none; padding: 0"><a href="#" onclick="document.getElementById('MainForm').submit(); return false" class="liv">Добавить</a></td></tr></table></td>
</tr>
<tr class="liney ell">
 <td class="settab listsr"><input type=text value='' name='urlsite'></td>
 <td class="listsl"><b>URL сайта</b><br>Ссылка на блокируемый</td>
</tr>
<tr  class="liney">
 <td class="settab listsr"><input type=text value='' name='add' ></td>
 <td class="listsl"><b>Причина</b><br>Причина блокировки</td>
</tr></table></form>