// $debug=yes;
/*************
will connect to cp app and manage accounts
*************/
require'../commonfiles/Functions.php';
require'../commonfiles/MyFunctions.php';
require'../commonfiles/brandconfig.php3';
require'../commonfiles/newtemplate.php';
// connect mysql
$crm = new MySQL_class;
$crm->Create($crm_db,$crm_user,$crm_host,$crm_pass);
$tmp = new MySQL_class;
$tmp->Create($template_db,$template_user,$template_host,$template_pass);
$gc_sql = $crm; // session handling
$dns = new MySQL_class;
$dns->Create($dns_db,$dns_user,$dns_host,$dns_pass);
$cdc = new MySQL_class;
$cdc->Create($cdc_db,$cdc_user,$cdc_host,$cdc_pass);
$brnd = new MySQL_class;
$brnd->Create($db,$user,$host,$pass);
// start session
start_session($php_sessid);
if(page_auth(3,$u_type,$cdc) == "yes")
{
$staging = "yes";
}
unset($u_type,$u_id,$session_email);
start_session($sessid);
if($u_id=='')
{
app_log('mail_center',$PHP_SELF,$search_word,$application_id,'not logged in',$code,$array);
header("location: login.html?show_login=yes&next=/mail_center/&message=
You need to be logged in to manage your mail boxes.");
exit();
}
$query = "select company_id
from $CRM_RELATION
where relation_id = '$customer_relation_id'
and brand = '$code'
and disable = '0'
order by company_id desc ";
$data = $crm->mydata($query);
$company_id = $data[company_id][0];
if(!$company_id)
{
app_log('mailcenter',$PHP_SELF,$search_word,$application_id,'not part of a company',$code,$array);
header("location: /store/my_account.html?message=
You must be part of a company to access the email manager.");
exit();
}
// make sure they have an enabled package
$query = "select $ORDER_PACKAGE.package_id, package_service_id
from $ORDER_PACKAGE, $ORDER_PACKAGE_SERVICE
where $ORDER_PACKAGE.company_id = '$company_id'
and $ORDER_PACKAGE.package_id = $ORDER_PACKAGE_SERVICE.package_id
and $ORDER_PACKAGE_SERVICE.service_type in ('EMAIL','P_EMAIL')
and enabled = 'Y'
and terminate_date = '0000-00-00 00:00:00'
and $ORDER_PACKAGE.brand = '$code' ";
$data = $crm->mydata($query);
if($data[package_id][0]=='')
{
app_log('mail_center',$PHP_SELF,$search_word,$application_id,'must purchas a package',$code,$array);
header("location: /store/index.html?message=
You must purchase an email package before you can get access to the email manager.");
exit();
}
// catch people being way to clever ...
if($domain_id)
{
$query = "select domain_name from $EMAIL_DOMAIN
where domain_id = '$domain_id'
and company_id = '$company_id'
and brand = '$code' ";
$data = $crm->mydata($query);
if($data[domain_name][0]=='')
{
header("location: /store/my_account.html?message=
You must be part of a company to access the email manager.");
exit();
}
}
require'../commonfiles/email_manager.inc';
?>