<?php
include("postget.php");
include_once("common.php");

if ($_REQUEST['user']<>0 AND $_REQUEST['code']<>'' AND substr($_REQUEST['code'],0,4) == substr(time(),1,4)) {
	$cliente = $_REQUEST['user'];
	$code = substr($_REQUEST['code'],4);
	$query="UPDATE hd_clients SET promotionalmailing='0' WHERE clientid='".$cliente."' AND password='".$code."'";
	if(!mysql_query($query,$db_link)){
		messagetop(_ERROR,mysql_error(),'index.php',0); 
	}else{
		logevent('_YOU_NO_LONGER_RECEIVE_PROMOTIONAL_MAILINGS',$cliente,$cliente);
		messagetop(lang('_YOU_NO_LONGER_RECEIVE_PROMOTIONAL_MAILINGS'),'','index.php',1);
	}
}else{
		messagetop(_ERROR_403,'','index.php',0);
}
?>