<?php 







class ControllerUnsubscribe extends Controller {







	var $error = array();



  	function index() {



		$customer =& $this->locator->get('customer');



		$language =& $this->locator->get('language');



		$module   =& $this->locator->get('module');



		$request  =& $this->locator->get('request');



		$response =& $this->locator->get('response');



		$session  =& $this->locator->get('session');



		$template =& $this->locator->get('template');



		$url      =& $this->locator->get('url');



		$database =& $this->locator->get('database');



		



        if (($request->isPost())) {	 



        	$sql = "update customer set newsletter = '?' where 	email = '?'";



        	$database->query($database->parse($sql, 0 ,$request->get('customer_email', 'post')));



        	$result_info=$database->getRow($database->parse("select * from customer where email='".$request->get('customer_email', 'post')."'"));  



			if($result_info['newsletter']=='0')



              {



            	    echo '<script type="text/javascript">';



    			    echo 'alert("You have unsubscribed sucessfully all newsletter from beststoreitems.com");';



    			    echo ' self.location="https://www.beststoreitems.com"';	



    			    echo '</script>';



              }



              else{



              	    echo '<script type="text/javascript">';



	    			echo 'alert("No match for email address");';



	    			echo 'history.back()';	



	    			echo '</script>';



              }



		}



  	}



}







?>