Пример #1
0
function smart_updateMarkup($values, $action)
{
    global $companyInfo;
    $userid = $values['append'];
    $res_disc = $_POST['res_disc_' . $userid];
    $res_trans = $_POST['res_trans_' . $userid];
    $sql = "select merchant_contract_agree,cb_ID\n\t\t\tFROM \n\t\t\t\tcs_companydetails as cd\n\t\t\tLEFT JOIN \n\t\t\t\tcs_entities as ce ON (cd.userId = ce.en_type_ID  AND ce.en_type = 'merchant')\n\t\t\tLEFT JOIN \n\t\t\t\tcs_entities_affiliates as ea ON (ea.ea_en_ID = ce.en_ID)\n\t\t\tLEFT JOIN \n\t\t\t\tcs_company_banks as cb ON (cb.userId = cd.userId AND cb.bank_id = 0)\n\t\t\tWHERE\n\t\t\t\tea.ea_affiliate_ID = '" . $companyInfo['en_ID'] . "' and cd.userId = '{$userid}'";
    $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
    if (!mysql_num_rows($result)) {
        return array("action" => "Merchant Not Found.", "status" => "fail");
    }
    $markupInfo = mysql_fetch_assoc($result);
    if ($markupInfo['merchant_contract_agree']) {
        return array("action" => "Merchant Already Signed Contract. If you would like more information, please contact the Sales Department.", "status" => "fail");
    }
    if (!$markupInfo['cb_ID']) {
        $sql = "insert into cs_company_banks set userId = '" . intval($userid) . "',bank_id=0;";
        $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
        $cb_ID = mysql_insert_id();
    } else {
        $cb_ID = $markupInfo['cb_ID'];
    }
    $update = array('default' => array('Processor' => array('disct' => $res_disc, 'trans' => $res_trans)));
    if (etel_update_serialized_field('cs_company_banks', 'cb_config', " cb_ID = '{$cb_ID}'", $update)) {
        return array("action" => "Merchant Rates Updated Successfully.", "status" => "success");
    }
    return array("action" => "Error, Please contact support.", "status" => "fail");
}
Пример #2
0
 function add_entity($type, $user, $pass, $table_id)
 {
     $type = quote_smart($type);
     $user = quote_smart($user);
     $pass = quote_smart($pass);
     $table_id = quote_smart($table_id);
     if (!isset($this->entities[$type])) {
         return -1;
     }
     $sql = "\n\t\t\tINSERT INTO\n\t\t\t\tcs_entities\n\t\t\tSET\n\t\t\t\tet_type = '{$type}',\n\t\t\t\tet_username = '******',\n\t\t\t\tet_password = '******',\n\t\t\t\tet_table_ID = '{$table_id}'\n\t\t\t";
     sql_query_write($sql);
 }
