function sites_getSiteInfo($site_id) { $site_id = quote_smart($site_id); $sql = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tcs_company_sites\n\t\tWHERE\n\t\t\tcs_id = '{$site_id}';\n\t"; $res = sql_query_read($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); return mysql_fetch_assoc($res); }
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"); }
function tickets_getGatewayID($ticketid) { $ticketid = mysql_real_escape_string($ticketid); $qry = "\n\t\t\t\tSELECT user.cs_gateway_id\n\t\t\t\tFROM\n\t\t\t\t\ttickets_tickets AS tick,\n\t\t\t\t\ttickets_users AS user\n\t\t\t\tWHERE\n\t\t\t\t\ttick.tickets_username = user.tickets_users_username\n\t\t\t\t\tAND tick.tickets_id = '{$ticketid}'\n\t\t\t\t"; $res = sql_query_read($qry); $row = mysql_fetch_assoc($res); return $row['cs_gateway_id']; }
function ch_check_previous_decline($transInfo, $hours = 24) { return 0; $sql = "\n\t\tSELECT \n\t\t\t*\n\t\tFROM \n\t\t\t`cs_transactiondetails`\n\t\tWHERE \n\t\t\t`bankaccountnumber` = '" . etelEnc($transInfo['bankaccountnumber']) . "' \n\t\t\tAND transactionDate > DATE_SUB(Now(),Interval {$hours} HOUR)\n\t\t\tAND (`status` != 'A' or `cancelstatus` = 'Y' or `td_is_chargeback`=1) \n\t\t\tAND (`td_bank_recieved` = 'yes' or `td_bank_recieved` = 'fraudscrubbing')\n\t\t"; $result = sql_query_read($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<pre>{$sql}</pre>"); $numrows = mysql_num_rows($result); return $numrows > 0; }
function get_entity_id_by_name($type, $name) { $type = quote_smart($type); $name = quote_smart($name); $sql = "\n\t\t\tSELECT\n\t\t\t\tet_ID\n\t\t\tFROM\n\t\t\t\tcs_entities\n\t\t\tWHERE\n\t\t\t\tet_type = '{$type}'\n\t\t\t\tAND et_username = '******'\n\t\t"; $res = sql_query_read($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); $r = mysql_fetch_assoc($res); return $r['et_ID']; }
function subscription_get_notes($sub_id) { $sql = "\r\n\t\tSELECT\r\n\t\t\tss_account_notes\r\n\t\tFROM\r\n\t\t\tcs_subscription\r\n\t\tWHERE\r\n\t\t\tss_subscription_id = '{$sub_id}' \r\n\t"; $res = sql_query_read($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<pre>{$sql}</pre>"); $r = mysql_fetch_assoc($res); $notes = array(); if ($r['ss_account_notes'] != "") { $notes = unserialize($r['ss_account_notes']); } return $notes; }
function bank_ChooseSupported($bk_trans_types, $en_ID, $suggested_bank = NULL) { $sql = "SELECT * FROM cs_bank as bk left join cs_company_banks as cb on cb.bank_id = bk.bank_id \n\t\t\tWhere cb.cb_en_ID = '{$en_ID}' and bk.bk_trans_types = '{$bk_trans_types}'\n\t;"; $bank_details = sql_query_read($sql) or dieLog(mysql_error() . "<p>{$sql}</p>"); $list = array(); while ($r = mysql_fetch_assoc($bank_details)) { if ($r['bank_id']) { $chosen_bank = $r['bank_id']; } $list['banks'][$r['bank_id']] = $r; } if ($list['banks'][$suggested_bank]) { $chosen_bank = $suggested_bank; } $list['chosen'] = $chosen_bank; return $list; }
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"); }
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']; }
function smart_issueRefund($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') { require_once '../includes/int.refund.php'; $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); $sql = "Select * from `cs_transactiondetails` where transactionId = '" . $callNoteInfo['transaction_id'] . "'"; $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}"); $transInfo = mysql_fetch_assoc($result); $response = execute_refund($transInfo, $callNoteInfo['service_notes'] . ": " . $callNoteInfo['customer_notes']); $error_msg = "success"; if ($response['success'] == false) { $error_msg = "ERROR: Refund Not successful ~ " . $response['errormsg']; } return array("action" => "Transaction ID " . $transInfo['reference_number'] . " refund attempted:", "status" => "{$error_msg}"); } return array("action" => "Transaction ID " . $transInfo['reference_number'] . " refund attempted:", "status" => "failed. insufficient privilages."); }
function get_BillingInfo($wallet_id, $wallet_pass, &$transInfo) { $pass = $this->encrypt_password($pass); if ($this->mode == "Live") { $tran_table = "cs_transactiondetails"; } else { $tran_table = "cs_test_transactiondetails"; } $sql = "\n\t\t\tSELECT\n\t\t\t\tname,\n\t\t\t\tsurname,\n\t\t\t\taddress,\n\t\t\t\tcity,\n\t\t\t\tphonenumber,\n\t\t\t\tstate,\n\t\t\t\tzipcode,\n\t\t\t\tcountry,\n\t\t\t\temail,\n\t\t\t\tMAX(transactiondate)\n\t\t\tFROM\n\t\t\t\t{$tran_table}\n\t\t\tWHERE\n\t\t\t\tLOWER(td_gcard) = LOWER('{$wallet_id}')\n\t\t\t\tAND\tLOWER(td_gcardpass) = LOWER('{$wallet_pass}')\n\t\t\tGROUP BY td_gcard,td_gcardpass\n\t\t"; $res = sql_query_read($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); if ($prev_trans = mysql_fetch_assoc($res)) { $transInfo['firstname'] = $prev_trans['name']; $transInfo['lastname'] = $prev_trans['surname']; $transInfo['address'] = $prev_trans['address']; $transInfo['city'] = $prev_trans['city']; $transInfo['phonenumber'] = $prev_trans['phonenumber']; $transInfo['state'] = $prev_trans['state']; $transInfo['zipcode'] = $prev_trans['zipcode']; $transInfo['country'] = $prev_trans['country']; $transInfo['email'] = $prev_trans['email']; $transInfo['td_gcard'] = $wallet_id; $transInfo['td_gcardpass'] = $wallet_pass; } }
function getTransactionInfo($id, $test = false, $by = 'transactionId', $where_sql = "") { global $cnn_cs; $trans_table_name = "cs_transactiondetails"; if ($test) { $trans_table_name = "cs_test_transactiondetails"; } $sql = "\n\t\t\tSELECT \n\t\t\t\tt.*, DATE_FORMAT(t.transactionDate,'%M %D %Y at %r') as transaction_date_formatted,\n\t\t\t\tsub.*,\n\t\t\t\t\tc.contact_email,\n\t\t\t\t\tc.customer_service_phone,\n\t\t\t\t\tc.cc_billingdescriptor,\n\t\t\t\t\tc.ch_billingdescriptor,\n\t\t\t\t\tc.cc_visa_billingdescriptor,\n\t\t\t\t\tc.cc_master_billingdescriptor,\n\t\t\t\t\tc.we_billingdescriptor, \n\t\t\t\t\tc.cd_recieve_order_confirmations,\n\t\t\t\t\tc.we_billingdescriptor,\n\t\t\t\t\tc.companyname, \n\t\t\t\t\tc.cd_tracking_init_response, \n\t\t\t\t\tc.cd_enable_tracking, \n\t\t\t\t\tc.gateway_id, \n\t\t\t\t\tc.bank_Creditcard,\n\t\t\t\t\ts.*, \n\t\t\t\t\t(r.note_id is not null) as hasRefundRequest,\n\t\t\t\t\t r.call_date_time, \n\t\t\t\t\t r.service_notes \n\t\t\tFROM \n\t\t\t\t{$trans_table_name} as t\n\t\t\tLEFT JOIN `cs_subscription` as sub ON sub.`ss_ID` = t.`td_ss_ID`\n\t\t\tLEFT JOIN `cs_companydetails` as c ON c.`userId` = t.`userId`\n\t\t\tLEFT JOIN `cs_company_sites` as s ON `cs_ID` = `td_site_ID`\n\t\t\tleft join cs_callnotes as r on r.`transaction_id`=t.`transactionId` AND r.cn_type = 'refundrequest' \n\t\t\tWHERE \n\t\t\t\t`{$by}` = '{$id}' \n\t\t\t\t{$where_sql}\n\t\t\t\t"; $result = sql_query_read($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$sql}<BR>"); if (mysql_num_rows($result) <= 0) { return -1; } $transactionInfo = mysql_fetch_assoc($result); $transactionInfo['CCnumber'] = etelDec($transactionInfo['CCnumber']); $transactionInfo['bankaccountnumber'] = etelDec($transactionInfo['bankaccountnumber']); $transactionInfo['bankaccountnumber'] = "XXXXXX" . substr($transactionInfo['bankaccountnumber'], -4, 4); $transactionInfo['CCnumber_format'] = "XXXXXXXXXXXX" . substr($transactionInfo['CCnumber'], -4, 4); $time = strtotime($transactionInfo['transactionDate']); $subAcc = getRebillInfo($transactionInfo['td_rebillingID'], $time, false); $transactionInfo['userActiveCode'] = UserActivity(&$transactionInfo); $transactionInfo['userRebillCode'] = UserRebill(&$transactionInfo); //Shipping if ($transactionInfo['cd_enable_tracking'] == 'on') { $transactionInfo['Tracking_Deadline'] = $time + $transactionInfo['cd_tracking_init_response'] * 24 * 60 * 60; $transactionInfo['Tracking_Days_Left'] = floor(($transactionInfo['Tracking_Deadline'] - time()) / (24 * 60 * 60)); } if ($transactionInfo['userActiveCode'] == "ACT") { $transactionInfo['userActiveMsg'] = "Account is Active, "; } else { if ($transactionInfo['userActiveCode'] == "INA") { $transactionInfo['userActiveMsg'] = "Account is Inactive, "; } else { if ($transactionInfo['userActiveCode'] == "CAN") { $transactionInfo['userActiveMsg'] = "Account is Cancelled, "; } else { if ($transactionInfo['userActiveCode'] == "CHB") { $transactionInfo['userActiveMsg'] = "Account has been Charged Back, "; } } } } if ($transactionInfo['userRebillCode'] == "ACT") { $transactionInfo['userActiveMsg'] .= "Rebilling is Active."; } else { if ($transactionInfo['userRebillCode'] == "INA") { $transactionInfo['userActiveMsg'] .= "Rebilling is Inactive."; } } if ($transactionInfo['checkorcard'] == 'H') { $transactionInfo['charge_type_info'] = "Credit Card (" . $transactionInfo['cardtype'] . ")"; if ($transactionInfo['cardtype'] == "Visa") { $transactionInfo['billingdescriptor'] = $transactionInfo['cc_visa_billingdescriptor']; } if ($transactionInfo['cardtype'] == "Master") { $transactionInfo['billingdescriptor'] = $transactionInfo['cc_master_billingdescriptor']; } } if ($transactionInfo['checkorcard'] == 'C') { $transactionInfo['charge_type_info'] = "Check Account"; $transactionInfo['billingdescriptor'] = $transactionInfo['ch_billingdescriptor']; } if ($transactionInfo['checkorcard'] == 'W') { $transactionInfo['charge_type_info'] = "Web900 "; $transactionInfo['billingdescriptor'] = $transactionInfo['we_billingdescriptor']; } // Next Payment $transactionInfo['subAccountName'] = $subAcc['rd_subName']; $transactionInfo['chargeAmount'] = $subAcc['chargeAmount']; $transactionInfo['schedule'] = $subAcc['schedule']; $transactionInfo['nextDateInfo'] = $subAcc['nextDateInfo']; $transactionInfo['nextRecurDate'] = $subAcc['nextRecurDate']; if ($transactionInfo['nextRecurDate'] == -1) { $transactionInfo['nextRecurDate'] = "N/A"; } if ($transactionInfo['td_enable_rebill'] == 0) { $transactionInfo['nextRecurDate'] = "No/Canceled Subscription"; } $transactionInfo['td_recur_next_date_next'] = $subAcc['td_recur_next_date']; $transactionInfo['subAcc'] = $subAcc; $recurDate = $subAcc['nextRecurDate']; $transactionInfo['expires'] = 'N/A'; $transactionInfo['expired'] = 'N/A'; if ($transactionInfo['ss_account_status'] == 'inactive') { $transactionInfo['expired'] = "Expired on " . date("F j, Y", strtotime($transactionInfo['ss_account_expire_date'])); } else { if ($transactionInfo['ss_account_status'] == 'active') { $transactionInfo['expires'] = date("F j, Y", strtotime($transactionInfo['ss_account_expire_date'])); } } //Formatting $transactionInfo['phonenumber_format'] = formatPhone($transactionInfo['phonenumber']); $transactionInfo['fullname'] = $transactionInfo['name'] . " " . $transactionInfo['surname']; return $transactionInfo; }
function findTicketThread($emailInfo, $tickets_users_username) { $tickets_reference = substr($emailInfo['ToEmail'], strlen("Ticket-"), 16); $tickets_subject = str_replace("Re: ", "", $emailInfo['Subject']); $sql = "\r\n\t\tSELECT tickets_id, tickets_reference FROM `tickets_tickets` as tt \r\n\t\tleft join `tickets_users` as tu on tt.tickets_username = tu.tickets_users_username \r\n\t\twhere tickets_users_username = '******' and (\r\n\t\t\ttickets_reference = '{$tickets_reference}' or\r\n\t\t\ttickets_subject = '{$tickets_subject}'\r\n\t\t\t) and tickets_reference is not null\r\n\t\t"; $result = sql_query_read($sql) or dieLog(mysql_error()); $ticket = NULL; if (mysql_num_rows($result)) { $ticket = mysql_fetch_assoc($result); } return $ticket; }
$stats_list[4]['to'] = $_REQUEST['opt_to_year'] . "-" . $_REQUEST['opt_to_month'] . "-" . $_REQUEST['opt_to_day'] . " 23:59:59"; $stats_list[4]['title'] = $stats_list[4]['from'] . " to " . $stats_list[4]['to']; if ($_REQUEST['opt_from_full']) { $stats_list[4]['from'] = $_REQUEST['opt_from_full']; } if ($_REQUEST['opt_to_full']) { $stats_list[4]['to'] = $_REQUEST['opt_to_full']; } $compSQL = ""; $compID = $sessionlogin; if (!$compID) { $compID = -1; } $compSQL = "AND `userId` = '{$compID}' "; $qry_details = "SELECT * FROM `cs_companydetails` WHERE `userId` = '{$compID}'"; $rst_details = sql_query_read($qry_details) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>Cannot execute query"); $companyInfo = mysql_fetch_assoc($rst_details); $forcomp = ""; if ($companyInfo['companyname']) { $forcomp = " for " . $companyInfo['companyname']; } beginTable(); ?> <form action="" method="POST" name="FrmMerchant" > <?php foreach ($_REQUEST as $name => $value) { echo "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\">"; }
<?php $query = "\tSELECT tickets_categories_id, tickets_categories_name\n\t\t\t\t\t\tFROM tickets_categories\n\t\t\t\t\t\tORDER BY tickets_categories_name ASC"; $result = sql_query_read($query); while ($row = mysql_fetch_array($result)) { echo '<option value="' . $row['tickets_categories_id'] . '|' . $row['tickets_categories_name'] . '">' . $row['tickets_categories_name'] . '</option>'; } ?> </select> </td> </tr> <tr> <td bgcolor="#EEEEEE" class="boxborder text"><b>Urgency:</b></td> <td class="boxborder text"><select name="urgency"> <?php $query = "\tSELECT tickets_status_id, tickets_status_name, tickets_status_color\n\t\t\t\t\t\tFROM tickets_status\n\t\t\t\t\t\tORDER BY tickets_status_order ASC"; $result = sql_query_read($query); while ($row = mysql_fetch_array($result)) { echo '<option style="background-color:#' . $row['tickets_status_color'] . '" value="' . $row['tickets_status_id'] . '|' . $row['tickets_status_name'] . '">' . $row['tickets_status_name'] . '</option>'; } ?> </select></td> </tr> <tr> <td bgcolor="#EEEEEE" class="boxborder text"><b>Pre-Close:</b></td> <td class="boxborder text"><input type="checkbox" name="ticket_status" value="Closed" /></td> </tr> </table> <div style="padding-top:5px"></div> <table width="97%" cellspacing="1" cellpadding="1" class="boxborder" align="center"> <tr bgcolor="#AABBDD"> <td class="boxborder text"><b>Question</b></td>
?> > </td> </tr> <tr> <td align="left" valign="center" height="30" class='cl1'><strong><font face="verdana" size="1"> Currently Processing </font></strong></td> <td align="left" height="30" class='cl1'> <input name="currpro" type="checkbox" value="Yes" <?php echo $companyInfo['currprocessing'] == "Yes" ? "checked" : ""; ?> > </td> </tr> <!-- Bank details integrating starts --> <?php $qrySelect = "select * from cs_bank_company where company_id = '{$company_id}' {$bank_sql_limit}"; $rstSelect = sql_query_read($qrySelect, 1); $iCheckBankId = ""; $iCreditBankId = ""; if (mysql_num_rows($rstSelect) > 0) { $iCheckBankId = mysql_result($rstSelect, 0, 2); $iCreditBankId = mysql_result($rstSelect, 0, 3); } ?> </table> </td></tr></table> <center> <table align="center"> <tr><td align="center" valign="center" height="30" colspan="2" ><a href="viewCompany.php"><img SRC="<?php echo $tmpl_dir; ?> /images/back.jpg" border="0"></a> <input type="image" id="modifycompany" SRC="<?php
function get_rebills_to_run() { $sql_where = $this->get_sql_where(); $sql_limit = $this->get_sql_limit(); if ($this->sort_by) { $sql_order = "ORDER BY {$this->sort_by}"; } $sql = "\t\n\t\t\t\tSELECT \n\t\t\t\t\tCOUNT(ss_id) as rebill_count,\n\t\t\t\t\tSUM(sub.ss_rebill_amount) as rebill_amount\n\t\t\t\tFROM\n\t\t\t\t\tcs_subscription AS sub\n\t\t\t\tleft join cs_companydetails as cd on userId = ss_user_ID\n\t\t\t\tleft join cs_company_sites as cs on cs_ID = ss_site_ID\n\t\t\t\tLEFT JOIN cs_rebillingdetails AS r ON r.rd_subaccount = sub.ss_rebill_id\n\t\t\t\tWHERE\n\t\t\t\t\tsub.ss_rebill_next_date <= NOW()\n\t\t\t\t\tAND\tsub.ss_rebill_status = 'active'\n\t\t\t\t\tAND\tsub.ss_rebill_attempts < 3\n\t\t\t\t\tAND activeuser = '******'\n\t\t\t\t\tAND cs_verified in ('approved','non-compliant')\n\t\t\t\t\t{$sql_where}\n\t\t\t\t"; $res = sql_query_read($sql) or dieLog("error " . mysql_error() . "<pre>{$sql}</pre>"); $this->rebill_summary = mysql_fetch_assoc($res); $sql = "\t\n\t\t\t\tSELECT \n\t\t\t\t\tss_id,\n\t\t\t\t\tss_rebill_status,\n\t\t\t\t\tss_rebill_attempts,\n\t\t\t\t\t\n\t\t\t\t\tsub.ss_billing_firstname,\n\t\t\t\t\tsub.ss_billing_lastname,\n\t\t\t\t\t\n\t\t\t\t\tsub.ss_bank_id,\n\t\t\t\t\tsub.ss_transaction_id,\n\t\t\t\t\tsub.ss_subscription_id,\n\t\n\t\t\t\t\tsub.ss_rebill_amount,\n\t\t\t\t\tsub.ss_rebill_next_date,\n\t\t\t\t\tUNIX_TIMESTAMP(sub.ss_rebill_next_date) AS next_rebill_timestamp,\n\t\n\t\t\t\t\tsub.ss_account_status,\n\t\t\t\t\tsub.ss_rebill_status,\n\t\t\t\t\t\n\t\t\t\t\tb.bk_int_function,\n\t\t\t\t\tt.CCnumber,\n\t\t\t\t\tt.cvv,\n\t\t\t\t\tt.bankaccountnumber,\n\t\t\t\t\tt.bankroutingcode,\n\t\t\t\t\tt.validupto,\n\t\t\t\t\tt.td_username,\n\t\t\t\t\t\n\t\t\t\t\t(UNIX_TIMESTAMP(sub.ss_account_expire_date) - UNIX_TIMESTAMP(sub.ss_account_start_date)) as duration\n\t\t\t\tFROM\n\t\t\t\t\tcs_subscription AS sub\n\t\t\t\tLEFT JOIN cs_companydetails as cd on cd.userId = ss_user_ID\n\t\t\t\tLEFT JOIN cs_company_sites as cs on cs_ID = ss_site_ID\n\t\t\t\tLEFT JOIN cs_rebillingdetails AS r ON r.rd_subaccount = sub.ss_rebill_id\n\t\t\t\tLEFT JOIN cs_bank AS b ON b.bank_id = sub.ss_bank_id\n\t\t\t\tLEFT JOIN cs_transactiondetails AS t ON t.transactionId = sub.ss_transaction_id\n\t\t\t\tWHERE\n\t\t\t\t\tsub.ss_rebill_next_date <= NOW()\n\t\t\t\t\tAND\tsub.ss_rebill_status = 'active'\n\t\t\t\t\tAND\tsub.ss_rebill_attempts < 3\n\t\t\t\t\tAND activeuser = '******'\n\t\t\t\t\tAND cs_verified in ('approved','non-compliant')\n\t\t\t\t\t{$sql_where}\n\t\t\t\t{$sql_order}\n\t\t\t\t{$sql_limit}\n\t\t\t\t"; $res = sql_query_read($sql) or dieLog("error " . mysql_error() . "<pre>{$sql}</pre>"); $this->transactions = array(); while ($row = mysql_fetch_assoc($res)) { $this->transactions[] = $row; } }
function get_bank_custom_fields($bank_id, $custom = NULL) { global $en_ID; switch (intval($bank_id)) { case 33: case 32: $sql = "select cs_ID,cs_name from cs_company_sites where cs_en_ID = '{$en_ID}' and cs_verified in ('approved','non-compliant')"; $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}"); $fields['labels']['tid'] = "Website TID"; //$fields['labels']['mid'] = "Website MID"; $fields['labels']['desc'] = "Website Descriptor"; while ($site = mysql_fetch_assoc($result)) { $key = "tid_" . $bank_id . "_" . $site['cs_ID']; if ($_POST[$key]) { $custom['tid_sites'][$site['cs_ID']] = $_POST[$key]; } $fields['array'][$site['cs_ID']]['label'] = $site['cs_name'] . ":"; $fields['array'][$site['cs_ID']]['group'][$key]['value'] = $custom['tid_sites'][$site['cs_ID']]; //$key = "mid_".$bank_id."_".$site['cs_ID']; //if($_POST[$key]) // $custom['mid_sites'][$site['cs_ID']] = $_POST[$key]; //$fields['array'][$site['cs_ID']]['group'][$key]['value'] = $custom['mid_sites'][$site['cs_ID']]; $key = "desc_" . $bank_id . "_" . $site['cs_ID']; if ($_POST[$key]) { $custom['desc_sites'][$site['cs_ID']] = $_POST[$key]; } $fields['array'][$site['cs_ID']]['group'][$key]['value'] = $custom['desc_sites'][$site['cs_ID']]; } break; } return array('data' => $custom, 'fields' => $fields); }
function transaction_get_id_from_ref_num($ref_num) { $sql = "\n\t\tselect \n\t\t\ttransactionId \n\t\tfrom \n\t\t\t`cs_transactiondetails` \n\t\twhere \n\t\t\treference_number = '{$ref_num}' \n\t\t"; $result = sql_query_read($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); return mysql_result($result, 0, 0); }
function check_unique($table, &$transInfo) { $check = "`CCnumber` = '" . etelEnc($transInfo['CCnumber']) . "'"; if ($transInfo['checkorcard'] == 'C') { $check = "(`bankroutingcode` = '" . etelEnc($transInfo['bankroutingcode']) . "' and `bankaccountnumber` = '" . etelEnc($transInfo['bankaccountnumber']) . "')"; } $sql = "\r\n\t\tSELECT \r\n\t\t\tleast(\r\n\t\t\t\t(\r\n\t\t\t\t\tSELECT min(transactionId)\r\n\t\t\t\t\t\tFROM `{$table}`\r\n\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t{$check}\r\n\t\t\t\t) , \r\n\t\t\t\t(\r\n\t\t\t\t\r\n\t\t\t\t\tSELECT min(transactionId)\r\n\t\t\t\t\t\tFROM `cs_transactiondetails`\r\n\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t`ipaddress` = '" . $transInfo['ipaddress'] . "'\r\n\t\t\t\t) \r\n\t\t\t) AS num \r\n\t\t"; $result = sql_query_read($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<pre>{$sql}</pre>"); $trans = mysql_result($result, 0, 0); if ($trans == $transInfo['transactionId']) { $trans = 0; } return $trans; }
function get_custom_report($report_name = "") { if ($report_name != "") { $sql = "SELECT * FROM cs_risk_report WHERE LOWER(rr_report_name) = LOWER('{$report_name}');"; $res = sql_query_read($sql) or dieLog(mysql_error()); $r = mysql_fetch_assoc($res); return array("name" => $r['rr_report_name'], "settings" => unserialize(stripslashes($r['rr_report_settings']))); } return NULL; }
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; }
function func_get_cardcurrency($cardtype, $company_id, $connetion) { $currency = ""; $str_field = ""; if ($cardtype == 'Master') { $str_field = 'processingcurrency_master'; } elseif ($cardtype == 'Visa') { $str_field = 'processingcurrency_visa'; } else { return "USD*"; } $qry_currecy = "select {$str_field} from cs_companydetails_ext where userId ='{$company_id}'"; if (!($rst_currency = sql_query_read($qry_currecy, $connetion))) { print "Cannot execute select query"; } else { $rst_processcurrency = mysql_fetch_array($rst_currency); $currency = $rst_processcurrency[0]; if ($currency == "") { if ($cardtype == 'Master') { $currency = 'EURO'; } else { $currency = 'USD'; } } else { if ($currency == "EUR") { $currency = "EURO"; } } } if ($currency == "EUR") { $currency = "EURO"; } //exit(); return $currency; }
function get_entity_ledger($entity_id, $date_from, $date_to, $start = 0, $limit = 100) { if ($start == "") { $start = 0; } $sql = "\n\t\t\tSELECT \n\t\t\t\tCOUNT(*) AS count,\n\t\t\t\tSUM((pt_amount < 0) * pt_amount) AS debit,\n\t\t\t\tSUM((pt_amount > 0) * pt_amount) AS credit\n\t\t\tFROM\n\t\t\t\tcs_profit\n\t\t\tWHERE\n\t\t\t\tpt_entity_ID = '{$entity_id}'\n\t\t\t\tAND pt_date_entered BETWEEN {$date_from} AND {$date_to}\n\t\t"; $res = sql_query_read($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); $summary = mysql_fetch_assoc($res); $sql = "\n\t\t\tSELECT \n\t\t\t\tpt_type,\n\t\t\t\tCOUNT(*) AS count,\n\t\t\t\tSUM((pt_amount < 0) * pt_amount) AS debit,\n\t\t\t\tSUM((pt_amount > 0) * pt_amount) AS credit\n\t\t\tFROM\n\t\t\t\tcs_profit\n\t\t\tWHERE\n\t\t\t\tpt_entity_ID = '{$entity_id}'\n\t\t\t\tAND pt_date_entered BETWEEN {$date_from} AND {$date_to}\n\t\t\tGROUP BY \n\t\t\t\tpt_type\n\t\t"; $res = sql_query_read($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); $summary_details = array(); while ($r = mysql_fetch_assoc($res)) { $summary_details[$r['pt_type']] = $r; } $sql = "\n\t\t\tSELECT \n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tcs_profit\n\t\t\tWHERE\n\t\t\t\tpt_entity_ID = '{$entity_id}'\n\t\t\t\tAND pt_date_entered BETWEEN {$date_from} AND {$date_to}\n\t\t\tORDER BY\n\t\t\t\tpt_date_entered DESC\n\t\t\tLIMIT\n\t\t\t\t{$start},{$limit}\n\t\t"; $res = sql_query_read($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); $ledger = array(); while ($r = mysql_fetch_assoc($res)) { $ledger[] = $r; } return array("summary" => $summary, "summary_details" => $summary_details, "ledger" => $ledger); }
$report_proj = $report->report_proj; $report_calc = $report->report_calc; /* $report->array_print($report_date); $report->array_print($report_proj); $report->array_print($report_calc); */ $frm_report_name = isset($report_cust['name']) ? $report_cust['name'] : ""; $frm_selected_report = $_POST['frm_selected_report']; beginTable(); ?> <select name='frm_selected_report'> <option value="">New Custom Report</option> <?php $sql = "SELECT rr_report_name FROM cs_risk_report ORDER BY LOWER(rr_report_name)"; $res = sql_query_read($sql) or dieLog(mysql_error()); while ($r = mysql_fetch_assoc($res)) { $selected = strcasecmp($r['rr_report_name'], $frm_selected_report) == 0 ? "selected" : ""; echo "<option {$selected} value='" . $r['rr_report_name'] . "'>" . $r['rr_report_name'] . "</option>"; } ?> </select> <input type="submit" value="Open"/> <?php endTable("Select Custom Report", "risk_custom.php", NULL, NULL, FALSE); beginTable(); echo "<b>Report Name: </b><input name='frm_report_name' type='text' size=30/ value='{$frm_report_name}'><br>"; ?> <script> <!-- Original: CodeLifter.com (support@codelifter.com) --> <!-- Web Site: http://www.codelifter.com -->
// labels.php,printemailforms.php,maileditor.php,shipping.php,shippingdetails.php,logout.php // AddCompanyUser.php: This admin page functions for adding the company user. include "includes/sessioncheck.php"; $headerInclude = "transactions"; include "includes/header.php"; $sessionlogintype = isset($HTTP_SESSION_VARS["sessionlogin_type"]) ? $HTTP_SESSION_VARS["sessionlogin_type"] : ""; $sessioncompanyid = isset($HTTP_SESSION_VARS["sessionlogin"]) ? $HTTP_SESSION_VARS["sessionlogin"] : ""; $identity = " `cs_company_id` = " . $companyInfo['userId']; $cs_ID = intval($_GET['cs_ID']); if ($_GET['mode'] != 'edit') { $_GET['mode'] = "new"; } $tableHeader = "Please add a Website"; if ($_GET['mode'] == 'edit') { $sql = "SELECT * FROM `cs_company_sites` WHERE {$identity} AND `cs_ID` = '{$cs_ID}' "; $result = sql_query_read($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$sql}"); if (mysql_num_rows($result) != 1) { dieLog("Site Not Found ~ {$sql}", "Site was not found. Please contact administrator."); } $url = mysql_fetch_assoc($result); $str_websiteurl = $url['cs_URL']; $cs_title = $url['cs_title']; $cs_order_page = $url['cs_order_page']; $cs_return_page = $url['cs_return_page']; $cs_2257_page = $url['cs_2257_page']; $str_creditcards = $url['cs_creditcards']; $str_echeck = $url['cs_echeck']; $str_web900 = $url['cs_web900']; $cs_member_url = $url['cs_member_url']; $cs_order_page = $url['cs_order_page']; $cs_return_page = $url['cs_return_page'];
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 { ?> <script language="javascript"> function removeQuery(name) { return confirm("Are you sure you want to delete Site '"+name+"'?"); } </script> <?php
$CurrentData = $cs_watchlist[$wl_ID]; } if ($_REQUEST['submit'] == 'Add Watch') { $CurrentData = array('banInfo' => ''); } if ($CurrentData) { beginTable(); ?> <table class="report" width="500px"><?php ?> <tr> <td colspan="3">Showing Last 30 Days of Transactions Decline Messages (+Frequency) <br /> <select size="10" style="width:500px;" onchange="$('wl_type').value = 'td_process_msg'; $('wl_data').value = this.value;"> <optgroup label='Monitored Decline Messages'> <?php $result = sql_query_read($transSql) or dieLog(mysql_error() . " ~ {$transSql}"); $used = 1; while ($transInfo = mysql_fetch_assoc($result)) { $transInfo['val'] = preg_replace('/[^a-zA-Z0-9]+/', '%', $transInfo['src']); $transInfo['disp'] = preg_replace('/[^a-zA-Z0-9]+/', ' ', $transInfo['src']); if ($used != $transInfo['used']) { $used = $transInfo['used']; echo "</optgroup><optgroup label='UnMonitored Decline Messages'>\n"; } echo "<option value='%" . $transInfo['val'] . "%' style='" . ($used ? "font-weight:bold;" : "") . "'>" . $transInfo['disp'] . " (" . $transInfo['cnt'] . ")" . ($transInfo['wl_ID'] ? " - Monitored by Watch #" . $transInfo['wl_ID'] : "") . "</option>\n"; } ?> </optgroup> </select> <input type="hidden" name="wl_ID" value="<?php echo $wl_ID;
} else { if ($strPendingStatus == "P") { echo "<font face='verdana' size='1'>Pending</font>"; } else { if ($strPendingStatus == "D") { echo "<font face='verdana' size='1' color='red'>Declined {$ideclineReason}</font>"; } } } ?> </td> <td align='center' class='cl1'> <?php $transnum = $show_select_val['transactionId']; $qry_select = "Select status,cancelstatus from {$trans_table_name} where transactionId={$transnum}"; $res_select = sql_query_read($qry_select) or dieLog(mysql_error() . "<pre>{$qry_select}</pre>"); $status = mysql_result($res_select, 0, 0); $strCancelled = mysql_result($res_select, 0, 1); ?> </td> <td align='left' class='cl1'><font face='verdana' size='1'> <?php if ($strPassStatus == "ND" && $strCancelled == "N") { echo " "; } else { if ($strCancelled != "N") { if ($strCancellOther != "") { print "" . $strCancellOther . " "; } else { print "" . $strCancellReason . " "; }
function processAccessForm($access) { $sql_table = $access['Sql_Table']; $sql_conditions = $access['Sql_Conditions']; $updates = 0; $sql_sets = ""; foreach ($access['Data'] as $key => $data) { $post = stripslashes($_POST[$data['Name']]); $post = str_replace("'", "`", $post); if ($post != $data['Value'] && !$data['disable']) { if ($sql_sets) { $sql_sets .= ", "; } $value = quote_smart($post); $sql_sets .= $data['Name'] . "='{$value}'"; $access['Data'][$key]['Value'] = $post; $updates++; } } if ($sql_sets) { $sql = "Update {$sql_table} set {$sql_sets} where {$sql_conditions}"; $result = sql_query_read($sql) or dieLog(mysql_error()); } return $updates; }