<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[26]!=1)
{
  Header("Location: jump.php?id=25&jump=main.php");
  exit();
}
if(isset($_GET['action']) and $_GET['action'] == "submit")
{
  if($core_stmpopen==0)
    $_POST['email_eopen']=0;
  $str = "<?php\n";
  foreach($_POST AS $key=>$val)
  {
    $str.= "$".$key."=\"".$val."\";\n";
  }
  $str.= "?>";
  $filename='../configs/email.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=automess.php");
	else
	  Header("Location: jump.php?id=24&jump=automess.php");
	fclose($handle);
  }
  else 
    Header("Location: jump.php?id=13&jump=automess.php");
}
else
{
  $tpl -> assign("email_addresser", $email_addresser);
  $tpl -> assign("email_mopen", $email_mopen);
  $tpl -> assign("email_eopen", $email_eopen);
  $tpl -> assign("email_bzyest", $email_bzyest);
  $tpl -> assign("email_bzyesc", $email_bzyesc);
  $tpl -> assign("email_bznot", $email_bznot);
  $tpl -> assign("email_bznoc", $email_bznoc); 
  $tpl -> assign("email_cbzyest", $email_cbzyest);
  $tpl -> assign("email_cbzyesc", $email_cbzyesc);
  $tpl -> assign("email_cbznot", $email_cbznot);
  $tpl -> assign("email_cbznoc", $email_cbznoc);
  $tpl -> assign("email_flyest", $email_flyest);
  $tpl -> assign("email_flyesc", $email_flyesc);
  $tpl -> assign("email_flnot", $email_flnot);
  $tpl -> assign("email_flnoc", $email_flnoc);
  $tpl -> display("automess.htm");
}
?>