function smart_deleteRefund($values, $action)
{
    global $adminInfo;
    $sql = "Select * FROM `cs_callnotes` WHERE note_id = '" . $values['append'] . "'";
    $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
    $callNoteInfo = mysql_fetch_assoc($result);
    if ($adminInfo['li_level'] == 'full') {
        $sql = "DELETE FROM `cs_callnotes` WHERE note_id = '" . $values['append'] . "'";
        $result = sql_query_write($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>Cannot execute query");
        return array("action" => "Transaction ID " . $callNoteInfo['transaction_id'] . " no longer being refunded.", "status" => "success");
    }
    return array("action" => "Transaction ID " . $callNoteInfo['transaction_id'] . " no longer being refunded.", "status" => "failed.  insufficient privilages.");
}
Пример #4
0
function smart_updateMarkup($values, $action, $updateall = false)
{
    global $curUserInfo;
    $en_ID = $values['append'];
    if ($updateall) {
        $res_disc = $_POST['default_disc'];
        $res_trans = $_POST['default_trans'];
    } else {
        $res_disc = $_POST['res_disc_' . $userid];
        $res_trans = $_POST['res_trans_' . $userid];
    }
    $sql = "select cb_ID,cb_config\n\t\t\tFROM \n\t\t\t\tcs_entities as ce\n\t\t\tLEFT JOIN \n\t\t\t\tcs_entities_affiliates as ea ON (ea.ea_en_ID = ce.en_ID)\n\t\t\tLEFT JOIN \n\t\t\t\tcs_company_banks as cb ON (ce.en_ID = cb.cb_en_ID AND cb.bank_id = 0)\n\t\t\tWHERE\n\t\t\t\tea.ea_affiliate_ID = '" . $curUserInfo['en_ID'] . "'";
    if ($en_ID || !$updateall) {
        $sql .= " and ce.en_ID = '{$en_ID}'";
    }
    $markupResult = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
    if (!mysql_num_rows($markupResult)) {
        return array("action" => "Affiliate(s) Not Found.", "status" => "fail");
    }
    while ($markupInfo = mysql_fetch_assoc($markupResult)) {
        if (!$markupInfo['cb_ID']) {
            $sql = "insert into cs_company_banks set cb_en_ID = '" . intval($markupInfo['merchant_en_ID']) . "',bank_id=0;";
            $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
            $cb_ID = mysql_insert_id();
        } else {
            $cb_ID = $markupInfo['cb_ID'];
            $markupInfo['cb_config'] = etel_unserialize($markupInfo['cb_config']);
        }
        $update = array('default' => array('Reseller' => array('disct' => $res_disc, 'trans' => $res_trans, 'en_ID' => $curUserInfo['en_ID'])));
        if ($updateall && $markupInfo['cb_config']['default']['Reseller']) {
            $update = NULL;
        }
        if ($update) {
            $updated = etel_update_serialized_field('cs_company_banks', 'cb_config', " cb_ID = '{$cb_ID}'", $update);
            if (!$updateall) {
                if ($updated) {
                    return array("action" => "Merchant Rates Updated Successfully.", "status" => "success");
                }
                return array("action" => "Error, Please contact support.", "status" => "fail");
            }
        }
    }
    return array("action" => "Merchant(s) Rates Updated Successfully.", "status" => "success");
}
Пример #5
0
function transaction_update_user_pass($trans_id, $user, $pass)
{
    $query = "\t\n\t\tUPDATE \n\t\t\t`cs_transactiondetails`\n\t\tSET \n\t\t\ttd_username = '******',\n\t\t\ttd_password = '******'\n\t\tWHERE \n\t\t\t`transactionId` = '{$trans_id}'\n\t";
    sql_query_write($query) or dieLog(mysql_error() . "<pre>{$query}</pre>");
}
Пример #6
0
    $contactmethod = quote_smart($_REQUEST['contactmethod']);
    if ($_SESSION['no_more_where'] != "true") {
        $where = $_SESSION['where'] . " AND sub.`ss_subscription_ID` = '{$ss_subscription_ID}'";
    } else {
        $where = $_SESSION['where'];
    }
    ///////////////////////////////////bad
    //	$results = $lookup->find_transaction_query($where);
    //	$row=mysql_fetch_array($results);
    ///////////////////////////////////bad
    $results = $lookup->find_transaction_query($where);
    foreach ($results as $outer_key => $row) {
        $_SESSION['no_more_where'] = "true";
        $transactionId = $row['transactionId'];
        $sql = "INSERT INTO `cs_callnotes` (`transaction_id` , `call_date_time` , `service_notes` , `cancel_status` , `customer_notes` , `solved` , `is_bill_date_changed` , `call_duration` , `customer_service_id` , `prev_bill_date` , `dnc`, `cn_type`, `cn_contactmethod` )\n\t\t\t\tVALUES ('{$transactionId}', NOW() , 'User Requests Refund', '', '{$customer_notes}', '' , '', '', '', '', '', 'refundrequest', '{$contactmethod}');";
        sql_query_write("{$sql}");
        $ss_subscription_ID = $row['ss_subscription_ID'];
        if ($row[ss_rebill_status] == "active") {
            subscription_cancel($ss_subscription_ID, NULL, $ss_account_notes, $ss_rebill_status_text);
        }
        echo "<big><big><big><center>Processing...</big></big></big></center>";
    }
} elseif ($_REQUEST[action] == "cancel") {
    $reference_number = quote_smart($_REQUEST['reference_number']);
    $ss_account_notes = quote_smart(trim($_REQUEST['ss_account_notes']));
    $ss_rebill_status_text = quote_smart($_REQUEST['ss_rebill_status_text']);
    if ($_SESSION['no_more_where'] != "true") {
        $where = $_SESSION['where'] . " AND td.`reference_number` = '{$reference_number}'";
    } else {
        $where = $_SESSION['where'];
    }
    if ($_POST['Email_Contract_Notification'] && $access['Data']['send_mail']['Value'] == 1) {
        send_email_template('contract_notification_email', $data);
    }
    if ($_POST['Email_Active_Notification'] && $access['Data']['send_mail']['Value'] == 1) {
        send_email_template('active_notification_email', $data);
    }
    if ($_POST['cd_custom_contract'] && !$access['Data']['cd_custom_contract']['Value']) {
        $Rates = new rates_fees();
        $contract = $Rates->get_Merchant_Contract($en_ID);
        $sql = "insert into cs_email_templates \n\t\t\tset et_name='merchant_contract', \n\t\t\tet_custom_id='" . $company_id . "', \n\t\t\tet_title='" . quote_smart($access['Data']['en_company']['Value']) . " Contract', \n\t\t\tet_access='admin', \n\t\t\tet_to_title='" . quote_smart($access['Data']['en_company']['Value']) . "', \n\t\t\tet_subject='Custom Merchant Contract for " . quote_smart($access['Data']['en_company']['Value']) . "', \n\t\t\tet_htmlformat='" . quote_smart($contract['et_htmlformat']) . "', \n\t\t\tet_catagory='Merchant'";
        $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ sql");
        $_POST['cd_custom_contract'] = mysql_insert_id();
    } else {
        if (!$_POST['cd_custom_contract'] && $access['Data']['cd_custom_contract']['Value']) {
            $sql = "delete from cs_email_templates where et_name='merchant_contract' and et_custom_id='" . $company_id . "'";
            $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ sql");
            $access['Data']['cd_custom_contract']['AddHtml'] = NULL;
        }
    }
}
$res = check_merchant_conflict($_POST, $en_ID);
if (!$res['status']) {
    $access['HeaderMessage'] .= nl2br($res['msg']);
    foreach ($res['res'] as $key => $val) {
        if ($val) {
            $_POST[$key] = $access['Data'][$key]['Value'];
            $access['Data'][$key]['Highlight'] = true;
        }
    }
}
// Submit
Пример #8
0
     exit;
 } else {
     $qry_insert_user = "******";
     $qry_insert_user .= " values('{$username}','{$password}','{$companyname}','{$email}','{$volumeNumber}',0,'{$transaction_type}','rsel','{$resellerName}',{$resellerLogin},'{$current_date_time}',{$send_ecommercemail},'{$url}','{$gateway_id}',{$block_virtual_terminal})";
     //	print $qry_insert_user;
     if (!($show_sql = mysql_query($qry_insert_user))) {
         print mysql_errno() . ": " . mysql_error() . "<BR>";
         print "Cannot execute query <br>";
         exit;
     } else {
         $is_success = 0;
         $user_id = mysql_insert_id();
         $user_reference_num = func_User_Ref_No($user_id);
         $is_success = func_update_single_field('cs_companydetails', 'ReferenceNumber', $user_reference_num, NULL, 'userId', $user_id, $cnn_cs);
         $sql = "Insert into cs_entities\n\t\t\t\tset \n\t\t\t\t\ten_username = '******',\n\t\t\t\t\ten_password = MD5('" . ($username . $password) . "'),\n\t\t\t\t\ten_email = '" . quote_smart($email) . "',\n\t\t\t\t\ten_gateway_ID = '" . quote_smart($gateway_id) . "',\n\t\t\t\t\ten_type = 'merchant',\n\t\t\t\t\ten_signup = NOW(),\n\t\t\t\t\ten_type_id = '" . quote_smart($user_id) . "'\n\t\t\t\t";
         sql_query_write($sql) or dieLog(mysql_error() . " ~ {$str_qry}");
         $letterTempate = 'merchant_referral_letter';
         $emailData["email"] = $email_to;
         $emailData["reselleremail"] = $resellerInfo['reseller_email'];
         $emailData["full_name"] = "Merchant";
         $emailData["companyname"] = $companyname;
         $emailData["resellername"] = $resellerInfo['reseller_companyname'];
         $emailData["username"] = $username;
         $emailData["password"] = $password;
         $emailData["Reference_ID"] = $user_reference_num;
         send_email_template($letterTempate, $emailData);
         $emailInfo = get_email_template($letterTempate, $emailData);
         /*************************************************************************/
         $msgtodisplay = "New merchant registered successfully. Confirmation Email sent to '" . $email . "'";
         $outhtml = "Y";
         message($msgtodisplay, $outhtml, $headerInclude);
        }
        $update = "registered ";
        if (!$rd_recur_enabled) {
            $i_recur_day = 0;
        }
        if ($i_recur_day > 0 && $i_trial_days == 0) {
            $i_trial_days = 3;
        }
        if ($rd_ibill_landing_html && $chk_enable_landing) {
            $rd_ibill_landing_html = "'" . $rd_ibill_landing_html . "'";
        } else {
            $rd_ibill_landing_html = 'NULL';
        }
        $sql_fields = "\n\t\t\t`recur_day` = '{$i_recur_day}', \n\t\t\t`recur_charge` = '{$i_recur_charge}', \n\t\t\t`company_user_id` = '{$company_user_id}', \n\t\t\t`rd_en_ID` = '" . $companyInfo['en_ID'] . "', \n\t\t\t`rd_initial_amount` = '{$i_trial_amount}', \n\t\t\t`rd_trial_days` = '{$i_trial_days}', \n\t\t\t`rd_description`  = '{$i_txt_description}',\n\t\t\t`rd_hide`  = 0,\n\t\t\t`rd_recur_enabled` = '{$rd_recur_enabled}',\n\t\t\t`rd_ibill_landing_html`  = {$rd_ibill_landing_html},\n\t\t\t`rd_subName` = '{$rd_subName}'";
        $qry_insert_details = "\n\t\tINSERT INTO `cs_rebillingdetails` \n\t\tset {$sql_fields} on duplicate key update {$sql_fields}\n\t\t";
        $rst_insert = sql_query_write($qry_insert_details, $cnn_cs) or die(mysql_error());
        $subAccount = mysql_insert_id($cnn_cs);
        if ($rd_subaccount) {
            $subAccount = $rd_subaccount;
        }
        $subAccountName = $subAcc['rd_subName'];
        $msgtodisplay = "<br>Sub Account '{$rd_subName}' Updated successfully.<br>To use this subaccount, make sure to include the entire subaccount name '{$rd_subName}' in your integration form.<br> ";
        print "<table align='center' width='100%'><tr height='20'><td  align='center'><font face='verdana' size='1'>&nbsp;{$msgtodisplay}</td></tr><tr>\n\t</tr></table>";
    }
    endTable('Recurring Transaction', NULL, true, true);
    die;
}
$sql = "SELECT * FROM `cs_rebillingdetails` WHERE `rd_hide` = 0 AND `rd_en_ID` = '{$en_ID}' ORDER BY `rd_subaccount` DESC ";
if (!($result = sql_query_read($sql, $cnn_cs))) {
    print mysql_errno() . ": " . mysql_error() . "<BR>";
    print $qry_update . "<br>";
Пример #10
0
function createNewTicket($emailInfo, $tickets_users_username, $tickets_thread, $tickets_category = 1)
{
    $ticket = array();
    $ticket['tickets_reference'] = 'NULL';
    if (!$tickets_thread['tickets_id']) {
        $ticket['tickets_reference'] = "'" . strtoupper(substr(md5(time() . rand(0, 10000000)), 0, 16)) . "'";
    }
    $tickets_subject = str_replace("Re: ", "", $emailInfo['Subject']);
    $sql = "\r\n\t\tInsert ignore Into `tickets_tickets`\r\n\t\tset tickets_username = '******',\r\n\t\ttickets_child = '" . $tickets_thread['tickets_id'] . "',\r\n\t\ttickets_subject = '{$tickets_subject}',\r\n\t\ttickets_reference = " . $ticket['tickets_reference'] . ",\r\n\t\ttickets_name = '" . quote_smart($emailInfo['FromEmail']) . "',\r\n\t\ttickets_email = '" . quote_smart($emailInfo['FromEmail']) . "',\r\n\t\ttickets_question = '" . quote_smart($emailInfo['body']) . "',\r\n\t\ttickets_category = '" . quote_smart($tickets_category) . "',\r\n\t\ttickets_timestamp = '" . time() . "'";
    $result = sql_query_write($sql) or dieLog(mysql_error());
    $ticket['id'] = mysql_insert_id();
    if ($tickets_thread['tickets_id'] > 0) {
        sql_query_write("update `tickets_tickets` set tickets_status='Open' where tickets_id = '" . $tickets_thread['tickets_id'] . "'") or dieLog(mysql_error());
    }
    if ($tickets_thread['tickets_id']) {
        $ticket['tickets_reference'] = $tickets_thread['tickets_reference'];
    }
    return $ticket;
}
Пример #11
0
function func_update_single_field($tablename, $fieldname, $fieldvalue, $cnn, $comparefield, $comparefieldvalue, $cnn_cs = false)
{
    $sql = "update {$tablename} set {$fieldname}='{$fieldvalue}' where {$comparefield}={$comparefieldvalue}";
    if (!sql_query_write($sql, 1)) {
        //echo $qryUpdate;
        dieLog(mysql_error() . " {$sql}");
    }
}
Пример #12
0
 function update_account_status()
 {
     $ss_account_status = 'active';
     if (strtotime($this->row['subscriptionTable']['ss_account_expire_date']) < time()) {
         $ss_account_status = 'inactive';
     }
     $ss_account_notes = "\n\n" . date('Y-m-d G:i:s') . ": Account " . ucfirst($ss_account_status);
     $upd = "UPDATE\n\t\t\t\t\tcs_subscription\n\t\t\t\t\tSET\n\t\t\t\t\tss_account_status = '{$ss_account_status}',\n\t\t\t\t\tss_account_notes = CONCAT(`ss_account_notes`, '{$ss_account_notes}' )\n\t\t\t\t\tWHERE\n\t\t\t\t\tss_ID = {$this->row['subscriptionTable']['ss_ID']}";
     sql_query_write($upd) or dieLog(mysql_error() . "<pre>{$upd}</pre>");
     $this->row['subscriptionTable']['ss_account_status'] = $ss_account_status;
     $this->row['subscriptionTable']['ss_account_notes'] .= $ss_account_notes;
     if ($ss_account_status == 'inactive') {
         return Process_Transaction($this->row['subscriptionTable']['ss_transaction_id'], "expiration", $this->test, "transactionId");
     }
     return Process_Transaction($this->row['subscriptionTable']['ss_transaction_id'], "approve", $this->test, "transactionId");
 }
Пример #13
0
 function process_transactions($params)
 {
     set_time_limit(0);
     if (!$params['Format']) {
         $params['Format'] = "TXT";
     }
     if (!$params['Incremental']) {
         $params['Incremental'] = "True";
     }
     $RF = new rates_fees();
     $trans = $this->Status_Download($params);
     $return_affected_rows = 0;
     $approve_affected_rows = 0;
     $log = "";
     foreach ($trans as $tran) {
         $update = false;
         $chargeback = false;
         $refund = false;
         $status = "";
         switch (strtolower($tran['ResponseType'])) {
             case "processed":
                 $update = false;
                 break;
             case "b":
                 $update = false;
                 break;
             case "f":
                 $update = true;
                 $status = 'A';
                 break;
             case "r":
                 $update = true;
                 $status = 'D';
                 break;
             case "nsf":
                 $update = true;
                 $status = 'D';
                 break;
             case "chargeback":
                 $update = true;
                 $status = 'D';
                 $chargeback = true;
                 break;
             case "invalid":
                 $update = true;
                 $status = 'D';
                 break;
             case "declined":
                 $update = true;
                 $status = 'D';
                 break;
             case "refund":
                 $update = true;
                 $status = 'D';
                 $refund = true;
                 break;
             case "credit":
                 $update = true;
                 $status = 'D';
                 $refund = true;
                 break;
             case "incomplete":
                 $update = true;
                 $status = 'D';
                 break;
             case "cancelled":
                 $update = true;
                 $status = 'D';
                 break;
             case "bo exception":
                 $update = true;
                 $status = 'D';
                 break;
             case "downloaded":
                 $update = false;
                 break;
             case "credit originated":
                 $update = false;
                 break;
             case "credit downloaded":
                 $update = false;
                 break;
             case "credit return":
                 $update = true;
                 $status = 'D';
                 $chargeback = true;
                 break;
             case "credit funded":
                 $update = true;
                 $status = 'A';
                 break;
         }
         $refid = substr($tran['ExternalClientID'], 0, 50);
         if (!$refid) {
             continue;
         }
         $sql = "\n\t\t\t\tselect * from \n\t\t\t\t\tcs_transactiondetails left join \n\t\t\t\t\tcs_subscription on \n\t\t\t\t\ttd_ss_ID = ss_ID\n\t\t\t\tWHERE\n\t\t\t\t\treference_number = '{$refid}'\n\t\t\t\t\tAND checkorcard='C'\t\t\n\t\t\t\tLIMIT 1\n\t\t\t";
         $tranResult = mysql_query($sql) or dieLog(mysql_error() . " ~ {$sql}");
         $transInfo = mysql_fetch_assoc($tranResult);
         $transId = $transInfo['transactionId'];
         if ($transInfo['status'] != 'P' && $update == true) {
             $update = false;
         }
         if (!$transId) {
             $log .= " Transaction ID Not Found!! " . print_r($tran, true);
             toLog('erroralert', 'misc', "Transaction ID Not Found!! {$transId} {$sql}");
             $update = false;
         }
         if ($update) {
             $log .= " Found Response Type (" . $tran['ResponseType'] . ") For ({$refid}):\n";
             $notify = 'decline';
             $bank_transid = $tran['TransID'];
             if ($tran['ResponseDate']) {
                 $billingDate = date('Y-m-d', strtotime($tran['ResponseDate']));
             } else {
                 $billingDate = "";
             }
             if ($chargeback) {
                 //is_chargeback
                 $sql = "\n\t\t\t\t\t\tUPDATE\n\t\t\t\t\t\t\tcs_transactiondetails left join \n\t\t\t\t\t\t\tcs_subscription on \n\t\t\t\t\t\t\ttd_ss_ID = ss_ID\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tstatus='A',\n\t\t\t\t\t\t\ttd_is_chargeback = 1,\n\t\t\t\t\t\t\ttd_bank_transaction_id = '{$bank_transid}',\n\t\t\t\t\t\t\tbillingDate = '{$billingDate}',\n\t\t\t\t\t\t\ttd_merchant_deducted=0,\n\t\t\t\t\t\t\tss_rebill_status = 'inactive',\n\t\t\t\t\t\t\tss_rebill_status_text = 'Subscription Inactive due to Chargeback'\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ttransactionId = '{$transId}'\n\t\t\t\t\t\t\tAND checkorcard='C'\t\t\n\t\t\t\t\t";
                 $log .= "  This transaction is a chargeback.\n";
                 $notify = 'chargeback';
                 $r = $RF->update_transaction_profit($transId);
             } else {
                 if ($refund) {
                     // cancel_status = y, cancel subscription
                     $sql = "\n\t\t\t\t\t\tUPDATE\n\t\t\t\t\t\t\tcs_transactiondetails left join \n\t\t\t\t\t\t\tcs_subscription on \n\t\t\t\t\t\t\ttd_ss_ID = ss_ID\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tstatus='A',\n\t\t\t\t\t\t\tcancelstatus = 'Y',\n\t\t\t\t\t\t\ttd_bank_transaction_id = '{$bank_transid}',\n\t\t\t\t\t\t\tbillingDate = '{$billingDate}',\n\t\t\t\t\t\t\ttd_merchant_deducted=0,\n\t\t\t\t\t\t\tss_rebill_status = 'inactive',\n\t\t\t\t\t\t\tss_rebill_status_text = 'Subscription Inactive due to Refund'\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ttransactionId = '{$transId}'\n\t\t\t\t\t\t\tAND checkorcard='C'\t\t\t\n\t\t\t\t\t";
                     $log .= "  This transaction is a refund.\n";
                     $notify = 'refund';
                     $r = $RF->update_transaction_profit($transId);
                 } else {
                     $ss_rebill_status_sql = $status == 'D' ? "ss_rebill_status = 'inactive', " : '';
                     $ss_rebill_status_text = $status == 'D' ? 'Subscription Inactive due to decline (' . $this->ach_status[$tran['ResponseType']] . ')' : 'Subscription Active';
                     $sql = "\n\t\t\t\t\t\tUPDATE\n\t\t\t\t\t\t\tcs_transactiondetails left join \n\t\t\t\t\t\t\tcs_subscription on \n\t\t\t\t\t\t\ttd_ss_ID = ss_ID\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\ttd_bank_transaction_id = '{$bank_transid}',\n\t\t\t\t\t\t\tstatus = '{$status}',\n\t\t\t\t\t\t\tbillingDate = '{$billingDate}',\n\t\t\t\t\t\t\ttd_merchant_deducted=0,\n\t\t\t\t\t\t\ttd_merchant_paid=0,\n\t\t\t\t\t\t\t{$ss_rebill_status_sql}\n\t\t\t\t\t\t\tss_rebill_status_text = '{$ss_rebill_status_text}'\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ttransactionId = '{$transId}'\n\t\t\t\t\t\t\tAND checkorcard='C'\tAND status='P'\t\n\t\t\t\t\t";
                     $log .= "  This transaction's status is (" . $this->ach_status[$tran['ResponseType']] . ").\n";
                     $r = $RF->update_transaction_profit($transId);
                 }
             }
             sql_query_write($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>");
             $affected = mysql_affected_rows();
             if ($status != 'A') {
                 $return_affected_rows += $affected;
             } else {
                 $approve_affected_rows += $affected;
             }
             if ($status == 'A') {
                 if ($transInfo['td_is_a_rebill']) {
                     $notify = 'rebill';
                 } else {
                     $notify = 'approve';
                 }
             }
             if ($affected) {
                 Process_Transaction($transId, $notify, 0, 'transactionId');
             }
         } else {
             $log .= "  Ignoring Transaction.\n";
         }
     }
     $log .= "CheckGateway Result: ({$return_affected_rows}) Returns, ({$approve_affected_rows}) Approves.\n";
     return $log;
 }
Пример #14
0
    if (!$index) {
        $index = $config_default_index;
    }
    session_destroy();
    header("location:" . $index . "?login_redir=" . base64_encode($_SERVER['REQUEST_URI']));
    exit;
}
if ($companyInfo['en_gateway_ID'] && $companyInfo['en_gateway_ID'] != $_SESSION["gw_id"]) {
    $_SESSION["gw_switch"] = $companyInfo['en_gateway_ID'];
}
if (!$_SESSION["gw_switch"]) {
    $_SESSION["gw_switch"] = $gateway_db_select;
}
if ($_SESSION["gw_user_en_debug"] && !isset($etel_debug_mode)) {
    if (ip2long($etel_current_ip) != $gwInfo['gw_debug_ip']) {
        sql_query_write("update etel_dbsmain.etel_gateways set gw_debug_ip = '" . ip2long($etel_current_ip) . "' where gw_id = '" . $gwInfo['gw_id'] . "'");
    }
    $etel_debug_mode = 1;
}
if (ip2long($etel_current_ip) == $gwInfo['gw_debug_ip'] && $_COOKIE['etel_debug_enable'] == 2 && !isset($etel_debug_mode)) {
    $etel_debug_mode = 1;
}
// Debug Mode
if ($etel_debug_mode == 1 && !$printable_version) {
    error_reporting(E_ALL ^ E_NOTICE);
    print "<span style='font-size: 10px;'>";
    print_r($_REQUEST);
    print "<br>";
    print_r($_SESSION);
    print "</span>";
} else {
Пример #15
0
//$etel_debug_mode = 1;
$etel_disable_https = 1;
include "includes/dbconnection.php";
$timelimit = 60;
$time = time();
for ($i = 0; $i <= 20; $i++) {
    $found = 0;
    $sleep = 10;
    $result = sql_query_read('SHOW PROCESSLIST ');
    while ($list = mysql_fetch_assoc($result)) {
        preg_match('/\\/\\* TIMEOUT=([0-9]*) \\*\\//', $list['Info'], $matches);
        $limit = intval($matches[1]);
        if ($limit >= 5 || intval($list['Time']) >= 300 && strpos(strtolower($list['Info']), 'select') !== false) {
            if (intval($list['Time']) >= $limit) {
                $sql = "KILL " . $list['Id'] . "\n";
                sql_query_write($sql);
                echo $sql;
                $found = 1;
            }
            $sleep = 1;
        }
    }
    if (!$found) {
        echo date('G:i:s') . ": No Processes to Kill<br>";
    }
    flush();
    if ($time + $timelimit < time()) {
        die;
    }
    sleep($sleep);
}
Пример #16
0
function smart_removeRefund($values, $action)
{
    global $curUserInfo;
    if (!$curUserInfo['en_access'][ACCESS_AUTH_TRANS_MOD]) {
        return array("action" => "Invalid Access.", "status" => "Fail");
    }
    $transID = $values['append'];
    $qry_details = "UPDATE cs_transactiondetails SET `cancelstatus` = 'N',`td_bank_deducted`=1,`td_merchant_deducted`=1,`td_reseller_deducted`=1  WHERE `transactionId` = '{$transID}'";
    $rst_details = sql_query_write($qry_details) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>Cannot execute query");
    $qry_details = "DELETE FROM cs_callnotes WHERE `cn_type` = 'refundrequest' AND `transaction_id` = '{$transID}'";
    $rst_details = sql_query_write($qry_details) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>Cannot execute query");
    $RF = new rates_fees();
    $r = $RF->update_transaction_profit($transID);
    return array("action" => "Transaction ID " . $values['append'] . " refund removed.", "status" => "success");
}
Пример #17
0
include "includes/header.php";
$sessionAdmin = isset($HTTP_SESSION_VARS["sessionAdmin"]) ? $HTTP_SESSION_VARS["sessionAdmin"] : "";
$ptype = isset($HTTP_GET_VARS['ptype']) ? quote_smart($HTTP_GET_VARS['ptype']) : "";
$headerInclude = "transactions";
//print_r($_REQUEST);
require_once "../includes/projSetCalc.php";
$str_adminapproval = "";
$sessionlogin = isset($HTTP_SESSION_VARS["sessionlogin"]) ? $HTTP_SESSION_VARS["sessionlogin"] : "";
$mi_ID = quote_smart($_REQUEST['mi_ID']);
$mi_status = quote_smart($_REQUEST['mi_status']);
$mi_notes = quote_smart($_REQUEST['mi_notes']);
$mi_notes = str_replace('\\r\\n', "\n", $mi_notes);
if ($mi_status && $_REQUEST['action'] == 'Update Invoice' && $mi_ID) {
    $send_invoice_confirm = intval($_POST['send_invoice_confirm']);
    $invoice_sql = "update cs_merchant_invoice set mi_status = '{$mi_status}', mi_notes = '{$mi_notes}' where mi_ID ='{$mi_ID}'";
    $result = sql_query_write($invoice_sql) or dieLog(mysql_error() . " ~ {$invoice_sql}");
    $msg = "Invoice #{$mi_ID} Updated.";
    if ($send_invoice_confirm) {
        $invoice_sql = "select * from cs_merchant_invoice left join cs_companydetails on userId = mi_company_id where mi_ID ='{$mi_ID}'";
        $result = sql_query_read($invoice_sql) or dieLog(mysql_error() . " ~ {$invoice_sql}");
        $invoiceInfo = mysql_fetch_assoc($result);
        $emailData = array();
        $emailData["companyname"] = $invoiceInfo['companyname'];
        $emailData["username"] = $invoiceInfo['username'];
        $emailData["password"] = $invoiceInfo['password'];
        $emailData["Reference_ID"] = $invoiceInfo['ReferenceNumber'];
        $emailData["email"] = $invoiceInfo['email'];
        $emailData["wiredate"] = $invoiceInfo['mi_paydate'];
        $emailData["mi_title"] = $invoiceInfo['mi_title'];
        $emailData["mi_deduction"] = $invoiceInfo['mi_deduction'];
        $emailData["mi_status"] = $mi_status;
Пример #18
0
 function risk_report_install()
 {
     $report['Total Transactions']['desc'] = "The total number and value of all transactions";
     $report['Total Transactions']['source'] = '$sales_amount';
     $report['Total Transactions']['display'] = '$sales_count . " (\\$" . number_format($sales_amount,2) . ")"';
     $report['Declined Transactions']['desc'] = "Alert when Declines are above Percentage";
     $report['Declined Transactions']['source'] = '$sales_amount > 0 ? $decline_amount*100/$sales_amount : 0';
     $report['Declined Transactions']['display'] = 'number_format($sales_amount > 0 ? $decline_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($decline_amount,2) . ")"';
     $report['Unique Declined Transactions']['desc'] = "Alert when Unique Declines are above Percentage";
     $report['Unique Declined Transactions']['source'] = '$sales_amount > 0 ? $uniquedecline_amount*100/$sales_amount : 0';
     $report['Unique Declined Transactions']['display'] = 'number_format($sales_amount > 0 ? $uniquedecline_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($uniquedecline_amount,2) . ")"';
     $report['Chargebacks - Total']['desc'] = "Alert when Transaction Chargebacks are over a limit";
     $report['Chargebacks - Total']['source'] = '$sales_amount > 0 ? $chargebacks_amount*100/$sales_amount : 0';
     $report['Chargebacks - Total']['display'] = 'number_format($sales_amount > 0 ? $chargebacks_amount*100/$sales_amount : 0,2)."% (\\$" . number_format($chargebacks_amount,2) . ")"';
     $report['Chargebacks - Visa']['desc'] = "Alert when Visa Transaction Chargebacks are over a limit";
     $report['Chargebacks - Visa']['source'] = '$sales_amount > 0 ? $chargebacksVisa_amount*100/$sales_amount : 0';
     $report['Chargebacks - Visa']['display'] = 'number_format($sales_amount > 0 ? $chargebacksVisa_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format(chargebacksVisa_amount,2) . ")"';
     $report['Chargebacks - MC']['desc'] = "Alert when Mastercard Transaction Chargebacks are over a limit";
     $report['Chargebacks - MC']['source'] = '$sales_amount > 0 ? $chargebacksMastercard_amount*100/$sales_amount : 0';
     $report['Chargebacks - MC']['display'] = 'number_format($sales_amount > 0 ? $chargebacksMastercard_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($chargebacksMastercard_amount,2) . ")"';
     $report['Refunds']['desc'] = "Alert when Refunds are over a limit";
     $report['Refunds']['source'] = '$sales_amount > 0 ? $refund_amount*100/$sales_amount : 0';
     $report['Refunds']['display'] = 'number_format($sales_amount > 0 ? $refund_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($refund_amount,2) . ")"';
     $report['Non-Unique Transactions']['desc'] = "Alert when Non-Unique Transactions are over a limit";
     $report['Non-Unique Transactions']['source'] = '$sales_amount > 0 ? $nonunique_amount*100/$sales_amount : 0';
     $report['Non-Unique Transactions']['display'] = 'number_format($sales_amount > 0 ? $nonunique_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($nonunique_amount,2) . ")"';
     //		$report['Unique Transactions']['desc'] = "Alert when Unique Approved Transactions are over a limit";
     //		$report['Unique Transactions']['source'] = '$sales_amount > 0 ? $unique_amount*100/$sales_amount : 0';
     //		$report['Unique Transactions']['display'] = 'number_format($sales_amount > 0 ? $unique_amount*100/$sales_amount : 0,2) . "% (\$" . number_format($unique_amount,2) . ")"';
     $report['CreditCard Transactions']['desc'] = "Report on CreditCard Sales";
     $report['CreditCard Transactions']['source'] = '$sales_amount > 0 ? $creditcard_amount*100/$sales_amount : 0';
     $report['CreditCard Transactions']['display'] = 'number_format($sales_amount > 0 ? $creditcard_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($creditcard_amount,2) . ")"';
     $report['Check Transactions']['desc'] = "Report on Check Sales";
     $report['Check Transactions']['source'] = '$sales_amount > 0 ? $check_amount*100/$sales_amount : 0';
     $report['Check Transactions']['display'] = 'number_format($sales_amount > 0 ? $check_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($check_amount,2) . ")"';
     $report['Web900 Transactions']['desc'] = "Report on Web900 Sales";
     $report['Web900 Transactions']['source'] = '$sales_amount > 0 ? $web900_amount*100/$sales_amount : 0';
     $report['Web900 Transactions']['display'] = 'number_format($sales_amount > 0 ? $web900_amount*100/$sales_amount : 0,2) . "% (\\$" . number_format($web900_amount,2) . ")"';
     $report['Spider Score']['desc'] = "Alert when website has a high Spider Score";
     $report['Spider Score']['source'] = 'number_format($spider,2)';
     $report['Customer Support']['desc'] = "Report on Customer Service";
     $report['Customer Support']['source'] = 'str_replace("\\n,","<br>",$customerservice)';
     $report['Total Transactions']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 1000, "text" => "Low", "color" => "CCFFCC", "score" => 0, "plaintext" => ""), array("limit" => 5000, "text" => "Medium", "color" => "99FF99", "score" => 0, "plaintext" => ""), array("limit" => 10000, "text" => "High", "color" => "66FF66", "score" => 0, "plaintext" => ""), array("limit" => 100000, "text" => "Severe", "color" => "00FF00", "score" => 0, "plaintext" => ""));
     $report['Declined Transactions']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 15, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => "The number of declined transactions is currently at a low level."), array("limit" => 25, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => "You should be aware of the number of declined transactions.  This number should be lower."), array("limit" => 35, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => "The number of declined transactions is approaching an unacceptible level.  Please take steps to correct this."), array("limit" => 45, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => "The number of declined transactions is above the acceptible level.  You must correct this problem as soon as possible."));
     $report['Unique Declined Transactions']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 17, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => "Some transactions are not being approved."), array("limit" => 18, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => "The number of transactions not being approved is getting high.  Please correct this."), array("limit" => 19, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => "The number of transactions that have not be approved is reaching an unacceptible level.  You should take steps to correct this."), array("limit" => 20, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => "The number of transactions that failed to be approved is at an unacceptible level.  You must correct this."));
     $report['Chargebacks - Total']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 0.5, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => "You have a low number of chargebacks."), array("limit" => 1.0, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => "The number of chargebacks is getting high.  Be aware of this."), array("limit" => 1.5, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => "The number of chargebacks is reaching an unacceptible level.  You should take steps to correct this."), array("limit" => 2.0, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => "The number of chargebacks is at an unacceptible level.  You must correct this."));
     $report['Chargebacks - Visa']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 0.5, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => "You have a very low occurance of chargebacks on Visa cards."), array("limit" => 1.0, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => "The number of chargebacks on Visa cards is getting high.  You need to watch this."), array("limit" => 1.5, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => "The number of chargebacks on Visa cards is getting too high.  You must correct this."), array("limit" => 2.0, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => "The number of chargebacks on Visa cards is unacceptible.  This must be corrected immediately."));
     $report['Chargebacks - MC']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 0.25, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => "You have a very low occurance of chargebacks on Mastercard."), array("limit" => 0.5, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => "The number of chargebacks on Mastercard is getting high.  You need to watch this."), array("limit" => 0.75, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => "The number of chargebacks on Mastercard is getting too high.  You must correct this."), array("limit" => 1.0, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => "The number of chargebacks on Mastercard is unacceptible.  This must be corrected immediately."));
     $report['Refunds']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 5, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => "The number of refunds is low but you should keep an eye on them."), array("limit" => 6, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => "The number of refunds is getting higher.  You should find ways to reduce refunds."), array("limit" => 7, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => "The number of refunds is high.  You need to fix this."), array("limit" => 8, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => "The number of refunds is unacceptible.  This must be fixed."));
     $report['Non-Unique Transactions']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 15, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => ""), array("limit" => 20, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => ""), array("limit" => 25, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => ""), array("limit" => 30, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => ""));
     /*
     		$report['Unique Transactions']['label'] = array(
     											array("limit"=>0,"text"=>"Very Low","color"=>"FFFFFF","score"=>0,"plaintext"=>""),
     											array("limit"=>15,"text"=>"Low","color"=>"FFEEEE","score"=>10,"plaintext"=>""),
     											array("limit"=>20,"text"=>"Medium","color"=>"FFAAAA","score"=>20,"plaintext"=>""),
     											array("limit"=>25,"text"=>"High","color"=>"FF6666","score"=>30,"plaintext"=>""),
     											array("limit"=>30,"text"=>"Severe","color"=>"FF0000","score"=>40,"plaintext"=>"")
     										);
     */
     $report['CreditCard Transactions']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 15, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => ""), array("limit" => 20, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => ""), array("limit" => 25, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => ""), array("limit" => 30, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => ""));
     $report['Check Transactions']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 15, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => ""), array("limit" => 20, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => ""), array("limit" => 25, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => ""), array("limit" => 30, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => ""));
     $report['Web900 Transactions']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 15, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => ""), array("limit" => 20, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => ""), array("limit" => 25, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => ""), array("limit" => 30, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => ""));
     $report['Spider Score']['label'] = array(array("limit" => 0, "text" => "Very Low", "color" => "FFFFFF", "score" => 0, "plaintext" => ""), array("limit" => 15, "text" => "Low", "color" => "FFEEEE", "score" => 10, "plaintext" => ""), array("limit" => 20, "text" => "Medium", "color" => "FFAAAA", "score" => 20, "plaintext" => ""), array("limit" => 25, "text" => "High", "color" => "FF6666", "score" => 30, "plaintext" => ""), array("limit" => 30, "text" => "Severe", "color" => "FF0000", "score" => 40, "plaintext" => ""));
     $report_dates[] = array("rrd_name" => "month", "rrd_title" => "This Month", "rrd_from_day" => '1', "rrd_from_month" => '$this_month', "rrd_from_year" => '$this_year', "rrd_to_day" => '0', "rrd_to_month" => '$this_month+1', "rrd_to_year" => '$this_year');
     $report_dates[] = array("rrd_name" => "month", "rrd_title" => "Last Month", "rrd_from_day" => '1', "rrd_from_month" => '$this_month-1', "rrd_from_year" => '$this_year', "rrd_to_day" => '0', "rrd_to_month" => '$this_month', "rrd_to_year" => '$this_year');
     $report_dates[] = array("rrd_name" => "day", "rrd_title" => "Today", "rrd_from_day" => '$this_day', "rrd_from_month" => '$this_month', "rrd_from_year" => '$this_year', "rrd_to_day" => '$this_day', "rrd_to_month" => '$this_month', "rrd_to_year" => '$this_year');
     $report_dates[] = array("rrd_name" => "day", "rrd_title" => "Yesterday", "rrd_from_day" => '$this_day-1', "rrd_from_month" => '$this_month', "rrd_from_year" => '$this_year', "rrd_to_day" => '$this_day-1', "rrd_to_month" => '$this_month', "rrd_to_year" => '$this_year');
     $report_dates[] = array("rrd_name" => "week", "rrd_title" => "Last Week", "rrd_from_day" => '$this_day-13', "rrd_from_month" => '$this_month', "rrd_from_year" => '$this_year', "rrd_to_day" => '$this_day-7', "rrd_to_month" => '$this_month', "rrd_to_year" => '$this_year');
     $report_dates[] = array("rrd_name" => "week", "rrd_title" => "This Week", "rrd_from_day" => '$this_day-6', "rrd_from_month" => '$this_month', "rrd_from_year" => '$this_year', "rrd_to_day" => '$this_day', "rrd_to_month" => '$this_month', "rrd_to_year" => '$this_year');
     $report_proj[] = array("rrp_name" => 'tomorrow', "rrp_title" => 'Tomorrow', "rrp_equation" => 'number_format($lastday != 0 ? $thisday+$thisday-$lastday : 0,2)');
     $report_proj[] = array("rrp_name" => 'nextweek', "rrp_title" => 'Next Week', "rrp_equation" => 'number_format($lastweek != 0 ? $thisweek+$thisweek-$lastweek : 0,2)');
     $report_proj[] = array("rrp_name" => 'nextmonth', "rrp_title" => 'Next Month', "rrp_equation" => 'number_format($lastmonth != 0 ? $thismonth+$thismonth-$lastmonth : 0,2)');
     foreach ($report as $title => $info) {
         $values = "rrc_title=\"" . $title . "\"";
         $values .= ", rrc_desc=\"" . $info['desc'] . "\"";
         $values .= ", rrc_equation='" . $info['source'] . "'";
         $values .= ", rrc_display='" . $info['display'] . "'";
         $values .= ", rrc_label='" . quote_smart(serialize($info['label'])) . "'";
         $sql = "INSERT INTO cs_risk_report_calc SET {$values} ON DUPLICATE KEY UPDATE {$values};";
         $res = sql_query_write($sql) or dieLog(mysql_error());
     }
     $sql = "DELETE FROM cs_risk_report_dates";
     $res = sql_query_write($sql) or dieLog(mysql_error());
     foreach ($report_dates as $index => $info) {
         $values = "";
         foreach ($info as $name => $value) {
             $values .= ($values != "" ? ", " : "") . "{$name}=\"{$value}\"";
         }
         $sql = "INSERT INTO cs_risk_report_dates SET {$values};";
         $res = sql_query_write($sql) or dieLog(mysql_error());
     }
     foreach ($report_proj as $index => $info) {
         $values = "";
         foreach ($info as $name => $value) {
             $values .= ($values != "" ? ", " : "") . "{$name}=\"{$value}\"";
         }
         $sql = "INSERT INTO cs_risk_report_projections SET {$values} ON DUPLICATE KEY UPDATE {$values};";
         $res = sql_query_write($sql) or dieLog(mysql_error());
     }
 }
