if ($recurtransactionoff == 0 || $recurtransactionoff == "") {
     $recurtransactionoff = 0;
 }
 if ($rebilltransactionoff == 0 || $rebilltransactionoff == "") {
     $rebilltransactionoff = 0;
 }
 $date = date("Y-m-d H:i:s");
 $qry_check_userexist = "select cd.*,rd.* from cs_companydetails as cd \n\t\tleft join cs_resellerdetails as rd on cd.reseller_id = rd.reseller_id\n\t\t where cd.userId='{$userid}' {$bank_sql_limit}";
 $result = mysql_query($qry_check_userexist) or dieLog(mysql_error() . " ~ {$qry_check_userexist}");
 $companyInfo = mysql_fetch_assoc($result);
 $completion = "";
 $bank_update_sql = "";
 if ($strUnsubscribe != $companyInfo['send_mail']) {
     if ($strUnsubscribe) {
         removeListEmail($companyInfo['email']);
         removeListEmail($companyInfo['contact_email']);
     } else {
         addListEmail($companyInfo['email'], "Admin Unsubscribed Email", $companyInfo['userId'], 'merchant', 'unsubscribe');
         addListEmail($companyInfo['contact_email'], "Admin Unsubscribed Email", $companyInfo['userId'], 'merchant', 'unsubscribe');
     }
 }
 if ($cd_custom_contract && !$companyInfo['cd_custom_contract']) {
     $contract = genMerchantContract(&$companyInfo);
     $sql = "insert into cs_email_templates set et_name='merchant_contract', et_custom_id='" . $companyInfo['userId'] . "', et_title='" . quote_smart($companyInfo['companyname']) . " Contract', et_access='admin', et_to_title='" . quote_smart($companyInfo['companyname']) . "', et_subject='Custom Merchant Contract for " . quote_smart($companyInfo['companyname']) . "', et_htmlformat='" . quote_smart($contract['et_htmlformat']) . "', et_catagory='Merchant'";
     $result = mysql_query($sql) or etelPrint(mysql_error());
     $cd_custom_contract = mysql_insert_id();
 } else {
     if (!$cd_custom_contract && $companyInfo['cd_custom_contract']) {
         $sql = "delete from cs_email_templates where et_name='merchant_contract' and et_custom_id='" . $companyInfo['userId'] . "'";
         $result = mysql_query($sql) or dieLog(mysql_error());
         $cd_custom_contract = 'null';
 $bank_sort_code = isset($HTTP_POST_VARS['bank_sort_code']) ? quote_smart($HTTP_POST_VARS['bank_sort_code']) : "";
 $bank_account_number = isset($HTTP_POST_VARS['bank_account_number']) ? quote_smart($HTTP_POST_VARS['bank_account_number']) : "";
 $bank_swift_code = isset($HTTP_POST_VARS['bank_swift_code']) ? quote_smart($HTTP_POST_VARS['bank_swift_code']) : "";
 $unsubscribe_mails = isset($HTTP_POST_VARS['mail_send']) ? quote_smart($HTTP_POST_VARS['mail_send']) : "1";
 $suspend_user = isset($HTTP_POST_VARS['suspend_user']) ? quote_smart($HTTP_POST_VARS['suspend_user']) : "0";
 $qry_selectdetails = "select * from cs_resellerdetails where reseller_id = {$i_reseller_id}";
 if (!($rst_selectdetails = mysql_query($qry_selectdetails))) {
     dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
 }
 $resellerInfo = mysql_fetch_array($rst_selectdetails);
 if ($unsubscribe_mails == "") {
     $unsubscribe_mails = 1;
 }
 if ($unsubscribe_mails != $resellerInfo['reseller_sendmail']) {
     if ($unsubscribe_mails) {
         removeListEmail($resellerInfo['reseller_email']);
     } else {
         addListEmail($resellerInfo['reseller_email'], "Admin Unsubscribed Email", $resellerInfo['reseller_id'], 'reseller', 'unsubscribe');
     }
 }
 if ($companyname == "" || $contactname == "") {
     $msgtodisplay = "Insufficient data.";
     $outhtml = "Y";
     message($msgtodisplay, $outhtml, $headerInclude);
     exit;
 }
 if ($password == "") {
     $msgtodisplay = "Please enter Password.";
     $outhtml = "Y";
     message($msgtodisplay, $outhtml, $headerInclude);
     exit;