<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[1]!=1)
  jump("jump.php?id=25&jump=main.php");
if(isset($_GET['action']) and $_GET['action'] == "submit")
{
  $str = "<?php\n";
  foreach($_POST AS $key=>$val)
  {
	$val=html_replacef($val);
    $str.= "$".$key."=\"".$val."\";\n";
  }
  $str.= "?>";
  $filename='../configs/uc.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=uc_config.php");
	else
	  Header("Location: jump.php?id=24&jump=uc_config.php");
	fclose($handle);
  }
  else
    jump("jump.php?id=13&jump=uc_config.php");
  exit();
}
$tpl -> assign("uc_open", $uc_open);
$tpl -> assign("uc_dbhost", $uc_dbhost);
$tpl -> assign("uc_dbuser", $uc_dbuser);
$tpl -> assign("uc_dbpw", $uc_dbpw);
$tpl -> assign("uc_dbname", $uc_dbname);
$tpl -> assign("uc_tablepre", $uc_tablepre);
$tpl -> display("uc_config.htm");
?>