Пример #19
0
 function commit_transfer($data)
 {
     $sql = "\n\t\tInsert into \n\t\t\tcs_profit_action\n\t\tset\n\t\t\tpa_date = now(),\n\t\t\tpa_status = 'pending',\n\t\t\tpa_desc = '" . $data['description'] . "',\n\t\t\tpa_info = '" . quote_smart(serialize($data)) . "'\n\t\t";
     $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
     $pa_ID = mysql_insert_id();
     if (!$result || !$pa_ID) {
         dieLog(mysql_error() . " ~ {$sql}");
     }
     sql_query_write("Start Transaction") or dieLog(mysql_error() . " ~ {$sql}");
     foreach ($data['transfers'] as $transfer) {
         $transfer['amount'] = floatval($transfer['amount']);
         if ($transfer['amount'] <= 0) {
             dieLog("Profit Transfer Error: Amount <=0 " . print_r($transfer, true));
         }
         if ($transfer['from_entity'] < 1 || $transfer['to_entity'] < 1) {
             dieLog("Profit Transfer Error: Entity ID < 1 " . print_r($transfer, true));
         }
         if (!$transfer['date_entered'] || !strtotime($transfer['date_entered'])) {
             $transfer['date_entered'] = date('Y-m-d G:i:s');
         }
         if (!$transfer['date_effective'] || !strtotime($transfer['date_effective'])) {
             $transfer['date_effective'] = date('Y-m-d G:i:s');
         }
         if (!$transfer['transfer_type']) {
             $transfer['transfer_type'] = 'General';
         }
         $params = array();
         $params['pt_action_ID'] = $pa_ID;
         $params['pt_type'] = $transfer['transfer_type'];
         $params['pt_bank_ID'] = $transfer['bank_ID'];
         $params['pt_trans_ID'] = $transfer['trans_ID'];
         $params['pt_date_entered'] = $transfer['date_entered'];
         $params['pt_date_effective'] = $transfer['date_effective'];
         // Transfer From
         $params['pt_amount'] = -$transfer['amount'];
         $params['pt_entity_ID'] = $transfer['from_entity'];
         $sql_set = "";
         foreach ($params as $p_name => $p_value) {
             $sql_set .= ($sql_set == "" ? "" : ",\r\n") . $p_name . " = '" . quote_smart($p_value) . "'";
         }
         $sql = "\n\t\t\tINSERT INTO\n\t\t\t\tcs_profit\n\t\t\tSET\n\t\t\t\t{$sql_set}\n\t\t\t";
         $result = sql_query_write($sql);
         if (!$result) {
             sql_query_write("RollBack") or dieLog(mysql_error() . " ~ {$sql}");
             dieLog(mysql_error() . " ~ {$sql}");
         }
         // Transfer To
         $params['pt_amount'] = $transfer['amount'];
         $params['pt_entity_ID'] = $transfer['to_entity'];
         $sql_set = "";
         foreach ($params as $p_name => $p_value) {
             $sql_set .= ($sql_set == "" ? "" : ",\r\n") . $p_name . " = '" . quote_smart($p_value) . "'";
         }
         $sql = "\n\t\t\tINSERT INTO\n\t\t\t\tcs_profit\n\t\t\tSET\n\t\t\t\t{$sql_set}\n\t\t\t";
         $result = sql_query_write($sql);
         if (!$result) {
             sql_query_write("RollBack") or dieLog(mysql_error() . " ~ {$sql}");
             dieLog(mysql_error() . " ~ {$sql}");
         }
     }
     sql_query_write("Commit") or dieLog(mysql_error() . " ~ {$sql}");
     $sql = "\n\t\t\tUpdate \n\t\t\t\tcs_profit_action\n\t\t\tSet\n\t\t\t\tpa_status = 'success'\n\t\t\tWhere\n\t\t\t\tpa_ID = '{$pa_ID}'\n\t\t\t";
     $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
 }
