<?
//***************************************************
// http://www.scriptindonesia.com
// Solusi Hemat Script Bisnis Online Anda
// Menerima Jasa Pembuatan Website & Template Website
//***************************************************
?>
<?
//Edit Script AW 20160221
//if (session_is_registered("valid_admin")) {
  if (isset($_SESSION['valid_admin'])) {
?>

<title>Admin Kirim Email Personal</title>

<!--- Start TinyMCE -->
	<script src="../tinymcpuk/jscripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
	<script src="../tinymcpuk/jscripts/tiny_mce/tiny_lokomedia.js" type="text/javascript"></script>
<!-- Finish TinyMCE -->

<?
$emailadmin = $db->config("email");
$cs_domain  = $db->config("bank2");
?><table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#bfd6ed">
  <tr bgcolor="#8c759a">
    <td colspan="3" height="30"><p align="center" class="title"><strong><u>Kirim Email Personal</u></strong><u></u></p></td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#7fa1c2"><img src="../images/px1.gif" width="1" height="1" alt="" border="0"></td>
  </tr>
  <tr>
    <td width="1" rowspan="4" bgcolor="#7fa1c2"><img src="../images/px1.gif" width="1" height="1" alt="" border="0"></td>
    <td width="100%" height="4" bgcolor="#EF9400"><img src="../images/px1.gif" width="1" height="1" alt="" border="0"></td>
    <td width="1" rowspan="4" bgcolor="#7fa1c2"><img src="../images/px1.gif" width="1" height="1" alt="" border="0"></td>
  </tr>
  <tr>
    <td valign="top">
<?
switch($page) {
	default :
?>      
	<p align="center">Halaman ini digunakan untuk mengirimkan informasi kepada member secara personal (pribadi).<br />
	Hati-hati pada penggunaan fasilitas kirim email pm ini. Cukup sekali saja klik tombol <strong>KIRIM EMAIL</strong> karena jika terlalu sering maka akan dianggap <strong>SPAM</strong>.</p>
        <hr />
      <form name="form1" method="post" action="?m=mailmass_pm&page=kirim">
        <table width="90%" border="0" align="center" cellpadding="2" cellspacing="1">
          <tr>
            <td width="32%" align="right">Ditujukan ke : </td>
            <td width="68%"><input name="tujuan" type="text" class="form" id="tujuan" size="50"></td>
          </tr>
          <tr>
            <td align="right">Subjek : </td>
            <td><input name="subjek" type="text" class="form" id="subjek" size="50"></td>
          </tr>
          <tr>
            <td align="right" valign="top">Isi Pesan : </td>
            <td><textarea id='loko' name="pesan" cols="50" rows="8" class="form" id="pesan"></textarea></td>
            <!--<td><textarea id='loko' name='isi_berita' style='width: 120px; height: 350px;'></textarea></td>-->
          </tr>
          <tr>
            <td valign="top">&nbsp;</td>
            <td>ket : kirim email dengan kalimat saja, krn gambar tidak akan terkirim.<p>
                <label>
                <input type="submit" name="Submit" value="KIRIM EMAIL" class="tombol">
                </label>
              </p>
              </td>
          </tr>
        </table>
      </form>
      
<?
	break;

	case kirim :
	if($tujuan == "" or $pesan == "") {
		echo "<p align=center><br><br><b>Kepada siapa informasi ini akan dikirimkan dan apa pesannya?<br>Klik BACK untuk mengulang!</b></p>";
                echo "
                <center>
                    <input type='button' name='kembali' id='kembali' value='KEMBALI' class='tombol' onclick='javascript:history.go(-1)' />
                </center>
                ";
	} else {


                $from       =  $db->config("email_noreply");
                $headers    = "From: $cs_domain <".$from.">\nX-Sender: ".$from."\n";
              //$headers    = "From: www.scriptindonesia.com<$emailadmin>\nX-Sender: $emailadmin\n";
                $email      = $tujuan;

                        $isi_pesan  = "
                        <html>
                            $pesan
                        </html>
                        ";

                        $headers    = "MIME-Version: 1.0" . "\r\n";
                        $headers   .= "Content-type:text/html;charset=UTF-8" . "\r\n";
                      //$headers   .= 'From:' . $from . "\r\n";
                        $headers   .= "From: $cs_domain <".$db->config("email_noreply").">\nX-Sender: ".$db->config("email_noreply")."\r\n";

		@mail($email, $subjek, $isi_pesan, $headers);
		echo "<p align=center><b>Informasi telah berhasil dikirimkan!</b></p>";
	}
	break;
}
?>
    </td>
  </tr>
  <tr>
    <td background="../images/t_fon.gif" height="28"><img src="../images/px1.gif" width="1" height="1" alt="" border="0"></td>
  </tr>
  <tr>
    <td colspan="3" align="right"><img src="../images/t_bot.gif" width="229" height="10" alt="" border="0"></td>
  </tr>

  <tr>
    <td colspan="3" bgcolor="#7fa1c2"><img src="../images/px1.gif" width="1" height="1" alt="" border="0"></td>
  </tr>

</table>
<?
} else {
echo "<meta http-equiv=\"refresh\" content=\"1; url=illegal.html\">";
}
?>