<?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";
error_reporting(0);
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}

//specify the number of days before/after to get alerted. 
$array_Days=array(10,5,3,2,1,0,-1,-2,-3,-4,-5,-10,-15,-30,-45,-60);

$res_seller=mysql_query("SELECT artist_id,first_name,last_name,email  FROM ".$tableprefix."artists WHERE deleted='N'");
if(mysql_num_rows($res_seller)>0)
	{
		while($data_seller=mysql_fetch_array($res_seller)){
		$tmp_expireDate=showExpireMessage($data_seller['artist_id']);
		if(in_array($tmp_expireDate['difference'],$array_Days)){

		$expairDate= date("F j, Y",strtotime($tmp_expireDate['EndDate'])); 
// mail content starts here 
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		
		$subject = MAIL_SUBSCRIPTION_REMINDER_SUBJECT." ".stripslashes(SITE_NAME);
	
		if($tmp_expireDate['difference']>0){
		$mailcontent="<br><br>".MAIL_ORDER_TEXT_DEAR." ".$data_seller['first_name']." ".$data_seller['last_name']."<br>";
		$mailcontent.="<br>".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_1." ".SITE_NAME." ".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_2." ".$expairDate.".<br>
					  <a href='".SITE_URL."/sellers/chooseYourPlan.php'>".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_3."</a> ".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_4."<br><br>
					   ".MAIL_SUBSCRIPTION_REMINDER_END.",<br>".MAIL_SUBSCRIPTION_SIGNATURE_ADMIN." <br>".stripslashes(SITE_NAME);
		}else{
				$mailcontent="<br><br>".MAIL_ORDER_TEXT_DEAR." ".$data_seller['first_name']." ".$data_seller['last_name']."<br>";
		$mailcontent.="<br>".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_1." ".SITE_NAME." ".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_2." ".$expairDate.".<br>
					  <a href='".SITE_URL."/sellers/chooseYourPlan.php'>".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_3."</a> ".MAIL_SUBSCRIPTION_REMINDER_EXPIRATION_MESSAGE_4."<br><br>
					   ".MAIL_SUBSCRIPTION_REMINDER_END.",<br>".MAIL_SUBSCRIPTION_SIGNATURE_ADMIN." <br>".stripslashes(SITE_NAME);

		}			   
				
		$mailcontent = nl2br($mailcontent);				
		
		$mail_send_details = "<html><head><link href='".SITE_URL."/style/template1-admin.css' rel='stylesheet' type='text/css'></head><body><center><div align='left' id='layout'><div align='left' class='header'><div align='left' class='logo'><img src=".$logofolder."/".$logoimage." width='125' height='39'/></div></div><div>".$mailcontent."</div></div><div align='left' class='clear_float'><img src=".$imagefolder."/clear.gif width=1 height=1/></div></div></div></center></body></html>";		
		$mailsent = mail($data_seller['email'], $subject, $mail_send_details, $headers);						
			}
			
		}
	}
?>



