<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[1]!=1)
{
  Header("Location: jump.php?id=25&jump=main.php");
  exit();
}
if(isset($_GET['action']) and $_GET['action'] == "submit")
{
  $str = "<?php\n";
  foreach($_POST AS $key=>$val)
  {
    $str.= "$".$key."=\"".$val."\";\n";
  }
  $str.= "?>";
  $filename='../configs/config.php';
  @chmod($filename,0777);
  if (is_writable($filename)) 
  {
    if (!$handle=fopen($filename,'w') or fwrite($handle, $str) === FALSE)
      Header("Location: jump.php?id=error&jump=config.php");
	else
	  Header("Location: jump.php?id=24&jump=config.php");
	fclose($handle);
  }
  else 
    Header("Location: jump.php?id=13&jump=config.php");
}
else
{
  $handler = opendir('../template');
  while( ($filename = readdir($handler)) !== false ) 
  {
    if($filename!="." && $filename!="..")
      $style[]=$filename;
  }
  closedir($handler);
  $servertime=date('Y-m-d H:i:s');
  $bartime=date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s'))+$core_time*60*60);
  $tpl -> assign("core_barmgl", $core_barmgl);
  $tpl -> assign("core_atnum", $core_atnum);
  $tpl -> assign("servertime", $servertime);
  $tpl -> assign("bartime", $bartime);
  $tpl -> assign("style", $style);
  $tpl -> assign("core_barname", $core_barname);
  $tpl -> assign("core_url", $core_url);
  $tpl -> assign("core_keyword", $core_keyword);
  $tpl -> assign("core_description", $core_description);
  $tpl -> assign("core_icp", $core_icp);
  $tpl -> assign("core_style", $core_style);
  $tpl -> assign("core_baropen", $core_baropen);
  $tpl -> assign("core_opentime1", $core_opentime1);
  $tpl -> assign("core_opentime2", $core_opentime2);
  $tpl -> assign("core_closed", $core_closed);
  $tpl -> assign("core_time", $core_time);
  $tpl -> assign("core_rewrite", $core_rewrite);
  $tpl -> assign("core_createopen", $core_createopen);
  $tpl -> assign("core_createaudit", $core_createaudit);
  $tpl -> assign("core_opendomain", $core_opendomain);
  $tpl -> assign("core_erdomain", $core_erdomain);
  $tpl -> assign("core_filterdomain", $core_filterdomain);
  $tpl -> assign("core_useropen", $core_useropen);
  $tpl -> assign("core_userheadup", $core_userheadup);
  $tpl -> assign("core_useraudit", $core_useraudit);
  $tpl -> assign("core_usershort", $core_usershort);
  $tpl -> assign("core_userlong", $core_userlong);
  $tpl -> assign("core_pwdshort", $core_pwdshort);
  $tpl -> assign("core_pwdlong", $core_pwdlong);
  $tpl -> assign("core_signlong", $core_signlong);
  $tpl -> assign("core_filteruser", $core_filteruser);
  $tpl -> assign("core_listpage", $core_listpage);
  $tpl -> assign("core_readpage", $core_readpage);
  $tpl -> assign("core_filesize", $core_filesize);
  $tpl -> assign("core_visitoropen", $core_visitoropen);
  $tpl -> assign("core_themeshort", $core_themeshort);
  $tpl -> assign("core_themelong", $core_themelong);
  $tpl -> assign("core_contentshort", $core_contentshort);
  $tpl -> assign("core_contentlong", $core_contentlong);
  $tpl -> assign("core_barmastercount", $core_barmastercount);
  $tpl -> assign("core_barsmastercount", $core_barsmastercount);
  $tpl -> assign("core_file", $core_file);
  $tpl -> assign("core_filetype", $core_filetype);
  $tpl -> assign("core_verifyopen", $core_verifyopen);
  $tpl -> assign("core_stmpopen", $core_stmpopen);
  $tpl -> assign("core_stmpserver", $core_stmpserver);
  $tpl -> assign("core_stmpport", $core_stmpport);
  $tpl -> assign("core_stmpmail", $core_stmpmail);
  $tpl -> assign("core_stmpacc", $core_stmpacc);
  $tpl -> assign("core_stmppwd", $core_stmppwd);
  $tpl -> assign("core_scode", $core_scode);
  $tpl -> assign("core_flow", $core_flow);
  $tpl -> display("config.htm");
}
?>