<?
error_reporting(E_ALL^E_NOTICE);
if(isset($_FILES['file']))
{
$type = $_FILES['file']['type'];
if ($type!=='image/jpeg' && $type!=='image/jpg' && $type!=='image/gif' && $type!=='image/png'){$err=1;err_game('Это не картинка');}


if (!isset($err))
{
$tmp = $_FILES['file']['tmp_name'];
move_uploaded_file($tmp, "images/avatars/$ku[id].png");
//mysql_query("UPDATE `kolhoz_user` SET `ava` = '$ku[id].png' WHERE `id` = '$ku[id]'");
header("location: ?user=$ku[id]");
}
}
echo '<div class="event"><h1>Настройка аватара</h1></div>';
echo "</div><div class='block'>Ваш текущий аватар:</br>";
if (file_exists('images/avatars/'.$ku['id'].'.png')){echo "<img src='images/avatars/$ku[id].png' alt='o'>";} else {echo "<img src='images/noavatar.png' alt='o'>";}
if(!isset($ku[ava])){echo'</br>Заменить аватар:';}else{echo'</br>Загрузить аватар:';}
echo "<form method=\"post\" enctype='multipart/form-data'>\n";
echo "<input type='file' name='file' /><br/>\n";
echo "<input value='Загрузить' type='submit' name='ok' /><br /></form></div>\n";

include_once 'inc/foot.php';?>