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

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


</body>
</html>';
        $mailsent = mail($to, $subject, $mail_send_details, $headers);
        // **********************************************************************Send Mail To Administrator
        $subject_admin = "New Seller  Registration  with " . SITE_NAME;
        /*-------Email Template Reading Fuction Call--------*/
        $mailcontent_admin = readEmailTemplate('seller_registration_admin', 'artists');
        $mailcontent_admin = str_replace('[user_name]', $txtUserName, $mailcontent_admin);
        $mailcontent_admin = str_replace('[password]', $txtPassword, $mailcontent_admin);
        $mailcontent_admin = str_replace('[firstname]', $txtFirstName, $mailcontent_admin);
        $mailcontent_admin = str_replace('[lastname]', $txtLastName, $mailcontent_admin);
        /*---------------User Login Url-------------------*/
        $mailcontent_admin .= "\r\n";
        $mailcontent_admin .= "\r\n" . "Click&nbsp;<a href=" . SITE_URL . "/admin/login.php>Here</a> to Login to view details of Seller\r\n\n";
        /*---------------User Login Url-------------------*/
        $from = "From: " . SITE_EMAIL . "\n";
        $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";
        $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
        $headers .= "Return-Path: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
        $headers .= "Organization: " . SITE_NAME . "\r\n";
