<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
only_reg();
$set['title']='Фон сайта';
include_once '../../sys/inc/thead.php';
title();
aut();
$array_files = array();
$odir = opendir(H."style/fones");
echo "<div style='background: #fff; padding: 1px;'>\n";
while ($file = readdir($odir)) {
	if ($file != '.' && $file != '..')
	echo '<a style="border: 1px solid #CCC; display: inline-block; margin-bottom: 1px;" href="?sel='.htmlspecialchars($file).'"><img style="margin: 1px;" src="/style/fones/'.htmlspecialchars($file).'" height="90" width="90" /></a> ';
	$array_files[] = $file;
}
if (isset($_GET['sel']) && in_array($_GET['sel'], $array_files)) {
	mysql_query("UPDATE `user` SET `site_fon` = '".my_esc($_GET['sel'])."' WHERE `id` = '$user[id]'");
	$_SESSION['message'] = 'Фон успешно установлен';
	header("Location: /user/info/settings.php");
	exit();
}
echo "</div>\n";
echo "<div class='foot'>\n";
echo "&laquo; <a href='/user/info/settings.php'>В настройки</a>\n";
echo "</div>\n";
include_once '../../sys/inc/tfoot.php';
?>