<?
include("../includes/htmlMimeMail.php");
include_once("../include/main.inc.php");
include_once("../ajax_functions.php");
check_session('MyCpanel','index.php');
$table_name="mailer_list";
$table_name1="member_tbl";
$table_name2="mass_mail";
$res=getResult($table_name," where mailer_id='$mailer_id' and databasestatus='Y'");
$mailer_country=$res[country]; 
$member_Type=$res[memberType];
$keyword=$res[keyword];
//echo $mailer_country;
//echo $member_Type;
//echo $keyword;
//if($mailer_id!='' ) {

if($_POST[action]=="Activate"){
	
	for ($x=0; $x < sizeof($_POST[cid]); $x++){
		$dataRes=$_POST[cid];
		
		$mailres=getResult("newsletter_member"," where id='$dataRes[$x]'");
		
		//$memres=getResult($table_name1," where memberID='$dataRes[$x]'");

if($mailres[memberID]=='') {
	
    $sql=db_query("insert into mass_mail set mailerID='$mailer_id', email='$mailres[email]', memberName='$mailres[name]', memberID='$dataRes[$x]',status='N'");
	
}
	}
	$_SESSION[session_message]='Selected record(s) activated successfully.';

}

$query=mysql_query("SELECT * FROM newsletter_member");

/*
echo "<h3>Database Alloctaed</h3> ";*/
//}

?>

<table border="1">

<form name="" method="post" action="" >
<tr><td colspan="3"><input type="submit" name="action" value="Activate"  onclick="return chkactivate();" class="button"> </td></tr>
 <?php
 while ($row = mysql_fetch_array($query)) {
 ?>
 <tr><td><input type="checkbox" name="cid[]" value="<?=$row[id]?>" checked/></td><td><?php echo $row['name']; ?></td><td><?php echo $row['email']; ?></td></tr>
 <?php
 }
 ?>
<tr><td colspan="3"><input type="submit" name="action" value="Activate"  onclick="return chkactivate();" class="button"> </td></tr>
</form>
 </table>