Example #2
0
    // read file
    if (checkOrgan($_GET['organ'])) {
        if (checkFilename($_GET['file']) && checkReadPerms($_GET['organ'])) {
            //input validation: get organ
            $text = readFromFile($_GET['organ'], $_GET['file']);
            $smarty->assign('text', $text);
            $smarty->assign('organ', $_GET['organ']);
            $smarty->assign('file', $_GET['file']);
        } else {
            if ($_GET['file'] == 'template' && checkReadPerms($_GET['organ'])) {
                $smarty->assign('text', readTemplate($_GET['organ']));
                $smarty->assign('organ', $_GET['organ']);
                $smarty->assign('file', $_GET['file']);
            } else {
                if ($_GET['file'] == 'email' && checkReadPerms($_GET['organ'])) {
                    $smarty->assign('text', readEmailTemplate($_GET['organ']));
                    $smarty->assign('organ', $_GET['organ']);
                    $smarty->assign('file', $_GET['file']);
                } else {
                    if ($_GET['file'] == 'resolutions.txt' && checkReadPerms($_GET['organ'])) {
                        $smarty->assign('text', readResolutions($_GET['organ']));
                        $smarty->assign('organ', $_GET['organ']);
                        $smarty->assign('file', $_GET['file']);
                    }
                }
            }
        }
    }
}
if (isset($_POST['text']) and isset($_GET['organ']) and isset($_GET['file'])) {
    //save changes
 if ($changeto == "Y") {
     // Check if ststus for activation
     $sql = "select * from " . $tableprefix . "artists  where artist_id ={$id} ";
     $rs = mysql_query($sql) or die(mysql_error());
     if (mysql_num_rows($rs) > 0) {
         $rr = mysql_fetch_array($rs);
         $status = $rr['vapproved'];
         $first_name = $rr['first_name'];
         $last_name = $rr['last_name'];
         if ($status == "NN") {
             // ststus check
             $to = $rr['email'];
             /*---------Multicart Seller Account Acivation Email Confirmation to seller------------*/
             $subject = "Your vendor account activated with " . stripslashes(SITE_NAME);
             /*-------Email Template Reading Fuction Call--------*/
             $mailcontent = readEmailTemplate('seller_registration_approval', 'artists');
             $link = SITE_URL . "/sellers/";
             $mailcontent = str_replace('[first_name]', $first_name, $mailcontent);
             $mailcontent = str_replace('[last_name]', $last_name, $mailcontent);
             $mailcontent = str_replace('[link]', $link, $mailcontent);
             $mailcontent = str_replace('[site_name]', SITE_NAME, $mailcontent);
             $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";
             $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($to, $subject, $mail_send_details, $headers);
             /*---------Multicart Seller Account Acivation End  Email Confirmation to seller------------*/
         }
         // end if  sttus check
     }
     $result = mysql_query($sql);
     if (mysql_num_rows($result) != 0) {
         $row = mysql_fetch_array($result);
         $email = $row["email"];
         $firstname = $row["first_name"];
         $lastname = $row["last_name"];
         $username = $row["user_name"];
     }
     $userfullname = $firstname;
     if ($lastname != "") {
         $userfullname .= " " . $lastname;
     }
     $to = $email;
     $subject = "Your account information with " . stripslashes(SITE_NAME) . " updated by Administrator";
     /*----------Multicart 2.0 Upgradation---------------*/
     $mailmessage = readEmailTemplate('change_userpassword');
     $mailmessage = str_replace('[name]', $userfullname, $mailmessage);
     $mailmessage = str_replace('[user_name]', $username, $mailmessage);
     $mailmessage = str_replace('[password]', $txtNewPassword, $mailmessage);
     $mailmessage = nl2br($mailmessage);
     $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>" . $mailmessage . "</div></div><div align='left' class='clear_float'><img src=" . $imagefolder . "/clear.gif width=1 height=1/></div></div></div></center></body></html>";
     $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";
     $mailsent = @mail($to, $subject, $mail_send_details, $headers);
     /*----------Multicart 2.0 Upgradation---------------*/
     $updatepass = true;
 } else {
     $updatepass = true;
 }
 if ($updatepass) {
       </table>

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


</body>
</html>';
                    $mailsent = mail($to_admin, $subject, $mail_send_details, $headers);
                    // End Send Mail Message To Administrator
                    if ($row['rma_confirm_message'] == 'Y') {
                        //  check send mail confirmation
                        $subject = "Your return payment information with " . SITE_NAME;
                        /*-------Email Template Reading Fuction Call--------*/
                        $mailcontent = readEmailTemplate('refund_registration');
                        $mailcontent = str_replace('[p_name]', stripslashes($productname), $mailcontent);
                        $mailcontent = str_replace('[return_reason]', $reason, $mailcontent);
                        $mailcontent = str_replace('[quantity]', $quanity, $mailcontent);
                        $mailcontent = str_replace('[date]', date('m-d-Y'), $mailcontent);
                        if ($buyer_comments != '') {
                            $mailcontent = str_replace('[comments]', $buyer_comments, $mailcontent);
                        }
                        $mailcontent = str_replace('[order_id]', $orderid, $mailcontent);
                        $mailcontent = str_replace('[refund_id]', $refundid, $mailcontent);
                        $mailcontent = str_replace('[seller_first_name]', $sellerfname, $mailcontent);
                        $mailcontent = str_replace('[seller_last_name]', $sellerlname, $mailcontent);
                        $mailcontent = str_replace('[first_name]', $buyerfname, $mailcontent);
                        $mailcontent = str_replace('[last_name]', $buyerlname, $mailcontent);
                        $headers = "MIME-Version: 1.0" . "\r\n";
                        $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
 /************* Get Product details *************/
 $p_sql = "select * from " . $tableprefix . "products where product_id = \"" . $_POST["pid"] . "\"";
 $p_rs = mysql_query($p_sql) or die(mysql_error());
 $p_row = mysql_fetch_array($p_rs);
 /************* Get email of the seller ***********************/
 if ($reviewapproval == "vendors") {
     $seller_sql = "select email from " . $tableprefix . "artists where artist_id = " . $p_row["product_artist_id"];
     $seller_rs = mysql_query($seller_sql);
     $seller_rw = mysql_fetch_array($seller_rs);
     $seller_email = $seller_rw["email"];
 }
 /***************** End fetching product details **********/
 // Send mail to admin
 /*---------Multicart 2.0 Upgradation------------*/
 $subject = "New review is posted in " . stripslashes(SITE_NAME);
 $mailcontent = readEmailTemplate('product_review');
 if ($reviewapproval == "admin") {
     $to = SITE_EMAIL;
 } elseif ($reviewapproval == "vendors") {
     $to = $seller_email;
     $mailcontent = str_replace('Administrator', "Seller", $mailcontent);
 }
 $link = "<a href='" . generalMethods::getProductdetailNavigationURL($_POST["pid"]) . "' target='_blank'>Click here</a>";
 /*-------Email Template Reading Fuction Call--------*/
 $mailcontent = str_replace('[site_name]', SITE_NAME, $mailcontent);
 $mailcontent = str_replace('[product_name]', $p_row["product_name"], $mailcontent);
 $mailcontent = str_replace('[link]', $link, $mailcontent);
 /*--------------- End email template section-------------------*/
 /******* Send Email ************************************************/
 $headers = "MIME-Version: 1.0" . "\r\n";
 $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
            </tr>
       </table>

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


</body>
</html>';
        //$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($to, $subject, $mail_send_details, $headers);
        // **********************************************************************Send Mail To Administrator
        $subject_admin = "New Member Registration  with " . SITE_NAME;
        /*-------Email Template Reading Fuction Call--------*/
        $mailcontent_admin = readEmailTemplate('member_registration_admin');
        $mailcontent_admin = str_replace('[user_name]', $txtUserName, $mailcontent_admin);
        $mailcontent_admin = str_replace('[password]', $txtPassword, $mailcontent_admin);
        $mailcontent_admin = str_replace('[first_name]', $txtFirstName, $mailcontent_admin);
        $mailcontent_admin = str_replace('[last_name]', $txtLastName, $mailcontent_admin);
        /*---------------User Login Url-------------------*/
        $mailcontent_admin .= "\r\n" . "Click <a href=" . SITE_URL . "/admin/login.php>Here</a> to Login to view details of Member\r\n\n";
        /*---------------User Login Url-------------------*/
        $from = "From: " . SITE_EMAIL . "\n";
        /* $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";
           $headers .= "Reply-To: ".SITE_NAME."<".SITE_EMAIL.">" . "\r\n";
           $headers .= "Return-Path: ".SITE_NAME."<".SITE_EMAIL.">"."\r\n";
           $headers .= "Organization: ".SITE_NAME."\r\n";*/
        $headers = "From: " . SITE_EMAIL . "<" . SITE_EMAIL . ">" . "\n";
     $result = mysql_query($sql);
     if (mysql_num_rows($result) != 0) {
         $row = mysql_fetch_array($result);
         $email = $row["email"];
         $firstname = $row["first_name"];
         $lastname = $row["last_name"];
         $affiliatename = $row["affiliate_name"];
     }
     $affiliatefullname = $firstname;
     if ($lastname != "") {
         $affiliatefullname .= " " . $lastname;
     }
     $to = $email;
     $subject = "Your affiliate account information with " . stripslashes(SITE_NAME) . " updated by Administrator";
     /*----------Multicart 2.0 Upgradation---------------*/
     $mailmessage = readEmailTemplate('change_affiliatepassword');
     $mailmessage = str_replace('[name]', $affiliatefullname, $mailmessage);
     $mailmessage = str_replace('[user_name]', $affiliatename, $mailmessage);
     $mailmessage = str_replace('[password]', $txtNewPassword, $mailmessage);
     $mailmessage = nl2br($mailmessage);
     $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>" . $mailmessage . "</div></div><div align='left' class='clear_float'><img src=" . $imagefolder . "/clear.gif width=1 height=1/></div></div></div></center></body></html>";
     $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";
     $mailsent = @mail($to, $subject, $mail_send_details, $headers);
     /*----------Multicart 2.0 Upgradation---------------*/
     $updatepass = true;
 } else {
     $updatepass = true;
 }
 if ($updatepass) {
     if (mysql_num_rows($result) != 0) {
         $row = mysql_fetch_array($result);
         $email = $row["email"];
         $firstname = $row["first_name"];
         $lastname = $row["last_name"];
         $artistname = $row["artist_name"];
     }
     $artistfullname = $firstname;
     if ($lastname != "") {
         $artistfullname .= " " . $lastname;
     }
     $to = $email;
     $link = '<a href=' . SITE_URL . '/sellers/login.php> Click here to Login </a>';
     $subject = "Your Vendor account information with " . stripslashes(SITE_NAME) . " has been added by Administrator";
     /*----------Multicart 2.0 Upgradation---------------*/
     $mailmessage = readEmailTemplate('admin_seller_registration');
     $mailmessage = str_replace('[first_name]', $firstname, $mailmessage);
     $mailmessage = str_replace('[last_name]', $lastname, $mailmessage);
     $mailmessage = str_replace('[user_name]', $artistname, $mailmessage);
     $mailmessage = str_replace('[password]', $txtPassword, $mailmessage);
     $mailmessage = str_replace('[site_name]', SITE_NAME, $mailmessage);
     $mailmessage = str_replace('[link]', $link, $mailmessage);
     $mailmessage = nl2br($mailmessage);
     $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>" . $mailmessage . "</div></div><div align='left' class='clear_float'><img src=" . $imagefolder . "/clear.gif width=1 height=1/></div></div></div></center></body></html>";
     $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";
     $mailsent = @mail($to, $subject, $mail_send_details, $headers);
     $message = "Vendor Added successfully!";
     header("Location:editartist.php?msg=" . $message . "&artistid=" . $lastInsertedId . "&rghtMenu=rghtMenu4&displayDiv=Members");
 }
     </td>
   </tr>
</table>


</body>
</html>';
                $mailsent = mail($to_buyer, $subject, $mail_send_details, $headers);
            }
            // end  email status check
            // Send Mail for Administraor
            $subject = "Return Payment Status Change  Confirmation with " . SITE_NAME;
            $to_admin = SITE_EMAIL;
            /*-------Email Template Reading Fuction Call--------*/
            $mailcontent = readEmailTemplate('refund_request_adminstatus');
            $mailcontent = str_replace('[user_name]', $buyer, $mailcontent);
            $mailcontent = str_replace('[p_name]', $productname, $mailcontent);
            $mailcontent = str_replace('[seller_name]', $sellername, $mailcontent);
            $mailcontent = str_replace('[status]', $status, $mailcontent);
            $mailcontent = str_replace('[quantity]', $quanity, $mailcontent);
            $mailcontent = str_replace('[order_id]', $orderid, $mailcontent);
            $mailcontent = str_replace('[refund_id]', $refundid, $mailcontent);
            $mailcontent = str_replace('[date]', $date, $mailcontent);
            $mailcontent = str_replace('[comments]', $comments, $mailcontent);
            if ($status == "Refund") {
                $mailcontent = str_replace('[rmode]', $mode, $mailcontent);
                $mailcontent = str_replace('[rno]', $rno, $mailcontent);
            } else {
                $mailcontent = str_replace('[rmode]', 'nil', $mailcontent);
                $mailcontent = str_replace('[rno]', 'nil', $mailcontent);
     // end if
 }
 // end if
 $to = SITE_EMAIL;
 $date = date("F d,Y");
 $product_code = stripslashes($txtProductCode);
 $product_name = stripslashes($txtProductName);
 $product_price = $adminCurrency['currency_symbol'] . "&nbsp;&nbsp;" . number_format($txtPrice, 2, ".", "");
 $stock_available = $txtStock;
 $shipping_weight = $txtShippingWeight . " lbs";
 $imageurl = '<img src="' . $product_image . '" width="120" height="150" border="0" >';
 //==================================End display product image===============================
 $link = "<a href=" . SITE_URL . "/admin/editproduct.php?productid={$productid}>Click here to view the product</a>";
 $subject = "A product has been edited in - " . stripslashes(SITE_NAME);
 /*---------Email Template Reading Fuction Call----------------------------------------*/
 $mailcontent = readEmailTemplate('email_product_edit', 'products');
 $mailcontent = str_replace('[seller_username]', $seller_username, $mailcontent);
 $mailcontent = str_replace('[seller_name]', $seller_name, $mailcontent);
 $mailcontent = str_replace('[date]', $date, $mailcontent);
 $mailcontent = str_replace('[product_name]', stripslashes($txtProductName), $mailcontent);
 $mailcontent = str_replace('[product_code]', $txtProductCode, $mailcontent);
 $mailcontent = str_replace('[product_price]', $txtPrice, $mailcontent);
 $mailcontent = str_replace('[product_discount]', $txtDiscount, $mailcontent);
 $mailcontent = str_replace('[product_image]', $imageurl, $mailcontent);
 $mailcontent = str_replace('[shipping_weight]', $shipping_weight, $mailcontent);
 $mailcontent = str_replace('[link]', $link, $mailcontent);
 $mailcontent = str_replace('[stock_available]', $stock_available, $mailcontent);
 $mailcontent = str_replace('[category_name]', $category_name, $mailcontent);
 $headers = "MIME-Version: 1.0" . "\r\n";
 $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
 $headers .= "From: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
    } else {
        // no error so insert user details
        $sql = "UPDATE " . $tableprefix . "artists SET\n\t\t\tpassword = '******'\n\t\t\tWHERE artist_id =  '" . addslashes($artistid) . "'\n\t\t\t";
        mysql_query($sql);
        $updatedRows = mysql_affected_rows();
        //send mail to admin if this feature is enabled for this seller
        $vendorSettings = getVendorEnabledSettings($artistid, 'enableSendMailChangePassword');
        if ($vendorSettings == 'Y') {
            if ($updatedRows > 0) {
                $to = SITE_EMAIL;
                $sellerName = getSellerFullname($artistid);
                //$link = "<a target= '_blank' href='".SITE_URL."/admin/editartist.php?artistid=".$artistid."&rghtMenu=rghtMenu4&displayDiv=Members'> Click here to view the details</a>";
                $date = date('m/d/Y');
                $subject = "Password of a seller has been changed in - " . stripslashes(SITE_NAME);
                /*---------Email Template Reading Fuction Call----------------------------------------*/
                $mailcontent = readEmailTemplate('seller_change_password');
                $mailcontent = str_replace('[seller_name]', $sellerName, $mailcontent);
                $mailcontent = str_replace('[date_change]', $date, $mailcontent);
                $mailcontent = str_replace('[site_name]', SITE_NAME, $mailcontent);
                $headers = "MIME-Version: 1.0" . "\r\n";
                $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
                $headers .= "From: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
                $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
                $headers .= "Return-Path: " . SITE_NAME . "<noreply@" . SITE_NAME . ">" . "\r\n";
                $headers .= "Organization: " . SITE_NAME . "\r\n";
                $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>";
                $mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Pure Catskills MarketPlace</title>
        $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
        $headers .= "Return-Path: " . SITE_NAME . "<noreply@" . SITE_EMAIL . ">" . "\r\n";
        $mailsent = mail($sellerObj->email, $subject, $mail_send_details_seller, $headers);
        // **********************************************************************Send Mail To Administrator
    }
}
// Update Expiry Of Seller if Seller Expired
$sql_date_check_expiry = "SELECT ar . * , am . *\n\t\t\t\t\t\tFROM " . $tableprefix . "artists_membershipDetails am\n\t\t\t\t\t\tINNER JOIN " . $tableprefix . "artists ar ON ar.artist_id = am.artist_id\n\t\t\t\t\t\tINNER JOIN " . $tableprefix . "sellerPlans s ON s.plan_Id = ar.sellerPlanID AND  s.plan_Id = am.plan_Id \n\t\t\t\t\t\tWHERE am.artist_memEndDate <= CURDATE() AND s.plan_Period IN ('Y','M') ";
$rs_date_check_expiry = mysql_query($sql_date_check_expiry) or die(mysql_error());
mysql_num_rows($rs_date_check_expiry);
if (mysql_num_rows($rs_date_check_expiry) > 0) {
    while ($sellerObj = mysql_fetch_object($rs_date_check_expiry)) {
        $seller_expiry = "UPDATE  " . $tableprefix . "artists SET plan_expired='Y' where artist_id='" . $sellerObj->artist_id . "' ";
        $rs_expiry = mysql_query($seller_expiry) or die(mysql_error());
        $subject_expiry = "Seller  Plan Expiry With " . SITE_NAME;
        $mailcontent_seller_expiry = readEmailTemplate('seller_plan_expiry');
        $mailcontent_seller_expiry = str_replace('[seller_fname]', $sellerObj->first_name, $mailcontent_seller_expiry);
        $mailcontent_seller_expiry = str_replace('[seller_lname]', $sellerObj->last_name, $mailcontent_seller_expiry);
        $mailcontent_seller_expiry = str_replace('[site_name]', $site_name, $mailcontent_seller_expiry);
        $mailcontent_seller_expiry = str_replace('[date_expiry]', dateFormat($sellerObj->artist_memEndDate, "Y-m-d", "m/d/Y"), $mailcontent_seller_expiry);
        $link = '<br><br><a href=' . $site_URL . "/sellers/seller_plan_upgrade.php?sellerid=" . $sellerObj->artist_id . ' target="_blank">Click here to make payment</a><br><br>';
        $mailcontent_seller_expiry = str_replace('[LINK]', $link, $mailcontent_seller_expiry);
        $mail_send_details_seller_expiry = '<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">
        $vacationmode = $_POST['vacationmode'] == 'on' ? 'Y' : 'N';
        $sql = "UPDATE " . $tableprefix . "artists SET\n\t\t\tfirst_name = '" . addslashes($txtFirstName) . "',\n\t\t\tlast_name = '" . addslashes($txtLastName) . "',\n\t\t\taddress1 = '" . addslashes($txtAddress1) . "',\n\t\t\taddress2 = '" . addslashes($txtAddress2) . "',\n\t\t\tcity = '" . addslashes($txtCity) . "',\n\t\t\tstate = '" . addslashes($txtState) . "',\n\t\t\tcountry = '" . addslashes($ddlCountry) . "',\n\t\t\tphone = '" . addslashes($txtPhone) . "',\n\t\t\tfax = '" . addslashes($txtFAX) . "',\n\t\t\tzip = '" . addslashes($txtZIP) . "',\n\t\t\temail = '" . addslashes($txtEmail) . "',\n\t\t\tcompany='" . addslashes($txtCompany) . "',\n\t\t\twebsite='" . addslashes($txtWeb) . "',\n\t\t\tpaypalemail='" . addslashes($txtPaypalEmail) . "',\n                        vacationmode= '" . addslashes($vacationmode) . "'\n\t\t\tWHERE artist_id =  '" . addslashes($artistid) . "'\n\t\t\t";
        mysql_query($sql) or die(mysql_error());
        $updatedRows = mysql_affected_rows();
        //send mail to admin if this feature is enabled for this seller
        $vendorSettings = getVendorEnabledSettings($artistid, 'enableSendMailProfileEdit');
        if ($vendorSettings == 'Y') {
            if ($updatedRows > 0) {
                $to = SITE_EMAIL;
                $sellerName = getSellerFullname($artistid);
                $link = "<a target= '_blank' href='" . SITE_URL . "/admin/editartist.php?artistid=" . $artistid . "&rghtMenu=rghtMenu4&displayDiv=Members'> Click here to view the details</a>";
                $date = date('m/d/Y');
                /*---------Multicart Seller Account Acivation Email Confirmation to seller------------*/
                $subject = "Profile of a vendor has been edited in - " . stripslashes(SITE_NAME);
                /*---------Email Template Reading Fuction Call----------------------------------------*/
                $mailcontent = readEmailTemplate('seller_profile_edit');
                $mailcontent = str_replace('[seller_name]', $sellerName, $mailcontent);
                $mailcontent = str_replace('[date_change]', $date, $mailcontent);
                $mailcontent = str_replace('[seller_link]', $link, $mailcontent);
                $mailcontent = str_replace('[site_name]', SITE_NAME, $mailcontent);
                $headers = "MIME-Version: 1.0" . "\r\n";
                $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
                $headers .= "From: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
                $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
                $headers .= "Return-Path: " . SITE_NAME . "<noreply@" . SITE_NAME . ">" . "\r\n";
                $headers .= "Organization: " . SITE_NAME . "\r\n";
                $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>";
                $mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
             $txtEmail = $gift_row['email'];
             $gift_coupon_flag = 1;
             $gift_coupon_product_id = $gift_row['product_id'];
             $gift_coupon_link .= "Coupon Code :- " . $gift_code_row['vgift_coupon_code'] . "\r\n";
             $gift_coupon_link .= "Coupon Amount :- " . $certificate_amount . "\r\n\n";
             /*--------Updating the order status to 'delivered' if the product purchased is gift coupon------------*/
             $update_order_details = "UPDATE " . $tableprefix . "order_details\n\t\t\t\t\t\t\t\t\t \t SET item_status = 4 \n\t\t\t\t\t\t\t\t\t \t WHERE order_id  = " . $orderid . " AND product_id = " . $gift_coupon_product_id;
             mysql_query($update_order_details) or die(mysql_error());
             /*--------Updating the order status to 'delivered' if the product purchased is gift coupon------------*/
         }
         /*---------mail sending gift coupon code ends-----------*/
     }
 }
 if ($gift_coupon_flag == 1) {
     /*-------Email Template Reading Fuction Call--------*/
     $mailcontent = readEmailTemplate('gift_coupon', '', $txtEmail);
     $mailcontent = str_replace('[coupon_code]', $gift_code_row['vgift_coupon_code'], $mailcontent);
     $mailcontent = str_replace('[coupon_amount]', $certificate_amount, $mailcontent);
     $subject = "Gift Certificate Order placed at " . SITE_NAME;
     $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";
     /*------------Seller Store Url---------------------*/
     // send the friendly url in mail based on config settings
     if ($enable_seller_friendly == "Y") {
         $select_seller_name = "SELECT artist_name FROM " . $tableprefix . "artists WHERE artist_id = " . $artistid;
         $result_seller_name = mysql_query($select_seller_name) or die(mysql_error());
         if (mysql_num_rows($result_seller_name) > 0) {
             $seller_name_row = mysql_fetch_assoc($result_seller_name);
             $txtSellerName = $seller_name_row['artist_name'];
         }
        $art_rw = mysql_fetch_array($art_rs);
        $seller_name = $art_rw["first_name"] . " " . $art_rw["last_name"];
        /*************** End get seller name ******************************/
        foreach ($chkorders as $rp) {
            /********************* [START]Send requesy payment to the administrator **********************/
            $subject = "A request payment has been placed in " . stripslashes(SITE_NAME) . " by a seller";
            $b_sql = "select billing_first_name,billing_last_name,order_total_price,vorder_currency from " . $tableprefix . "orders where order_id={$rp}";
            $b_rs = mysql_query($b_sql) or die(mysql_error());
            $b_rw = mysql_fetch_array($b_rs);
            $bfname = $b_rw["billing_first_name"];
            $blname = $b_rw["billing_last_name"];
            $p_sql = "SELECT sum((product_price-(product_price*product_discount/100)) *product_quantity) as total FROM " . $tableprefix . "order_details\n\t\t            WHERE artist_id = '" . $artistid . "' AND item_status = '4' AND artist_payment_status = '1' \n\t\t\t\t\tand order_id IN (" . addslashes($orderlist) . ") GROUP BY artist_id";
            $p_rs = mysql_query($p_sql);
            $p_rw = mysql_fetch_array($p_rs);
            /*-------Email Template Reading Fuction Call--------*/
            $mailcontent = readEmailTemplate('request_payment_seller');
            //echo $mailcontent;exit;
            $mailcontent = str_replace('[seller_name]', $seller_name, $mailcontent);
            $orderdetails = "<p>Order Id : {$rp}</p>";
            $orderdetails .= "<p>Buyer Name : " . $bfname . " " . $blname . "</p>";
            $orderdetails .= "<p>Total Purchase : " . $b_rw["vorder_currency"] . " " . $p_rw["total"] . "</p>";
            $mailcontent = str_replace('[order_details]', $orderdetails, $mailcontent);
            $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";
            $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
            $headers .= "Return-Path: " . SITE_NAME . "<noreply@" . SITE_EMAIL . ">" . "\r\n";
            $mailcontent = nl2br($mailcontent);
            $mail_send_details = '<html>
		<head>
		   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
if (isset($_GET['mode']) && $_GET['mode'] == 'da') {
    mysql_query("UPDATE " . $tableprefix . "Review SET vActive='0' WHERE nRId='" . $_GET['rid'] . "'") or die(mysql_error());
    $message = 'Review disapproved successfully.';
    $status = "not approved";
}
//end if
if ($_GET['mode']) {
    // Send Mails to Seller
    $subject = "Your product review on " . SITE_NAME . " has been {$status}";
    $link = "<a href='" . generalMethods::getProductdetailNavigationURL($_GET["pid"]) . "' target='_blank'>Click here</a>";
    $user_sql = "select first_name,last_name,email from " . $tableprefix . "users where user_id=(select nUserId from " . $tableprefix . "Review where nRId = " . $_GET['rid'] . ")";
    $user_rs = mysql_query($user_sql);
    $user_rw = mysql_fetch_array($user_rs);
    $to = $user_rw["email"];
    /*-------Email Template Reading Fuction Call--------*/
    $mailcontent = readEmailTemplate('product_review_approved');
    $mailcontent = stripslashes($mailcontent);
    $mailcontent = str_replace('[user_name]', $user_rw["first_name"] . " " . $user_rw["last_name"], $mailcontent);
    $mailcontent = str_replace('[approved_by]', "Seller", $mailcontent);
    $mailcontent = str_replace('[status]', $status, $mailcontent);
    $mailcontent = str_replace('[product_name]', urldecode($_GET["name"]), $mailcontent);
    $mailcontent = str_replace('[link]', $link, $mailcontent);
    $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";
    $mailcontent = nl2br($mailcontent);
    $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">
            if ($status == "NN") {
                // ststus check
                $txtUserName = $rr['affiliate_name'];
                $txtFirstName = $rr['first_name'];
                $txtPassword = $rr['password'];
                $randvalues = rand(0, 1000);
                $newpassword = $txtUserName . $randvalues;
                $password = md5($newpassword);
                $_SESSION["sess_affiliateid_new"] = "1";
                /*$sql_update="UPDATE ".$tableprefix."affiliates  SET password = '******' where affiliate_id =$id  ";
                		$rs_update=mysql_query($sql_update) or die(mysql_error());*/
                $to = $rr['email'];
                /*---------Multicart Seller Account Acivation Email Confirmation to seller------------*/
                $subject = "Your Affiliate account activated with " . stripslashes(SITE_NAME);
                /*-------Email Template Reading Fuction Call--------*/
                $mailcontent = readEmailTemplate('affiliate_registration_status', 'affiliates');
                $mailcontent .= "\r\n\n" . "<b>Click&nbsp;<a href=" . SITE_URL . "/affiliates/login.php>Here</a> to Login </b>\r\n\n";
                $mailcontent .= "\r\n" . "<a href=" . SITE_URL . "/index.php>" . SITE_URL . "</a>\r\n\n";
                $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";
                $mailcontent = nl2br($mailcontent);
                $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">
                }
            }
            $mailcontent_details = $productlist;
            $mailcontent_details .= $billingaddress;
            /* ---------Shipping details not available if gift coupon/digital product is purchased--------- */
            if ($gift_coupon_flag != 1 && $product_download_flag != 1) {
                $mailcontent_details .= $shippingaddress;
            }
            $mailcontent_seller = str_replace('[order_details]', $mailcontent_details, $mailcontent_seller);
            $mailcontent_seller = nl2br($mailcontent_seller);
            $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_seller . "</div></div><div align='left' class='clear_float'><img src=" . $imagefolder . "/clear.gif width=1 height=1/></div></div><div align='center' class='copyright'>Powered by <a href='http://www.iscripts.com/multicart'  target='_blank'><font color='#F4700E'><b>iScripts Multicart</b></font></a>&nbsp;&nbsp;&copy; 2007 iScripts.com. All Rights Reserved </div><div align='left' class='clear_float'><img src='" . SITE_URL . "/images/clear_admin.gif' alt='' width='1' height='1' /></div></div></center></body></html>";
            $mailsent = mail($artistemail, $ordersubject, $mail_send_details, $headers);
            $mailcontent_reorder = "";
            if ($productlist_fillstock != "") {
                /* -------Email Template reading function call------------ */
                $mailcontent_reorder = readEmailTemplate('stock_reorder');
                $mailcontent_reorder = str_replace('[product_details]', $productlist_fillstock, $mailcontent_reorder);
                $mailcontent_reorder = nl2br($mailcontent_reorder);
                $mail_send_details_reorder = "<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_reorder . "</div></div><div align='left' class='clear_float'><img src=" . $imagefolder . "/clear.gif width=1 height=1/></div></div></div></center></body></html>";
                $ordersubject_fillstock = "Stock Reorder at " . SITE_NAME;
                $mailsent = mail($artistemail, $ordersubject_fillstock, $mail_send_details_reorder, $headers);
                /* -------Email Template reading function call------------ */
            }
        }
        emptyCart($_SESSION["sess_userid"]);
        $_SESSION["sess_addresses_collected"] = false;
        $_SESSION["sess_stock_adjusted"] = false;
    }
}
if ($_POST["btnCancelOrder"] == "Cancel Order") {
    $message = "";
 $userid = $row["user_id"];
 $randnum1 = mt_rand();
 if (strlen($randnum1) > 6) {
     $randnum1 = substr($randnum1, 0, 6);
 }
 $newpass = $randnum1;
 $pass = md5($newpass);
 $sqlreset = "UPDATE " . $tableprefix . "users SET password = '******' WHERE user_id = '" . addslashes($userid) . "' ";
 $userfullname = $firstname;
 if ($lastname != "") {
     $userfullname .= " " . $lastname;
 }
 $to = $txtEmail;
 $subject = "Your password with " . htmlentities(stripslashes(SITE_NAME)) . " reset on request!";
 /*----------Multicart 2.0 Upgradation---------------*/
 $mailmessage = readEmailTemplate('user_forgotpassword');
 $mailmessage = str_replace('[name]', $userfullname, $mailmessage);
 $mailmessage = str_replace('[user_name]', $username, $mailmessage);
 $mailmessage = str_replace('[password]', $newpass, $mailmessage);
 $mailmessage = nl2br($mailmessage);
 $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>" . $mailmessage . "</div></div><div align='left' class='clear_float'><img src=" . $imagefolder . "/clear.gif width=1 height=1/></div></div></div></center></body></html>";
 $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";
 $mailsent = @mail($to, $subject, $mail_send_details, $headers);
 /*----------Multicart 2.0 Upgradation---------------*/
 $successmessage = "";
 if ($mailsent) {
     mysql_query($sqlreset);
     $successmessage .= "Your updated password has been successfully sent to {$to}";
 } else {
        $sellerordertotal = number_format($rw4["order_total_price"], 2, ".", "");
        $adminCommissionamount = number_format($rw4["commission"], 2, ".", "");
        $totalpaid = number_format($totalpaid, 2, ".", "");
        //$commissiontaken = ($total * $artistcommission)/100;
        //$totalpaid = $total - $commissiontaken;
        $sqlpayment = "INSERT INTO " . $tableprefix . "artist_payments\n\t\t\t(\n\t\t\tartist_id,\n\t\t\torder_id,\n\t\t\tcommission_percentage,\n\t\t\ttotal_amount,\n\t\t\tamount_paid,\n\t\t\tdate_marked_for_payment,\n                        seller_order_total_amount,\n                        admin_commision_amount\n\t\t\t)\n\t\t\tVALUES\n\t\t\t(\n\t\t\t'" . addslashes($artist) . "',\n\t\t\t'" . addslashes($orderid) . "',\n\t\t\t'" . addslashes($artistcommission) . "',\n\t\t\t'" . addslashes($total) . "',\n\t\t\t'" . addslashes($totalpaid) . "',\n\t\t\tnow(),\n                        '" . $sellerordertotal . "',\n                         '" . $adminCommissionamount . "'\n\t\t\t) ";
        mysql_query($sqlpayment);
        $paymentid = mysql_insert_id();
        $sql = "UPDATE " . $tableprefix . "order_details SET artist_payment_status = '3', artist_payment_id = '" . addslashes($paymentid) . "' WHERE order_id  = '" . addslashes($orderid) . "' AND artist_id = '" . addslashes($artist) . "'  ";
        mysql_query($sql);
        /********************** Send email to seller ****************************/
        $to = $rw4["email"];
        $subject = "Your payment is settled by the administrator in " . stripslashes(SITE_NAME);
        /*-------Email Template Reading Fuction Call--------*/
        $adminCurrency = GetAdminCurrency();
        $mailcontent = readEmailTemplate('settle_artist_payment');
        $mailcontent = str_replace('[amount]', $adminCurrency['currency_symbol'] . " " . $totalpaid, $mailcontent);
        $mailcontent = str_replace('[site_name]', SITE_NAME, $mailcontent);
        $mailcontent = str_replace('[seller_name]', $rw4["first_name"] . " " . $rw4["last_name"], $mailcontent);
        /*---------------Seller Login Url-------------------*/
        //********************HEADERS*************************
        $headers = "MIME-Version: 1.0" . "\r\n";
        $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
        $headers .= "Return-Path:  " . SITE_NAME . "<noreply@" . SITE_EMAIL . ">" . "\r\n";
        $headers .= "From: " . SITE_EMAIL . "<" . SITE_EMAIL . ">" . "\r\n";
        $headers .= "Organization: " . SITE_NAME . "\r\n";
        $headers .= "Content-Type: text/html\r\n";
        //****************************************************
        $mailcontent = nl2br($mailcontent);
        $mail_send_details = '<html>
<head>
 
                     }	 // end if
 
                 }else {
                     $product_image=SITE_URL."/products/$small_image_name_after_upload";
                 }*/
 //send mail to admin if this feature is enabled for this seller
 $vendorSettings = getVendorEnabledSettings($artistid, 'enableSendMailProductAdd');
 if ($vendorSettings == 'Y') {
     $imageurl = '<img src="' . $product_image . '" width="120" height="150" border="0" >';
     //==================================End display product image===============================
     $link = "<a href=" . SITE_URL . "/admin/editproduct.php?productid={$product_insert_id}>Click here to view the product</a>";
     /*---------Multicart Seller Account Acivation Email Confirmation to seller------------*/
     $subject = "A new product has been added in - " . stripslashes(SITE_NAME);
     /*---------Email Template Reading Fuction Call----------------------------------------*/
     $mailcontent = readEmailTemplate('new_product_approval', 'products');
     $mailcontent = str_replace('[seller_username]', $seller_username, $mailcontent);
     $mailcontent = str_replace('[seller_name]', $seller_name, $mailcontent);
     $mailcontent = str_replace('[date]', $date, $mailcontent);
     $mailcontent = str_replace('[product_name]', $product_name, $mailcontent);
     $mailcontent = str_replace('[product_code]', $txtProductCode, $mailcontent);
     $mailcontent = str_replace('[product_price]', $product_price, $mailcontent);
     $mailcontent = str_replace('[product_discount]', $txtDiscount, $mailcontent);
     $mailcontent = str_replace('[product_image]', $imageurl, $mailcontent);
     $mailcontent = str_replace('[shipping_weight]', $shipping_weight, $mailcontent);
     $mailcontent = str_replace('[link]', $link, $mailcontent);
     $mailcontent = str_replace('[stock_available]', $stock_available, $mailcontent);
     $mailcontent = str_replace('[category_name]', $category_name, $mailcontent);
     $headers = "MIME-Version: 1.0" . "\r\n";
     $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
     $headers .= "From: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
        $orderstatus_new = getArtistOrderStatus($orderid, $artistid);
        // Send Order Satus Change Mail To Buyer
        if (isset($_POST['chkStatus']) && $_POST['chkStatus'] == 'Y') {
            $subject = "Your order status in " . stripslashes(SITE_NAME) . " has been changed";
            $_SESSION["orderid_new"] = $orderid;
            $_SESSION["artist_new"] = $artistid;
            $art_sql = "select billing_first_name,billing_last_name,billing_email from " . $tableprefix . "orders where order_id={$orderid}";
            $art_rs = mysql_query($art_sql) or die(mysql_error());
            $art_rw = mysql_fetch_array($art_rs);
            $to = $art_rw["billing_email"];
            $seller_sql = "select concat(first_name,' ',last_name) AS name from " . $tableprefix . "artists where artist_id={$artistid}";
            $seller_rs = mysql_query($seller_sql) or die(mysql_error());
            $seller_rw = mysql_fetch_array($seller_rs);
            $seller_name = ucwords($seller_rw["name"]);
            /*-------Email Template Reading Fuction Call--------*/
            $mailcontent = readEmailTemplate('order_statuschange_buyer_seller', 'orders');
            //echo $mailcontent;exit;
            $mailcontent = str_replace('[first_name]', $art_rw["billing_first_name"], $mailcontent);
            $mailcontent = str_replace('[last_name]', $art_rw["billing_last_name"], $mailcontent);
            $mailcontent = str_replace('[order_status]', $orderstatus_new, $mailcontent);
            $mailcontent = str_replace('[seller_name]', $seller_name, $mailcontent);
            $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";
            $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
            $headers .= "Return-Path: " . SITE_NAME . "<noreply@" . SITE_EMAIL . ">" . "\r\n";
            $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>";
            $mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
function sendDigitalCertificateMail_Admin($order_id, $user_id)
{
    global $tableprefix;
    $adminCurrency = GetAdminCurrency();
    $currency_attributes[0] = $adminCurrency['currency_symbol'];
    $queryOrder = "SELECT o.* ,DATE_FORMAT(o.order_date,'%m-%d-%Y') as order_dateF from " . $tableprefix . "orders o  where order_id=" . $order_id . " ";
    $orderQ = mysql_query($queryOrder);
    $orderObj = mysql_fetch_object($orderQ);
    $mailContent = '
	<table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:#F5F5F5;font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">
		<tr>
		<td style="font-weight:bold; color:#CE0221; font-size:14px; padding:15px 15px 5px 15px;" align="left" valign="top">
		Order Details:
		</td>
		</tr>
		<tr>
		<td  align="left" valign="top" style="padding:5px 15px 15px 15px; ">
		<table width="100%" cellpadding="5" cellspacing="0" border="0" style="background-color:#FFFFFF; border:#D5D5D5 solid 1px;font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">
		<tr>
		<td width="40%">Store Name</td>
		<td width="60%" style="font-size:13px; color:#991818; font-weight:bold; ">' . SITE_NAME . '(' . SITE_URL . ')</td>
		</tr>';
    $mailContent .= '<tr>
		<td >Order ID</td>
		<td  style="font-size:13px; color:#991818; font-weight:bold; ">' . $orderObj->order_id . '</td>
		</tr>
		<tr>
		<tr>
		<td >Order Date</td>
		<td  style="font-size:13px; color:#991818; font-weight:bold; ">' . $orderObj->order_dateF . '</td>
		</tr>
		</table>
		</td>
		</tr>
		<tr>
		<td style="font-weight:bold; color:#CE0221; font-size:14px; padding:15px 15px 5px 15px;" align="left" valign="top">
		Products:
		</td>
		</tr>
		<tr>
		<td  align="left" valign="top" style="padding:5px 15px 15px 15px; ">
		<table width="100%" cellpadding="5" cellspacing="0" border="0" style="background-color:#FFFFFF; border:#D5D5D5 solid 1px;font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">
		<tr style="background-color:#D2D2D2; font-weight:bold; ">
		<td align="left" valign="top">Sl No.</td>
		<td align="left" valign="top">Digital Product  Name</td>
		<td align="left" valign="top">Product Code</td>
		<td align="left" valign="top">Rate</td>
		<td align="left" valign="top">Quantity</td>
		<td align="left" valign="top">Price</td>

		</tr>';
    $queryOrderDetail = "SELECT od.*,gc.vdigital_product_code,gc.ndownload_try,gc.ndownload_expiry,gc.ndownload_expiry_days\n  \t\t\t\t\t\tFROM " . $tableprefix . "order_details od\n\t\t\t\t\t\tINNER JOIN " . $tableprefix . "digital_product gc ON gc.ndigital_productid=od.product_id AND gc.ndigital_orderid='" . addslashes($order_id) . "'\n\t\t\t\t\t\tWHERE od.order_id =" . $order_id . " GROUP BY gc.ndigital_productid ";
    $orderDetailQ = mysql_query($queryOrderDetail);
    $itemTotal = 0;
    $inc = 1;
    while ($orderDetailObj = mysql_fetch_object($orderDetailQ)) {
        $optionStr = "";
        $productname = stripslashes($orderDetailObj->product_name);
        $productRate = $orderDetailObj->product_price;
        $productPrice = $productRate * $orderDetailObj->product_quantity;
        $discountstr = "";
        if ($orderDetailObj->product_discount != 0) {
            $productPrice = $productPrice - $productPrice * $orderDetailObj->product_discount / 100;
            $discountstr = "<br>discount(" . $orderDetailObj->product_discount . "%)";
        }
        $converted_price = $productPrice;
        $productPrice = number_format($converted_price, 2, ".", "");
        $itemTotal += $productPrice;
        $mailContent .= '<tr>
		<td align="left" valign="top">' . $inc . '</td>
		<td align="left" valign="top">' . stripslashes($productname) . '</td>
		<td align="left" valign="top">' . $orderDetailObj->product_code . '</td>
		<td align="left" valign="top"> ' . $currency_attributes[0] . '&nbsp;' . number_format($productRate, 2, ".", "") . '</td>
		<td align="left" valign="top">&nbsp;' . $orderDetailObj->product_quantity . '</td>
		<td align="left" valign="top">' . $currency_attributes[0] . '&nbsp;' . number_format($productPrice, 2, ".", "") . '&nbsp;&nbsp;' . $discountstr . '</td>
		</tr>';
        $inc++;
    }
    $mailContent .= '</table></td></tr>';
    $ItemTotalPrice = 0;
    //Modified ON 03-12-2010 // Remove Set Price Total from Total Price
    $ItemTotalPrice = $itemTotal;
    $mailContent .= '<tr>
		<td style="font-weight:bold; color:#CE0221; font-size:14px; padding:15px 15px 5px 15px;" align="left" valign="top">
		Charges:
		</td>
		</tr>
		<tr>
		<td  align="left" valign="top" style="padding:5px 15px 15px 15px; " width="100%">
		<table width="100%" cellpadding="5" cellspacing="0" border="0" style="background-color:#FFFFFF; border:#D5D5D5 solid 1px;font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">';
    $mailContent .= '<tr>
		<td>Tax Rate:</td>
		<td  style="font-size:13px; color:#991818; font-weight:bold; ">' . $currency_attributes[0] . '&nbsp; ' . $orderObj->taxrate . '</td>
		</tr>';
    $mailContent .= '<tr>
			<td>Order Total :</td>
			<td  style="font-size:16px; color:#FF0000; font-weight:bold; ">' . $currency_attributes[0] . '&nbsp;' . number_format($ItemTotalPrice, 2, ".", "") . '</td>
			</tr>';
    $mailContent .= '<tr>
			<td>Amount Paid:</td>
			<td  style="font-size:16px; color:#FF0000; font-weight:bold; ">' . $currency_attributes[0] . '&nbsp; ' . number_format($orderObj->namount_paid, 2, ".", "") . '</td>
			</tr>';
    $mailContent .= '<tr>
			<td colspan="2">&nbsp;</td>
			</tr></table></td></tr>';
    if ($orderObj->billing_address2) {
        $mailContent .= '<tr></table>
			</td>
			</tr>
			<tr>
			<td style="font-weight:bold; color:#CE0221; font-size:14px; padding:15px 15px 5px 15px;" align="left" valign="top">
			Billing Address:
			</td>
			</tr>
			<tr>
			<td  align="left" valign="top" style="padding:5px 15px 15px 15px; ">
			<table width="100%" cellpadding="5" cellspacing="0" border="0" style="background-color:#FFFFFF; border:#D5D5D5 solid 1px;font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">
			<tr>
			<td align="left" valign="top">
			' . $orderObj->billing_first_name . ' ' . $orderObj->billing_last_name . '<br>
			' . $orderObj->billing_address1 . ',<br>
			' . $orderObj->billing_address2 . ',<br>
			' . $orderObj->billing_city . ', ' . $orderObj->billing_state . ', ' . $orderObj->billing_country . ' ' . $orderObj->billing_zip . '<br>
			Phone: ' . $orderObj->billing_phone . '<br>
			' . $orderObj->billing_email . '
			</td>
			</tr>
			</table>
			</td>
			</tr>';
    } else {
        $mailContent .= '<tr></table>
		</td>
		</tr>
		<tr>
		<td style="font-weight:bold; color:#CE0221; font-size:14px; padding:15px 15px 5px 15px;" align="left" valign="top">
		Billing Address:
		</td>
		</tr>
		<tr>
		<td  align="left" valign="top" style="padding:5px 15px 15px 15px; ">
		<table width="100%" cellpadding="5" cellspacing="0" border="0" style="background-color:#FFFFFF; border:#D5D5D5 solid 1px;font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; ">
		<tr>
		<td align="left" valign="top">
		' . $orderObj->billing_first_name . ' ' . $orderObj->billing_last_name . '<br>
		' . $orderObj->billing_address1 . ',<br>
		' . $orderObj->billing_city . ', ' . $orderObj->billing_state . ', ' . $orderObj->billing_country . ' ' . $orderObj->billing_zip . '<br>
		Phone: ' . $orderObj->billing_phone . '<br>
		' . $orderObj->billing_email . '
		</td>
		</tr>
		</table>
		</td>
		</tr>';
    }
    $mailContent .= '</table>';
    $mailcontent_admin = readEmailTemplate('digital_product_admin');
    $mailcontent_admin = str_replace('[first_name]', $orderObj->billing_first_name, $mailcontent_admin);
    $mailcontent_admin = str_replace('[last_name]', $orderObj->billing_last_name, $mailcontent_admin);
    $mailcontent_admin = str_replace('[order_details]', $mailContent, $mailcontent_admin);
    $mail_send_details_admin = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Online reservation</title>
  <link href="' . SITE_URL . '/style/template1-admin.css" 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_admin . '</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>';
    //echo $mail_send_details_buyer;
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
    $headers .= "From: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
    $headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
    $headers .= "Return-Path: " . SITE_NAME . "<noreply@" . SITE_NAME . ">" . "\r\n";
    $headers .= "Organization: " . SITE_NAME . "\r\n";
    $ordersubject = "Digital Product Order placed at " . SITE_NAME;
    $adminemail = getSettingsValue('site_email');
    $mailsent = mail($adminemail, $ordersubject, $mail_send_details_admin, $headers);
}
 /*-----------------Digital Product Mail Sending Starts----------------*/
 if ($product_download_flag == 1) {
     isset($_SESSION['SESS_digital_product']) ? session_unregister('SESS_digital_product') : session_register('SESS_digital_product');
     $_SESSION['SESS_digital_product'] = 1;
     $select_user_email = "SELECT user_name,email FROM " . $tableprefix . "users WHERE user_id = " . $CustomArray[0];
     $result_user_email = mysql_query($select_user_email) or die(mysql_error());
     $user_email_row = mysql_fetch_assoc($result_user_email);
     $user_name = $user_email_row['user_name'];
     $product_download_details .= "User Name - {$user_name}\r\n\n";
     $txtEmailDownload = $user_email_row['email'];
     $subjectDownload = "Digital Product Order placed at " . SITE_NAME;
     $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";
     /*-------Email Template reading function call------------*/
     $mailcontent_digital_product = readEmailTemplate('digital_product');
     $product_download_details .= "\n\n*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*\r\n";
     $product_download_details .= "<font color='#FF0000'>Note: If you do not have pop-ups enabled on your browser, the product download many not work properly.So please enable pop-ups before downloading !!</font>";
     $mailcontent_digital_product = str_replace('[product_details]', $product_download_details, $mailcontent_digital_product);
     $mailcontent_digital_product = nl2br($mailcontent_digital_product);
     $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_digital_product . "</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($txtEmailDownload,$subjectDownload,$mail_send_details,$headers);
 }
 /*-----------------Digital Product Mail Sending Ends----------------*/
 // Send Giftcertificate Mails
 if ($gift_coupon_flag == 1) {
     sendgiftCertificateMail_Buyer($orderid, $CustomArray[0]);
 } else {
     sendBuyerEmail($orderid, $CustomArray[0]);
     sendSellerEmail($orderid, $CustomArray[0]);
     sendAdminEmail($orderid, $CustomArray[0]);
 $sql = "SELECT admin_name FROM " . $tableprefix . "settings WHERE site_email = '" . addslashes($txtEmail) . "' ";
 $res = mysql_query($sql);
 if (mysql_num_rows($res) != 0) {
     $row = mysql_fetch_array($res);
     $firstname = $row["admin_name"];
     $randnum1 = mt_rand();
     if (strlen($randnum1) > 6) {
         $randnum1 = substr($randnum1, 0, 6);
     }
     $newpass = $randnum1;
     $pass = md5($newpass);
     $sqlreset = "UPDATE " . $tableprefix . "settings SET admin_password  = '******'";
     $to = $txtEmail;
     $subject = "Your password with " . stripslashes(SITE_NAME) . " reset on request!";
     /*----------Multicart 2.0 Upgradation---------------*/
     $mailmessage = readEmailTemplate('admin_forgotpassword');
     $mailmessage = str_replace('[name]', $firstname, $mailmessage);
     $mailmessage = str_replace('[user_name]', $firstname, $mailmessage);
     $mailmessage = str_replace('[password]', $newpass, $mailmessage);
     $mailmessage = nl2br($mailmessage);
     $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>" . $mailmessage . "</div></div><div align='left' class='clear_float'><img src=" . $imagefolder . "/clear.gif width=1 height=1/></div></div></div></center></body></html>";
     $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";
     $mailsent = @mail($to, $subject, $mail_send_details, $headers);
     /*----------Multicart 2.0 Upgradation---------------*/
     $successmessage = "";
     if ($mailsent) {
         mysql_query($sqlreset);
         $successmessage .= "Your updated password has been successfully sent to {$to}";
     } else {
                                $product_image = SITE_URL . "/products/{$final_image_big}";
                            } else {
                                // if images not in the table
                                $product_image = SITE_URL . "/products/noimage.jpg";
                            }
                            // end if
                        } else {
                            $product_image = SITE_URL . "/products/{$final_image_small}";
                        }
                        $imageurl = '<img src="' . $product_image . '" width="120" height="150" border="0" >';
                        //==================================End display product image===============================
                        $link = "<a href=" . SITE_URL . "/admin/editproduct.php?productid={$insert_product_id}>Click here to view the details</a>";
                        /*---------Multicart Seller Account Acivation Email Confirmation to seller------------*/
                        $subject = "A New Gift Certificate been added in - " . stripslashes(SITE_NAME);
                        /*-------Email Template Reading Fuction Call--------*/
                        $mailcontent = readEmailTemplate('new_gift_certificate_seller', 'products');
                        $mailcontent = str_replace('[seller_username]', $seller_username, $mailcontent);
                        $mailcontent = str_replace('[seller_name]', $seller_name, $mailcontent);
                        $mailcontent = str_replace('[date]', $date, $mailcontent);
                        $mailcontent = str_replace('[certificate_name]', stripslashes($_POST["txtGiftCouponName"]), $mailcontent);
                        $mailcontent = str_replace('[certificate_code]', stripslashes($_POST["txtGiftCouponCode"]), $mailcontent);
                        $mailcontent = str_replace('[certificate_amount]', $product_price, $mailcontent);
                        $mailcontent = str_replace('[stock_reorder]', stripslashes($_POST["txtStockReorder"]), $mailcontent);
                        $mailcontent = str_replace('[imglink]', $link, $mailcontent);
                        $mailcontent = str_replace('[stock_available]', stripslashes($_POST["txtCouponStock"]), $mailcontent);
                        $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";
                        $mailcontent = nl2br($mailcontent);
                        $mail_send_details = '<html>
<head>
}
*/
/*if(isset( $_SESSION["sess_userid"]) and $_SESSION["sess_userid"]!= "") {
    $userid = $_SESSION["sess_userid"];
}else {
    header("Location:login.php");
    exit;
}*/
$name = $_POST['name'];
$email = $_POST['email'];
$product_id = $_POST['product_id'];
$product_url = '<a target="_blank" href="' . generalMethods::getProductdetailNavigationURL($product_id) . '">' . generalMethods::getProductdetailNavigationURL($product_id) . '</a>';
//$userName = getLoggedInUserName($_SESSION["sess_userid"]);
$to = $email;
$subject = "Product Information by " . SITE_NAME;
$mailcontent = readEmailTemplate('mail_friend');
$mailcontent = str_replace('[name]', $name, $mailcontent);
$mailcontent = str_replace('[product_url]', $product_url, $mailcontent);
//$mailcontent = str_replace('[user_name]',$userName,$mailcontent);
$from = "From: " . SITE_EMAIL . "\n";
$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";
$headers .= "Reply-To: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
$headers .= "Return-Path: " . SITE_NAME . "<" . SITE_EMAIL . ">" . "\r\n";
$headers .= "Organization: " . SITE_NAME . "\r\n";
$mailcontent = nl2br($mailcontent);
$mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Email Friend</title>