<?php
/**********************************************************************/
# Title: MW- ver. 4.1
# Copyright By  Moy-weB  (http://moyweb.moy.su)
# Изготовлениш шаблонов (скинов), разработка дизайна, написание скриптов
# Версия для Lineage-II
# Corsar, I-Andi (2009)
/**********************************************************************/
require_once("header.php");
if ( isset($_GET['id']) && !empty($_GET['id']) )
{
	if (!function_exists('file_put_contents')) 
	{
		function file_put_contents ($filename, $content)
		{
			if ($fp = @fopen($filename, 'w'))
			{
				$result = fwrite($fp, $content);
				fclose ($fp);
				return $result;
			}
			else
			{
				return false;
			}
		}
	}
	$message_array = file("../data/messages.csv");
	$output = "";
	foreach( $message_array as $line )
	{
		$elem = explode(";", $line);
		if ( $_GET['id'] != trim($elem[0]) ) $output .= $line; 
	}
	file_put_contents("../data/messages.csv",$output);
}
?>
<style type="text/css">
.borderOne
{
   border-left: 0px;
   border-right: 1px solid #FF66FF;
   border-top: 0px;
   border-bottom: 0px;
}
    </style>
<br>
<h3>Обратная связь</h3><hr>
<table width=100%>
<tr>
	<td><strong>Дата</strong></td>
	<td><strong>Имя</strong></td>
	<td><strong>E-mail</strong></td>
	<td><strong>Сайт</strong></td>
	<td><strong>Сообщение</strong></td>
	<td></td>
</tr>
<?php
$message_file = file("../data/messages.csv");
foreach($message_file as $line)
{
	$elem = explode(";",$line);
	echo('<tr style="background-color:#FFF;">
			<td  ><p style="margin:3px;">'.$elem[1].'</p></td>
			<td  >'.$elem[2].' </td>
			<td  >'.$elem[3].' </td>
			<td  >'.$elem[4].' </td>
			<td  >'.$elem[5].' </td>
			<td  ><a href=feedback.php?id='.$elem[0].'><img src=images/remove.png></a></td>
			</tr>');	
}
echo("</table>");

require_once("footer.php");
?>