<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com  2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE); 
} 

if(isset( $_SESSION["sess_artistid"]) and $_SESSION["sess_artistid"]!= ""){
	$artistid = $_SESSION["sess_artistid"];
}else{
	header("Location:login.php");
	exit;
}

$txtSubject = trim(stripslashes($_POST["txtSubject"]));
$txtMailContent = trim(stripslashes($_POST["txtMailContent"]));


if($_POST["btnSendMail"]){
	$message = "";
	if(!isNotNull($txtSubject)){
		$message .= VAL_MSG_SUB_EMPTY;
	}
	if(!isNotNull($txtMailContent)){
		$message .= VAL_MSG_MAIL_EMP;
	}
	
	if($message== "")
	{
		$to = SITE_EMAIL;
		$subject = $txtSubject ;
		$mail_header = "<p>Dear Administrator<p>"; 
		$mailcontent = $mail_header.nl2br($txtMailContent);
		$sql = "SELECT artist_name,email FROM " . $tableprefix . "artists WHERE artist_id = '".addslashes($artistid)."' ";
		$res = mysql_query($sql);
		if(mysql_num_rows($res)!= 0 ){
			$rw = mysql_fetch_array($res);
			$artistname = $rw["artist_name"];
			$artistemail = $rw["email"];
		}
		$mail_footer  = "<p>Thanks and regards,<p>"; 
		$mail_footer .= "<p>".$artistname.",<br>Seller<br>".SITE_NAME."<p>"; 
		$mailcontent .= $mail_footer;
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: $artistname <$artistemail>" . "\r\n";

/*---------Multicart 2.0 Upgradation-----------*/		

$mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Online reservation</title>
  <link href="./themes/'. $active_template[4].' rel="stylesheet" type="text/css">
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';
			
		$mailsent = mail($to,$subject,$mail_send_details,$headers);
		
/*---------Multicart 2.0 Upgradation-----------*/
	
		
		if($mailsent){
			$message = MSG_MAIL_SENT;
			$success = 1;
		}else{
			$message = MSG_ERR_SEND;
			$success = 0;
		}
	}
	else
	{
		$message = VAL_MSG_PLS_CORRECT . $message;
	}
}

if($success == 1)
{
	$txtSubject = "";
	$txtMailContent = "";
}

include "../includes/htmltop.php";
?>


<body>
		
		<center>
		
		<div align="left" id="layout">
		
		
				
				
				<!--header area start -->
<?php

	include_once("../includes/topheader_seller.php")

?>
				
				<!--header area end -->
				
				
				
				
				<div align="left" class="main_body">
				<!--main body start -->
				
				
				
<?php
	include_once("../includes/artisttopmenu.php")
?>		
																					
								
					<div align="left" class="content_area">
					
					<!--content area start -->
							
					<div align="left" class="page_title"><?php echo TEXT_MAIL_ADMIN;?></div>
					<div align="center" class="text_information grey_tr"><?php echo $message?></div>
            		<br>
											
					<div align="left">																			
						<form name="frmFeedback" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
							<table cellpadding="0" cellspacing="0" align="center" class="manage_table" width="100%">
								<tr><td colspan="3">&nbsp;</td></tr>
								<tr><td colspan="3" align="right"><span class="required">*</span>&nbsp;<?php echo MSG_FIELD_MANDATORY;?></td></tr>
								<tr><td width="33%" align="right" valign=top><?php echo TEXT_SUBJECT;?>&nbsp;<span class="required">*</span></td><td width="3%" >&nbsp;</td>
									<td width="64%" align="left" valign=top><input type="text" name="txtSubject" class="textarea2"  value="<?php echo htmlentities(stripslashes($txtSubject)); ?>" size="60" maxlength="255"></td>
								</tr>
								<tr><td align="right" valign=top><?php echo TEXT_MAIL_CONTENT;?>&nbsp;<span class="required">*</span></td><td >&nbsp;</td>
									<td valign=top align="left"><textarea name='txtMailContent' rows='10' cols='50'  class="textarea2" ><?php echo htmlentities(stripslashes($txtMailContent)); ?></textarea></td>
								</tr>
								<tr><td colspan="3">&nbsp;</td></tr>
								<tr><td colspan="3" align="center">
									<input type="button" value="<?php echo BTN_BACK;?>" name="btnBack" class="button" onClick="window.location.href='artistmain.php';" >
									&nbsp;&nbsp;<input type="submit" value="<?php echo BTN_SEND_MAIL;?>" name="btnSendMail"  class="button" >
									</td>
								</tr>
								<tr><td colspan="3">&nbsp;</td></tr>
							</table>
						</form>
				
				</div>
						
						
				<!--content area end-->
								
				</div>
				
								
					<div align="left" class="clear_float"><img src="<?php echo $imagefolder;?>/clear.gif" alt="" width="1" height="1" /></div>
				<!--main body end -->
				</div>
				
				
<?php
	include "../includes/footer.php";
?>