Пример #20
0
 function update_banlist($data, $bl_group = 0)
 {
     if ($bl_group) {
         $sql = "Delete from cs_banlist where bl_group = '{$bl_group}'";
         sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
     } else {
         //$sql = "select bl1.bl_group+1 as nextAvailable from `cs_banlist` as bl1 left join `cs_banlist` as bl2 on bl1.bl_group = bl2.bl_group-1 where bl2.bl_group is null limit 1";
         $sql = "select max(bl_group)+1 as nextAvailable from `cs_banlist`";
         $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
         if (mysql_num_rows($result)) {
             $bl_group = @mysql_result($result, 0, 0);
         }
         if ($bl_group < 1) {
             $bl_group = 1;
         }
     }
     $cnt = 0;
     foreach ($data as $bl_type => $bl_data) {
         if ($this->bl_types[$bl_type] && $bl_data) {
             $cnt++;
         }
     }
     if ($cnt == sizeof($data)) {
         foreach ($data as $bl_type => $bl_data) {
             $sql = "Insert into cs_banlist set bl_group = '{$bl_group}', bl_type = '{$bl_type}', bl_data = '{$bl_data}'";
             if ($this->bl_types[$bl_type] && $bl_data) {
                 sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
             }
         }
     }
     return array('bl_group' => $bl_group);
 }
