Your IP : 216.73.216.91


Current Path : /var/www/html/nadineandmiabeauty/admin/
Upload File :
Current File : //var/www/html/nadineandmiabeauty/admin/emailsubs.php

<?php
	require_once('autoload.php');
	include_once('header.php');
	$config = config::getAppConfig();
	$user->checklogin($config['loginPath']);
	$db = new pdocrudhandler();
	$res = $db->select($config['table']['blog']);
	//print_r($res);
	if($res['status'] == 'success'){

?>
	
        <div class="content " id="main-cont">
		<div class="container-fluid">
			<form method="post">
		      <?php
                            require_once ('alertmsg/alerts.php');
              ?>      
		  		<select name="blog" required>
		  			<option value="">Select Blog</option>
		    	<?php

		    	
		    	for ($i=0; $i < $res['rowsAffected'] ; $i++) { 
		    	

		    	?>
		      	<option value="<?=$res['result'][$i]->id?>"><?=$res['result'][$i]->btitle?></option>
		      <?php

		      	}
	
				}
		      ?>
		      
		    </select>
		    <input type="submit" name="send" value="Send Notification Emails To All Subscribers">
			</form>


<?php
	require_once('footer.php');
	if(isset($_POST['send'])){
		$res = $db->select($config['table']['blog'], array("*"), "where id = ?", array($_POST['blog']));
		//print_r($res);
		//exit;
		$subject = 'Blog Updates From Nadine & Mia Beauty';
	    $headers = 'From:no-reply@nadineandmiabeauty.com';
		$headers .= "Reply-To: no-reply@nadine&miabeauty.com\r\n";
		$headers .= "MIME-Version: 1.0\r\n";
		$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
		//$headers .= "CC: abdulmoiz.baig.work@gmail.com\r\n";
		//$headers .= "BCC: abdulmoiz.baig.work@gmail.com\r\n";
		

//echo $message;exit;
	$ressubs = $db->select($config['table']['subscriber'], array("*"),"where active = ?", array(1));
	for ($i=0; $i < $ressubs['rowsAffected'] ; $i++) { 
		$email = $ressubs['result'][$i]->email;
		$message = '
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
</head>  
	
<body>
<h2>'.$res["result"][0]->bheading.'</h2>
'.$res["result"][0]->bsummary.'
<br><br>
        <a href="http://nadineandmiabeauty.com/description.php?id='.$res["result"][0]->id.'" class="btn btn-danger">Click here read complete blog</a>

        <br><br>
        <a href="http://nadineandmiabeauty.com/unsub.php?email='.$email.'" class="btn btn-danger">Click here unsubscribe</a>';
		$mail = mail($email, $subject, $message,$headers);
		if($mail){
			echo '<div class="alert alert-success" role="alert">
			  <strong>Notification to <b>'.$email.'</b> has been sent</strong>
			</div>';
    	}
	}

	
    
    
	}
?>