<?php

//用户风格
/*
@ require ('readonly/function/confirm_power.php');
define('POWER', confirm_power());

if (POWER == 0) {
  err('请登陆或注册帐号！先');
}
*/
if (!isset($_POST['cssfile'])) {
  err('请选择风格！');
}
if ($_POST['cssfile'] == $web['cssfile']) {
  err('已是系统默认风格！');
}
if (!file_exists('writable/css/'.$_POST['cssfile'].'')) {
  err('风格不存在！');
}
if (!setcookie('myStyle', $_POST['cssfile'], time() + floatval($web['time_pos']) * 3600 + 365 * 24 * 60 * 60, '/')) {
  err('Cookie保存失败！请检查您的设置');
}

alert('
<script>
if(parent){
  try{parent.document.getElementById(\'my_style\').href=\'writable/css/'.$_POST['cssfile'].'/style.css\';}catch(e){}
}
try{document.getElementById(\'my_style\').href=\'writable/css/'.$_POST['cssfile'].'/style.css\';}catch(e){}
</script>风格设置完毕！', !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'member.php?get=style');
?>