Пример #21
0
echo $cnt;
die;
$sql = " SELECT * FROM cs_subscription AS sub LEFT JOIN cs_rebillingdetails AS r ON r.rd_subaccount = sub.ss_rebill_id LEFT JOIN cs_transactiondetails AS t ON sub.ss_transaction_id =\r\nt.transactionid LEFT JOIN cs_companydetails AS cd on cd.userId = ss_user_ID LEFT JOIN etel_dbsmain.cs_company_sites AS cs on cs_ID = ss_site_ID WHERE 1 AND rd_enabled = 'Yes' AND activeuser = '******' AND cs_verified in\r\n('approved','non-compliant') AND sub.ss_user_id IN\r\n(130852,139955,137109,132248,132248,136418,137250,136324,114394,116850,137250,116137,126152,139544,137250,126402,136324,116275,130420,121493,130852,125190,136806,134900,137250,135499,137703,118966,137250,112653,136806,117533,137250,125458,137250,137250,137250,113298,139623,115007,117806,136806,118886,137109,130852,114786,116661,136806,136806,137250,119875,114836,133465,137250,137250,116337,137250,115120,137250,137250,112421,139920,114798,137494,110708,135682,137250,137109,136806,137109,125035,114706,137250,137250,137250,131596,114760,117215,119339,135682,135239,136806,137250,136039,119475,138625,135682,119724,116640,122634,117901,136806,137250,137250,136806,137250,137250,114901,123557,110745,132059,135041,137250,137250,137250,115842,119966,130852,136806,136806,137250,110758,121527,114073,117700,117176,126402,119074,134436,137250,137250,115044,115345,120309,132059,131304,136040,134815,111227,136806,137250,137250,118243,131596,126402,126402,113027,134606,136806,117700,130852,133988,115120,111019,120349,119155,130852,136806,133988,137250,116457,113697,113166,119538,111741,116335,117318,136806,136806,137250,117186,116850,137612,120469,136653,130084,121091,134606,137250,137250,137250,111409,132059,124530) AND\r\nsub.ss_rebill_frozen IN ('nocvv2') limit 30000 ";
$result = sql_query_read($sql) or dieLog(mysql_error());
while ($subInfo = mysql_fetch_assoc($result)) {
    $ss_bank_id = 37;
    if ($subInfo['ss_billing_type'] == 'MasterCard') {
        $ss_bank_id = 38;
    }
    $add_data = array('billing_descriptor' => 'NovaPay');
    $subs = new transaction_class(false);
    $subs->pull_subscription($subInfo['ss_ID']);
    $subs->send_email('customer_newbank_notification', $add_data);
    $sql = "Update cs_subscription set ss_rebill_frozen = 'no', ss_bank_id = '{$ss_bank_id}' where ss_ID = '" . $subInfo['ss_ID'] . "'";
    //echo $sql.'<br>';
    sql_query_write($sql) or dieLog(mysql_error());
}
die;
$sql = "SELECT CCnumber, bankroutingcode, bankaccountnumber,transactionId\r\nFROM cs_transactiondetails\r\n";
$cnt = 0;
$result = mysql_query($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
$unique = array();
while ($transInfo = mysql_fetch_assoc($result)) {
    $key = $transInfo['CCnumber'] . $transInfo['bankroutingcode'] . $transInfo['bankaccountnumber'];
    $sql = "Update cs_transactiondetails set td_non_unique='" . $unique[$key] . "' where transactionId = " . $transInfo['transactionId'];
    mysql_query($sql) or die(mysql_error());
    $cnt += mysql_affected_rows();
    if (!isset($unique[$key])) {
        $unique[$key] = $transInfo['transactionId'];
    }
}
Пример #22
0
            sql_query_read($qry_update) or dieLog(mysql_error() . " ~ " . $qry_update, "Failed to reenable URL for this company. Please contact support.");
            toLog('pendingwebsite', 'merchant', "Merchant {$siteid} reenables site {$cs_URL}", $deleted_cs_info['cs_ID']);
        } else {
            $msg = "Added Site Successfully.";
            $qry_update = "INSERT INTO  `cs_company_sites` \n\t\t\t\t\t\tSET \n\t\t\t\t\t\t\tcs_created = NOW(),\n\t\t\t\t\t\t\tcs_en_ID = '" . $companyInfo['en_ID'] . "', \n\t\t\t\t\t\t\tcs_URL = '{$cs_URL}',\n\t\t\t\t\t\t\tcs_title = '{$cs_title}',\n\t\t\t\t\t\t\tcs_order_page = '{$cs_order_page}',\n\t\t\t\t\t\t\tcs_return_page = '{$cs_return_page}',\n\t\t\t\t\t\t\tcs_gatewayId = '" . $_SESSION["gw_id"] . "',\n\t\t\t\t\t\t\tcs_company_id = '{$siteid}',\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcs_reference_ID = '" . strtoupper(md5($hashURL)) . "',\n\t\t\t\t\t\t\tcs_name = '{$hashURL}',\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcs_ftp_user='******', \n\t\t\t\t\t\t\tcs_ftp_pass='******', \n\t\t\t\t\t\t\tcs_ftp='{$cs_ftp}', \n\t\t\t\t\t\t\tcs_support_email='{$cs_support_email}', \n\t\t\t\t\t\t\tcs_support_phone='{$cs_support_phone}', \n\t\t\t\t\t\t\tcs_reason = '',\n\t\t\t\t\t\t\tcs_2257_page = '{$cs_2257_page}',\n\t\t\t\t\t\t\tcs_member_url = '{$cs_member_url}',\n\t\t\t\t\t\t\tcs_member_username = '******',\n\t\t\t\t\t\t\tcs_member_password = '******',\n\t\t\t\t\t\t\tcs_enable_passmgmt = '{$cs_enable_passmgmt}',\n\t\t\t\t\t\t\tcs_allow_testmode = '{$cs_allow_testmode}',\n\n\t\t\t\t\t\t\tcs_member_secret = '{$cs_member_secret}',\n\t\t\t\t\t\t\tcs_member_data = '" . serialize($cs_member_data) . "',\n\t\t\t\t\t\t\tcs_member_updateurl = '{$cs_member_updateurl}',\n\n\t\t\t\t\t\t\tcs_notify_url = '{$cs_notify_url}',\n\t\t\t\t\t\t\tcs_notify_retry = '{$cs_notify_retry}',\n\t\t\t\t\t\t\tcs_notify_user = '******',\n\t\t\t\t\t\t\tcs_notify_pass = '******',\n\t\t\t\t\t\t\tcs_notify_type = '{$cs_notify_type}',\n\t\t\t\t\t\t\tcs_notify_key = '{$cs_notify_key}',\n\n\t\t\t\t\t\t\tcs_notify_event = '{$cs_notify_event}',\n\t\t\t\t\t\t\tcs_notify_eventurl = '{$cs_notify_eventurl}',\n\t\t\t\t\t\t\tcs_notify_eventuser = '******',\n\t\t\t\t\t\t\tcs_notify_eventpass = '******',\n\t\t\t\t\t\t\tcs_notify_eventdomain = '{$cs_notify_eventdomain}',\n\t\t\t\t\t\t\tcs_notify_eventlogintype = '{$cs_notify_eventlogintype}'\n\t\t\t\t\t\t";
            sql_query_read($qry_update) or dieLog(mysql_error() . " ~ " . $qry_update, "Failed to add URL to this company. This URL may already exist for another company.");
            toLog('pendingwebsite', 'merchant', "Merchant {$siteid} adds site {$cs_URL}", mysql_insert_id());
        }
    } else {
        if ($_POST['mode'] == 'edit') {
            $qry_update = "UPDATE `cs_company_sites` \n\t\t\t\t\t\tSET \n\t\t\t\t\t\t\tcs_order_page = '{$cs_order_page}',\n\t\t\t\t\t\t\tcs_title = '{$cs_title}',\n\t\t\t\t\t\t\tcs_return_page = '{$cs_return_page}',\n\t\t\t\t\t\t\tcs_ftp_user='******', \n\t\t\t\t\t\t\tcs_ftp_pass='******', \n\t\t\t\t\t\t\tcs_ftp='{$cs_ftp}', \n\t\t\t\t\t\t\tcs_support_email='{$cs_support_email}', \n\t\t\t\t\t\t\tcs_support_phone='{$cs_support_phone}', \n\t\t\t\t\t\t\tcs_reason = '',\n\t\t\t\t\t\t\tcs_2257_page = '{$cs_2257_page}',\n\t\t\t\t\t\t\tcs_member_url = '{$cs_member_url}',\n\t\t\t\t\t\t\tcs_member_username = '******',\n\t\t\t\t\t\t\tcs_member_password = '******',\n\t\t\t\t\t\t\tcs_enable_passmgmt = '{$cs_enable_passmgmt}',\n\n\t\t\t\t\t\t\tcs_member_secret = '{$cs_member_secret}',\n\t\t\t\t\t\t\tcs_member_data = '" . serialize($cs_member_data) . "',\n\t\t\t\t\t\t\tcs_member_updateurl = '{$cs_member_updateurl}',\n\n\t\t\t\t\t\t\tcs_notify_url = '{$cs_notify_url}',\n\t\t\t\t\t\t\tcs_notify_retry = '{$cs_notify_retry}',\n\t\t\t\t\t\t\tcs_notify_user = '******',\n\t\t\t\t\t\t\tcs_notify_pass = '******',\n\t\t\t\t\t\t\tcs_notify_type = '{$cs_notify_type}',\n\t\t\t\t\t\t\tcs_notify_key = '{$cs_notify_key}',\n\t\t\t\t\t\t\tcs_allow_testmode = '{$cs_allow_testmode}',\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcs_notify_event = '{$cs_notify_event}',\n\t\t\t\t\t\t\tcs_notify_eventurl = '{$cs_notify_eventurl}',\n\t\t\t\t\t\t\tcs_notify_eventuser = '******',\n\t\t\t\t\t\t\tcs_notify_eventpass = '******',\n\t\t\t\t\t\t\tcs_notify_eventdomain = '{$cs_notify_eventdomain}',\n\t\t\t\t\t\t\tcs_notify_eventlogintype = '{$cs_notify_eventlogintype}'\n\t\t\t\t\t";
            //if(strcasecmp("approved",$cs_verified) !=0 )
            //	$qry_update .=",cs_verified = 'pending'";
            $qry_update .= "\t\t\t\t\t\t\t\n\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t{$identity} AND `cs_ID` = '{$cs_ID}'";
            toLog('pendingwebsite', 'merchant', "Merchant {$siteid} updates site {$cs_URL}", $cs_ID);
            sql_query_write($qry_update) or dieLog(mysql_error() . " ~ " . $qry_update, "Failed to edit URL for this company. Please contact support.");
        }
    }
}
$sql = "SELECT * FROM `cs_company_sites` WHERE {$identity} AND  cs_hide = '0' order by cs_verified DESC";
if (!($result = sql_query_read($sql, 1))) {
    dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
} else {
    ?>


&nbsp;
<script language="javascript">
function removeQuery(name)
{
	return confirm("Are you sure you want to delete Site '"+name+"'?");
Пример #23
0
function etel_get_clicker_ID(&$data)
{
    $sql_select = " select tk_ID,tk_ref from cs_tracking_clicker ";
    if ($data['Clicker_Ref']) {
        $sql .= "{$sql_select} where tk_ref = '" . quote_smart($data['Clicker_Ref']) . "' \n\t\tUNION\n\t\t";
    }
    $sql .= "{$sql_select} where tk_host = '" . quote_smart($data['host_name']) . "'\n\t\tUNION\n\t\t{$sql_select} where tk_IP = INET_ATON( '" . $data['ip_address'] . "' ) ";
    $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
    if (mysql_num_rows($result)) {
        $clicker = mysql_fetch_assoc($result);
        $data['tc_clicker_ID'] = $clicker['tk_ID'];
        $data['Clicker_Ref'] = $clicker['tk_ref'];
        return $clicker['tk_ID'];
    }
    $new_tk_ref = substr(md5(serialize($data)), 0, 32);
    $sql = "INSERT INTO cs_tracking_clicker set \n\t\ttk_IP = INET_ATON( '" . $data['ip_address'] . "' ),\n\t\ttk_host = '" . quote_smart($data['host_name']) . "', \n\t\ttk_ref = '{$new_tk_ref}' \n\t";
    $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
    $data['tc_clicker_ID'] = mysql_insert_id();
    $data['Clicker_Ref'] = $new_tk_ref;
    return $data['tc_clicker_ID'];
}
Пример #24
0
}
if (isset($_FILES['file_article'])) {
    $file_status[] = func_upload_file($cnn_cs, $_FILES['file_article'], $company_id, "Articles");
}
if (isset($_FILES['file_process_history'])) {
    $file_status[] = func_upload_file($cnn_cs, $_FILES['file_process_history'], $company_id, "History");
}
if (isset($_FILES['file_merchant_contract'])) {
    $file_status[] = func_upload_file($cnn_cs, $_FILES['file_merchant_contract'], $company_id, "Contract");
}
if (isset($_FILES['file_professional_reference'])) {
    $file_status[] = func_upload_file($cnn_cs, $_FILES['file_professional_reference'], $company_id, "Professional_Reference");
}
$str_qry = "update cs_companydetails set cd_completion=6 where userId = '{$company_id}'";
if ($curUserInfo['cd_completion'] == 5) {
    sql_query_write($str_qry) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$str_qry}");
    en_status_change_notify($curUserInfo['en_ID']);
}
beginTable();
print "<br><table align=center width='400' cellpadding='0' cellspacing='0'>";
print "<tr bgcolor='#CCCCCC'><td class='cl1'><font class='subhd'>&nbsp;File Name</span></td><td class='cl1'><span class='subhd'>&nbsp;Status</span></td></tr>";
for ($i = 0; $i < count($file_status); $i++) {
    if ($file_status[$i] != "") {
        $file_details = split("@#@", $file_status[$i]);
        print "<tr height='20'><td class='leftbottomright'><font face='verdana' size='1'>&nbsp;{$file_details['0']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$file_details['1']}</font></td></tr>";
    }
}
print "</table>";
endTable("Upload Documents", "viewuploads.php", NULL, 0, 1);
include "includes/footer.php";
function func_upload_file($cnn_cs, $file_object, $company_id, $file_type)
Пример #25
0
            $use_calc[$name] = array();
        }
        foreach ($use_calc as $name => $info) {
            $frm_append = "frm_" . strtolower(str_replace(array(" ", "-"), "_", $name));
            foreach ($_POST as $post_name => $value) {
                if (stristr($post_name, $frm_append) !== FALSE) {
                    $values = str_replace($frm_append . "_", "", $post_name);
                    $values = explode("_", $values);
                    $use_calc[$name]['labels'][$values[1]][$values[0]] = $value;
                }
            }
        }
        $custom_report = quote_smart(serialize(array("dates" => $use_date, "projections" => $use_proj, "calculations" => $use_calc)));
        $report_name = quote_smart($_POST['frm_report_name']);
        $sql = "INSERT INTO cs_risk_report SET rr_report_name = \"{$report_name}\", rr_report_settings=\"{$custom_report}\" ON DUPLICATE KEY UPDATE rr_report_settings=\"{$custom_report}\"";
        $res = sql_query_write($sql) or dieLog(mysql_error() . "error");
    }
}
$report_cust = NULL;
if (isset($_POST['frm_report_name'])) {
    $report_cust = $report->get_custom_report($_POST['frm_report_name']);
} else {
    if (isset($_POST['frm_selected_report'])) {
        $report_cust = $report->get_custom_report($_POST['frm_selected_report']);
    }
}
$report_date = $report->report_date;
$report_proj = $report->report_proj;
$report_calc = $report->report_calc;
/*
$report->array_print($report_date);
Пример #26
0
 function run_cron()
 {
     if ($this->sql_options == NULL) {
         return;
     }
     $sql_queries = $this->create_query();
     foreach ($sql_queries as $company_id => $date_ranges) {
         $this->final_report[$company_id]['rc_results'] = array();
         foreach ($date_ranges as $date_range => $sql_query) {
             $result = sql_query_read($sql_query);
             if (!$result) {
                 echo "<p><b>" . mysql_error() . "</b><br>{$sql_query}</p>";
             } else {
                 if ($row = mysql_fetch_assoc($result)) {
                     $this->final_report[$company_id]['rc_results'] += $row;
                 } else {
                     $this->final_report[$company_id]['rc_results'][$date_range] = 0;
                 }
             }
         }
         $risk_calc = get_merchant_quick_status($company_id);
         $this->final_report[$company_id]['rc_risk_value'] = $risk_calc['percent'];
         $this->final_report[$company_id]['rc_date_time'] = time();
         $this->final_report[$company_id]['rc_results'] = serialize($this->final_report[$company_id]['rc_results']);
         $this->goto_sleep();
     }
     $sql = array();
     foreach ($this->final_report as $company_id => $fields) {
         $values = "rc_company_id = {$company_id}";
         foreach ($fields as $field => $value) {
             $values .= ($values != "" ? ", " : "") . "{$field} = \"" . quote_smart($value) . "\"";
         }
         $sql = "INSERT cs_risk_cron SET {$values} ON DUPLICATE KEY UPDATE {$values}";
         $res = sql_query_write($sql) or dieLog("error" . mysql_error() . "<pre>{$sql}</pre>");
         $this->goto_sleep();
     }
 }
Пример #27
0
 if (!isset($_POST['ticket_status']) || $_POST['ticket_status'] == '') {
     $_POST['ticket_status'] = 'Open';
 }
 $_POST['account'] = Clean_It($_POST['account']);
 $_POST['name'] = Clean_It($_POST['name']);
 $_POST['email'] = Clean_It($_POST['email']);
 $_POST['ticketsubject'] = Clean_It($_POST['ticketsubject']);
 $_POST['category'] = Clean_It($_POST['category']);
 $_POST['urgency'] = Clean_It($_POST['urgency']);
 $_POST['ticket_status'] = Clean_It($_POST['ticket_status']);
 $_POST['message'] = Clean_It($_POST['message']);
 $urgency = explode('|', $_POST['urgency']);
 $category = explode('|', $_POST['category']);
 $tickets_reference = strtoupper(substr(md5(time() . rand(0, 1000)), 0, 16));
 $query = "\tINSERT INTO tickets_tickets\n\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\ttickets_username  = '******'account'] . "',\n\t\t\t\t\t\t\ttickets_subject\t  = '" . $_POST['ticketsubject'] . "',\n\t\t\t\t\t\t\ttickets_timestamp = '" . mktime() . "',\n\t\t\t\t\t\t\ttickets_status    = '" . $_POST['ticket_status'] . "',\n\t\t\t\t\t\t\ttickets_name\t  = '" . $_POST['name'] . "',\n\t\t\t\t\t\t\ttickets_email\t  = '" . $_POST['email'] . "',\n\t\t\t\t\t\t\ttickets_urgency\t  = '" . $urgency['0'] . "',\n\t\t\t\t\t\t\ttickets_category  = '" . $category['0'] . "',\n\t\t\t\t\t\t\ttickets_reference  = '{$tickets_reference}',\n\t\t\t\t\t\t\ttickets_question  = '" . addslashes($_POST['message']) . "'";
 if ($result = sql_query_write($query)) {
     $lastinsertid = mysql_insert_id();
     // CHECK THE FILE ATTACHMENT AND DISPLAY ANY ERRORS
     if ($allowattachments == 'TRUE' && !isset($_COOKIE['demomode']) || $demomode != 'ON') {
         FileUploadsVerification("{$_FILES}(userfile)", mysql_insert_id());
     }
     // EMAIL ADMINISTRATOR THE TICKET NOTIFICATION
     $query = "\tSELECT *\n\t\tFROM tickets_categories WHERE tickets_categories_id = '{$category['0']}'\n\t\tORDER BY tickets_categories_name ASC";
     $result = sql_query_read($query);
     $cat_info = mysql_fetch_assoc($result);
     $socketfrom = "Ticket-" . $tickets_reference . "@" . $socketdomain;
     //if($cat_info['tickets_categories_emailname']) $socketfromname = $cat_info['tickets_categories_emailname'];
     $message = "Ticket ID:\t {$tickets_reference}:" . $_GET['ticketid'] . "\n";
     $message .= "Name:\t\t " . $_POST['name'] . "\n";
     $message .= "Email:\t " . $_POST['email'] . "\n";
     $message .= "Subject:\t " . $_POST['ticketsubject'] . "\n";
Пример #28
0
function func_upload_file($cnn_cs, $file_object, $company_id, $file_type)
{
    $return_status = "Success";
    $b_file_exists = false;
    $str_current_date_time = func_get_current_date_time();
    extract($file_object, EXTR_PREFIX_ALL, 'uf2');
    if ($uf2_name != "") {
        $svr = $_SERVER["PATH_TRANSLATED"];
        $path_parts = pathinfo($svr);
        $str_current_path = $path_parts["dirname"];
        $str_file_name = $uf2_name;
        $str_current_path = "";
        $str_file_name = str_replace(" ", "", $str_file_name);
        $str_current_path .= "../gateway/" . $_SESSION['gw_folder'] . "UserDocuments/{$file_type}/" . $company_id . "_" . $str_file_name;
        //print ("path=$str_current_path");
        if (filesize($uf2_tmp_name) != 0) {
            if (file_exists($str_current_path)) {
                $b_file_exists = true;
            }
            if (copy($uf2_tmp_name, $str_current_path)) {
                if (!$b_file_exists) {
                    $str_query = "insert into cs_uploaded_documents(user_id, file_type, file_name, date_uploaded, status) values({$company_id}, '{$file_type}', '" . $company_id . "_" . $str_file_name . "', '{$str_current_date_time}', 'P')";
                    if (!sql_query_write($str_query, $cnn_cs)) {
                        dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$str_query}");
                    }
                }
            } else {
                $return_status = "Upload failed, please try again";
            }
        } else {
            $return_status = "Invalid file, please upload a valid file";
        }
    }
    return $return_status;
}
Пример #29
0
            $qry_update_user .= "url1='{$url1}', cd_processing_reason='{$cd_processing_reason}',cd_previous_processor='{$cd_previous_processor}', preprocess = '{$prepro}', recurbilling = '{$rebill}', currprocessing = '{$currpro}', ";
            $qry_update_user .= "auto_cancel='{$strAutoCancel}',time_frame={$iTimeFrame},auto_approve='{$strAutoApprove}',transaction_type='{$transaction_type}',shipping_cancel='{$strShippingCancel}',shipping_timeframe={$iShippingTimeFrame},";
            $qry_update_user .= "setupfees={$setupFees},";
            $qry_update_user .= "legal_name = '{$legal_companyname}', incorporated_country = '{$inc_country}', incorporated_number = '{$inc_number}', fax_dba = '{$fax_dba}', physical_address = '{$physical_address}', ";
            $qry_update_user .= "cellular = '{$cellular}', technical_contact_details = '{$tech_contact_details}', admin_contact_details = '{$admin_contact_details}', max_ticket_amt = '{$max_ticket_amt}', min_ticket_amt = '{$min_ticket_amt}', ";
            $qry_update_user .= "goods_list = '{$goods_list}', volume_last_month = '{$volume_last_month}', volume_prev_30days = '{$volume_prev_30days}', volume_prev_60days = '{$volume_prev_60days}', totals = '{$totals}', ";
            $qry_update_user .= "forecast_volume_1month = '{$forecast_first_month}', forecast_volume_2month = '{$forecast_second_month}', forecast_volume_3month = '{$forecast_third_month}', ";
            $qry_update_user .= "current_anti_fraud_system = '{$current_anti_fraud_system}', customer_service_program = '{$customer_service_program}', refund_policy = '{$refund_policy}', ";
            $qry_update_user .= " email = '{$email}'";
            $qry_update_user .= "  where userId='{$userid}' {$bank_sql_limit}";
            //print($qry_update_user);
            //if ($adminInfo['li_level'] == 'full' || $resellerInfo['isMasterMerchant'])
            sql_query_write($qry_update_user) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$qry_update_user}");
            $cd_notes = isset($HTTP_POST_VARS['cd_notes']) ? "'" . quote_smart($HTTP_POST_VARS['cd_notes']) . "'" : "NULL";
            if ($cd_notes) {
                sql_query_write("update cs_companydetails set cd_notes = {$cd_notes} where userId='{$userid}'") or dieLog(mysql_errno() . ": " . mysql_error());
            }
        }
    }
}
$company_id = isset($HTTP_GET_VARS['company_id']) ? $HTTP_GET_VARS['company_id'] : "";
if ($company_id == "") {
    $company_id = isset($HTTP_POST_VARS['userid']) ? quote_smart($HTTP_POST_VARS['userid']) : "";
}
if ($company_id == "") {
    $company_id = isset($_REQUEST['userIdList']) ? quote_smart($_REQUEST['userIdList']) : "";
}
if ($company_id == "") {
    $company_id = isset($HTTP_GET_VARS['companyname']) ? quote_smart($HTTP_GET_VARS['companyname']) : "";
}
$companyname = isset($HTTP_GET_VARS['companyname']) ? $HTTP_GET_VARS['companyname'] : "";
Пример #30
0
function etel_update_serialized_field($table, $field, $sql_conditions, $update)
{
    if (!$table || !$sql_conditions || !$field) {
        return false;
    }
    if (!is_array($update)) {
        return false;
    }
    $sql = "select {$field} from {$table} where {$sql_conditions}";
    $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}");
    if (!mysql_num_rows($result)) {
        return false;
    }
    $info_ser = mysql_result($result, 0, 0);
    $info = @unserialize($info_ser);
    etel_add_array($info, $update);
    $new_ser = serialize($info);
    if ($info_ser == $new_ser) {
        return $info;
    }
    $sql = "update {$table} set {$field} = '" . quote_smart($new_ser) . "' where {$sql_conditions}";
    if (is_array($info)) {
        sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}");
    } else {
        return false;
    }
    return $info;
}