<? 
ob_start();
session_start();
require_once("../dbconnect.php");
 $action = isset($_GET['action']) ? $_GET['action'] : '';

switch ($action) {
	
	case 'sendemail' :
	    sendemail();
        break;
	
   case 'regstatus' :
	     regstatus();
         break;
		 
 case 'regstatus1' :
	     regstatus1();
         break;
		 
	case 'delete' :
	     del();
         break;	
		
		 
		 case 'delete1' :
	     del1();
         break;	
		 
		
       default :
        // if action is not defined or unknown
        // move to main category page
        header('Location: regcustomers.php');
		
		}
		
		
		
function sendemail()
{
if($_POST['email']!="")
{


$re=$_POST['email'];
$emails=implode(",",$re);

include('class.Email.php');

 
 

  $Sender = 'info@bebeau.com'; 
    $res=$emails;
   
    $Recipiant =$res;
  
  
  $Subject = 'News Letter From golf balls';
   $msg=


  $CustomHeaders= '';
   $to='info@bebeau.com';


  $message = new Email($to,$Sender, $Subject, $CustomHeaders);
  $message->Cc = $Cc; 
  $message->Bcc = $Recipiant; 
  
 
  $zing = '30';	
  
   $html ="<table width='100%'>
            <tr>
			<td align='center' colspan='2'><font size='+1'><b>Newsletter from dogtag</b></font></td>
			</tr>
			<tr>
			<td height='8' align='left' valign='top' bgcolor='#660000' colspan='2' ></td>
			</tr>
            <tr>
			<td valign='top'><img src=http://www.1800street.com/dogtagnew/images/newlogo.png alt='dogtagLogo'/></td>
			<td valign='top'>info@dogtag.com</td>
			</tr>
			<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
			<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
			<tr><td colspan='2'>Dear,<td></tr>
          <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
		  <tr><td>Message:</td></tr>
		  <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
          <tr><td align='justify' colspan='2'>".$_POST['message']." </td></tr>
           </table>";
		 				 
						
  $message->SetHtmlContent($html);


  $pathToServerFile = __FILE__;        //** attach this very PHP script.
  $serverFileMimeType = 'text/plain';  //** this PHP file is plain text.


  //$pathToServerFile = 'HelloWorld.doc';      //** use Word doc as version.
  //$serverFileMimeType = 'application/word';  //** standard word MIME type.

  //$message->SetFileContent($pathToServerFile, $serverFileMimeType);

  

  $message->Send();
  
  
  header("Location:emailorganizer.php?suc=suc");


   }
else
   {

header("location: emailorganizer.php?msg=Please Select Any Email");
 }


}
		
		
		
function regstatus()
{
$status=$_GET['status'];	
$user_id=$_GET['userid'];	
$sql="UPDATE bulkemail SET Status='".$status."' WHERE user_id=".$user_id;		
	        $result = mysql_query($sql) or die('Cannot add category' . mysql_error());	

header("Location:regcustomers.php?page=".$_GET['page']);   
 }

		
function regstatus1()
{
$status=$_GET['status'];	
$user_id=$_GET['userid'];	
$sql="UPDATE bulkemail SET Status='".$status."' WHERE user_id=".$user_id;		
	        $result = mysql_query($sql) or die('Cannot add category' . mysql_error());	

header("Location:hookmeup.php?page=".$_GET['page']);   
 }
	

function del()
{
$sql3 = "DELETE FROM bulkemail WHERE  user_id=".$_POST['userid'];
mysql_query($sql3);	

header('Location: regcustomers.php?page='.$_POST['page']);  

}

function del1()
{
$sql3 = "DELETE FROM bulkemail WHERE  user_id=".$_POST['userid'];
mysql_query($sql3);	

header('Location: hookmeup.php?page='.$_POST['page']);  

}

?>