<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  visavi.net@mail.ru         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#	
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";

echo '<img src="../images/img/profiles.gif" alt=""> <b>Изменение настроек</b><br><br>';

if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){

if(eregi("[^a-z0-9_+-]",$skins) || empty($skins)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$bookpostus) || $bookpostus>50 || empty($bookpostus)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$news) || $news>50 || empty($news)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$forumpost) || $forumpost>50 || empty($forumpost)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$forumtem) || $forumtem>50 || empty($forumtem)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$userlist) ||$userlist>50 || empty($userlist)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$chatpost) || $chatpost>50 || empty($chatpost)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$rewnew) || $rewnew>300 || empty($rewnew)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$board) || $board>50 || empty($board)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9]",$prrivs) || $prrivs>50 || empty($prrivs)){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(eregi("[^0-9+-]",$sdvig) || $sdvig===""){ header ("Location: setting.php?isset=incorrect&".SID);  exit;}
if(!file_exists(BASEDIR."themes/$skins/index.php")){$skins="default";}

if(isset($_SESSION['my_themes']) && $_SESSION['my_themes']!=""){
$_SESSION['my_themes']="";
unset($_SESSION['my_themes']);
}

//------------------------------ Запись в профиль ----------------------------//
$ufile = file_get_contents(BASEDIR."local/profil/$log.prof"); 
$udata = explode(":||:",$ufile);

$udata[14]=$ip;
$udata[20]=check($skins);
$udata[21]=(int)$bookpostus;
$udata[22]=(int)$news;
$udata[23]=(int)$forumpost;
$udata[24]=(int)$forumtem;
$udata[25]=(int)$userlist;
$udata[26]=(int)$chatpost;
$udata[27]=(int)$rewnew;
$udata[28]=(int)$board;
$udata[30]=check($sdvig);
$udata[31]=(int)$times;
$udata[32]=(int)$prrivs;
$udata[42]=(int)$graffic;
$udata[45]=(int)$editavator;
$udata[55]=(int)$editperson;
$udata[66]=(int)$ipcontrol;
$udata[74]=(int)$udata74;

for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}

if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$log.prof","a+");
flock($fp,LOCK_EX);   
ftruncate($fp,0);                                                                 
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);  
unset($utext);
}

header ("Location: ../index.php?isset=editsetting&".SID); exit;

}else{
echo '<br>Вы не авторизованы, чтобы изменять свои настройки, необходимо<br>';
echo '<b><a href="../pages/vhod.php?'.SID.'">Авторизоваться</a></b> или в начале <b><a href="../pages/registration.php?'.SID.'">Зарегистрироваться</a></b><br>';
}     


echo'<br><img src="../images/img/back.gif" alt=""> <a href="setting.php?'.SID.'">Вернуться</a><br>';
echo'<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once"../themes/$config_themes/foot.php";                
?>