function add($VAR) { $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); }
function add($VAR) { $this->newsletter_construct(); $type = "add"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); }
function add($VAR) { $type = "add"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $id = $db->add($VAR, $this, $type); ### Set the static vars: if ($id) { global $smarty; require_once PATH_CORE . 'static_var.inc.php'; $static_var = new CORE_static_var(); $static_var->add($VAR, $this->module, $id); } }
function add($VAR) { // check this is not a duplicate for the selected product/voip_rate record combo $product_id = $VAR['voip_rate_prod_product_id']; $voip_rate_id = $VAR['voip_rate_prod_voip_rate_id']; $db =& DB(); $rs = $db->Execute(sqlSelect($db, 'voip_rate_prod', 'id', "product_id = ::{$product_id}:: AND voip_rate_id = ::{$voip_rate_id}::")); if ($rs && $rs->RecordCount() > 0) { echo "<script>alert('Specified product/voip_rate combo already exists, cannot create record'); history.back();</script>"; return false; } $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); }
function add($VAR) { $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $group_id = $db->add($VAR, $this, $type); # add the new group to the account_group table: $db =& DB(); $record_id = $db->GenID(AGILE_DB_PREFIX . 'account_group_id'); $sql = "INSERT INTO " . AGILE_DB_PREFIX . "account_group SET\n\t\t\t\tid\t\t\t= " . $db->qstr($record_id) . ",\n\t\t\t\tsite_id \t= " . $db->qstr(DEFAULT_SITE) . ", \n\t\t\t\tdate_orig\t= " . $db->qstr(time()) . ",\n\t\t\t\tdate_expire = " . $db->qstr('0') . ",\n\t\t\t\tgroup_id\t= " . $db->qstr($group_id) . ",\n\t\t\t\taccount_id\t= " . $db->qstr(SESS_ACCOUNT) . ",\n\t\t\t\tactive\t\t= " . $db->qstr(1); $result = $db->Execute($sql); if ($result === false) { global $C_debug; $C_debug->error('list.inc.php', 'select_groups', $db->ErrorMsg()); return; } # update the current user's authentication so the newly added group appears # as available to them global $C_auth; $C_auth->auth_update(); return; }
function add($VAR) { global $_FILES, $C_translate, $C_debug; $imgarr = array('jpeg', 'jpg', 'gif', 'bmp', 'tif', 'tiff', 'png'); if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) { for ($i = 0; $i < count($imgarr); $i++) { if (preg_match('@' . $imgarr[$i] . '$@i', $_FILES['upload_file1']['name'])) { $filename = $imgarr[$i]; $i = 10; } } if (empty($filename)) { echo 'You must upload a image file (jpg,gif,bmp,tiff,png)'; return; } else { $VAR["product_img_name"] = $_FILES['upload_file1']['name']; $VAR["product_img_url"] = $filename; $VAR["product_img_type"] = "0"; } } else { if (empty($VAR["img_url"])) { echo 'You must either upload a image or specify an image URL!'; return; } else { $VAR["product_img_name"] = $VAR["img_url"]; $VAR["product_img_url"] = $VAR["img_url"]; $VAR["product_img_type"] = "1"; } } $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $result = $db->add($VAR, $this, $type); # copy the image if ($result && !empty($filename)) { $file = 'prod_img_' . $result . '.' . $filename; copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "" . $file); } }
function add($VAR) { global $_FILES; #################################################################### ### Validate the thumbnail upoad: if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) { $VAR['product_cat_thumbnail'] = "cat_thmb_" . $_FILES['upload_file1']['name']; } ### Validate the image upoad: if (isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) { $VAR['product_cat_image'] = "cat_img_" . $_FILES['upload_file2']['name']; } #################################################################### ## Attempt to add the record: $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $result = $db->add($VAR, $this, $type); #################################################################### ### Copy the image(s) if ($result) { ### Copy 1ST file upoad: if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) { copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "cat_thmb_" . $_FILES['upload_file1']['name']); } ### Copy the 2ND file upoad: if (isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) { copy($_FILES['upload_file2']['tmp_name'], PATH_IMAGES . "cat_img_" . $_FILES['upload_file2']['name']); } } }
function add($VAR) { # defaults for 'recurring' product if ($VAR["product_price_type"] == "1") { $VAR['product_price_recurr_default'] = "1"; $VAR['product_price_recurr_type'] = "0"; $VAR['product_price_recurr_week'] = "1"; $VAR['product_price_recurr_weekday'] = "1"; # Set default recurring prices: (monthly only) $db =& DB(); $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'group WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND pricing = ' . $db->qstr('1'); $rs = $db->Execute($sql); while (!$rs->EOF) { $i = $rs->fields['id']; $recur_price[0][$i]['price_base'] = ''; $recur_price[0][$i]['price_setup'] = ''; @($recur_price[1][$i]['price_base'] = $VAR['product_price_base']); @($recur_price[1][$i]['price_setup'] = $VAR['product_price_setup']); $recur_price[2][$i]['price_base'] = ''; $recur_price[2][$i]['price_setup'] = ''; $recur_price[3][$i]['price_base'] = ''; $recur_price[3][$i]['price_setup'] = ''; $recur_price[4][$i]['price_base'] = ''; $recur_price[4][$i]['price_setup'] = ''; $recur_price[5][$i]['price_base'] = ''; $recur_price[5][$i]['price_setup'] = ''; $rs->MoveNext(); } $recur_price[0]['show'] = "0"; $recur_price[1]['show'] = "1"; $recur_price[2]['show'] = "0"; $recur_price[3]['show'] = "0"; $recur_price[4]['show'] = "0"; $recur_price[5]['show'] = "0"; @($VAR['product_price_group'] = $recur_price); } # Defaults for product groups: $VAR['product_group_avail'] = array('0'); $this->product_construct(); $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $result = $db->add($VAR, $this, $type); # Create a translate record for this product: if ($result) { $db =& DB(); $id = $db->GenID(AGILE_DB_PREFIX . 'product_translate_id'); $sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'product_translate SET site_id = ' . $db->qstr(DEFAULT_SITE) . ', id = ' . $db->qstr($id) . ', product_id = ' . $db->qstr($result) . ', language_id = ' . $db->qstr(DEFAULT_LANGUAGE) . ', name = ' . $db->qstr(@$VAR["translate_name"]) . ', description_short = ' . $db->qstr(@$VAR["translate_description_short"]) . ', description_full = ' . $db->qstr(@$VAR["translate_description_full"]); $db->Execute($sql); } }
function add($VAR) { $type = "add"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $id = $db->add($VAR, $this, $type); if (isset($id) && $id > 0) { # Create the php index file for the Apache mod_auth_remote module: /* $GroupArray = ''; for($i=0; $i<count($VAR['htaccess_group_avail']); $i++) { if($i > 0) $GroupArray .= ','; $GroupArray .= $VAR['htaccess_group_avail'][$i]; } $data = '<?php $Status = '.@$VAR['htaccess_status'].'; $GroupArray = Array('.$GroupArray.'); if($Status != "1") { header(\'WWW-Authenticate: Basic realm="Failed"\'); header("HTTP/1.0 401 Unauthorized"); exit; } include_once("../../../config.inc.php"); require_once(PATH_ADODB . "adodb.inc.php"); require_once(PATH_CORE . "database.inc.php"); require_once(PATH_MODULES. "htaccess/mod_auth_remote.inc.php"); ?>'; # add dir: $dir = PATH_FILES . 'htaccess_'. $id .'/'; if(is_dir($dir)) mkdir($dir, '755'); $file = $dir . 'index.php'; $fp = fopen($file, "w+"); fputs($fp, $data); fclose($fp); */ } }
function add($VAR) { global $C_translate, $C_debug; $VAR['htaccess_dir_htaccess'] = '# Error!'; $this->validated = true; ### Change the path... if (isset($VAR['htaccess_dir_path']) && $VAR['htaccess_dir_path'] != '') { # trim whitspaces $VAR['htaccess_dir_path'] = trim($VAR['htaccess_dir_path']); # replace all forward slashes with back slashes $VAR['htaccess_dir_path'] = ereg_replace('\\\\', '/', $VAR['htaccess_dir_path']); # add the final trailing slash if missing if (!ereg('[/]$', $VAR['htaccess_dir_path'])) { $VAR['htaccess_dir_path'] = $VAR['htaccess_dir_path'] . '/'; } } if (isset($VAR['htaccess_dir_path']) && $VAR['htaccess_dir_path'] != '') { ################################################################ ### VERIFY LOCAL PATH & WRITABILITY! @($filename = $VAR['htaccess_dir_path'] . '.htaccess'); @($id = $VAR['htaccess_dir_htaccess_id']); $db =& DB(); $sql = 'SELECT name FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND id = ' . $db->qstr($id); $result = $db->Execute($sql); @($name = $result->fields['name']); ### Check path $path = $VAR['htaccess_dir_path']; if (is_dir($path)) { ### Check if is writable! if (!is_writable($path)) { ## Path not writable! $this->validated = false; $this->val_error[] = array('field' => 'none', 'field_trans' => $C_translate->translate('error', 'core', ""), 'error' => $C_translate->translate('path_auth', 'htaccess_dir', "")); } } else { ### Path broken! $this->validated = false; $this->val_error[] = array('field' => 'none', 'field_trans' => $C_translate->translate('error', 'core', ""), 'error' => $C_translate->translate('path_broke', 'htaccess_dir', "")); } } #################################################################### ### If validation was failed, skip the db insert & ### set the errors & origonal fields as Smarty objects, ### and change the page to be loaded. #################################################################### if (!$this->validated) { global $smarty; # set the errors as a Smarty Object $smarty->assign('form_validation', $this->val_error); # set the page to be loaded if (!defined("FORCE_PAGE")) { define('FORCE_PAGE', $VAR['_page_current']); } return; } #################################################################### ### Create the record/verify fields $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $dir_id = $db->add($VAR, $this, $type); #################################################################### ### Create the .htaccess file if (isset($dir_id) && $dir_id > 0) { ### GENERATE THE EXCLUDE LIST $exclude_list = $this->exclude_list(); ### GENERATE THE .HTACCESS FILE $nl = "\n"; $data = $this->htaccess_extra . 'RewriteEngine on' . $nl; if (empty($VAR['htaccess_dir_recursive'])) { $data .= 'RewriteRule ^(.*)/.*$ - [L]' . $nl; } $data .= 'RewriteRule ' . $exclude_list . '$ htaccess_index.php?_HTACCESS_ID=' . $id . '&_HTACCESS_DIR_ID=' . $dir_id; ### Update the db record $db =& DB(); $sql = "UPDATE " . AGILE_DB_PREFIX . "htaccess_dir SET\n\t\t\t\t htaccess = " . $db->qstr($data) . " WHERE\n\t\t\t\t id = " . $db->qstr($dir_id) . " AND\n\t\t\t\t site_id = " . $db->qstr(DEFAULT_SITE); $result = $db->Execute($sql); ### WRITE THE LOCAL .HTACCESS FILE $fp = fopen($filename, "w+"); fwrite($fp, $data); fclose($fp); ### WRITE THE htaccess_index.php FILE $php_filename = $VAR['htaccess_dir_path'] . 'htaccess_index.php'; $data = $this->create_php(); $fp = fopen($php_filename, "w+"); fwrite($fp, $data); fclose($fp); } }
function add($VAR) { $this->static_page_category_construct(); $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); }
function add($VAR) { $this->construct(); global $C_vars, $C_list, $C_debug; ### Strip Slashes: global $C_vars; $C_vars->strip_slashes_all(); ### Get the current staff id: $dbs =& DB(); $sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'staff WHERE site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND account_id = ' . $dbs->qstr(SESS_ACCOUNT); $result = $dbs->Execute($sql); if ($result->RecordCount() == 0) { ### ERROR: this account does not have a staff id global $C_debug, $C_translate; $C_debug->alert($C_translate->translate('staff_no_account', 'ticket', '')); $C_vars->strip_slashes_all(); return; } else { $staff_id = $result->fields['id']; $VAR['ticket_staff_id'] = $staff_id; } ### Validate either the user account_id or email has been provided. include_once PATH_CORE . 'validate.inc.php'; $C_validate = new CORE_validate(); $validate = false; if (empty($VAR['ticket_account_id']) && empty($VAR['ticket_email'])) { $validate = false; } elseif ($C_validate->validate_email(@$VAR['ticket_email'], false)) { $validate = true; } ### Set the e-mail from the account for this ticket if none provided: if (!empty($VAR['ticket_account_id']) && empty($VAR['ticket_email'])) { $sql = 'SELECT id,email FROM ' . AGILE_DB_PREFIX . 'account WHERE site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND id = ' . $dbs->qstr(@$VAR['ticket_account_id']); $account = $dbs->Execute($sql); if ($account->RecordCount() == 0) { $validate = false; } else { $this->email = trim($account->fields['email']); $VAR['ticket_email'] = trim($account->fields['email']); $validate = true; } } ### Everything pass inspection? if (!$validate) { $C_debug->alert("A valid user account or e-mail address must be provided!"); define('FORCE_PAGE', "ticket:add"); return; } ### Set times: $VAR['ticket_date_orig'] = $C_list->date_time(time()); $VAR['ticket_date_last'] = $C_list->date_time(time()); $VAR['ticket_last_reply'] = "0"; $VAR['ticket_status'] = "0"; $type = "add"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $this->record_id = $db->add($VAR, $this, $type); if ($this->record_id) { ################################################################### ### Insert the static vars... require_once PATH_CORE . 'static_var.inc.php'; $static_var = new CORE_static_var(); $static_var->add($VAR, 'ticket', $this->record_id); ################################################################### ### Mail the user the new_ticket email template require_once PATH_MODULES . 'email_template/email_template.inc.php'; $my = new email_template(); if (empty($this->email)) { global $VAR; $VAR['key'] = $this->key($VAR['ticket_email']); $VAR['email'] = trim($VAR['ticket_email']); $my->send('ticket_staff_add_user', $VAR['ticket_email'], $this->record_id, '', ''); } else { global $VAR; $VAR['key'] = $this->key($this->email); $VAR['email'] = trim($this->email); $my->send('ticket_staff_add_user', $VAR['ticket_account_id'], $this->record_id, '', ''); } ################################################################### ### Get any staff members who should be mailed $dba =& DB(); $sql = 'SELECT id,account_id,department_avail FROM ' . AGILE_DB_PREFIX . 'staff WHERE site_id = ' . $dba->qstr(DEFAULT_SITE) . ' AND notify_new = ' . $dba->qstr("1"); $result = $dba->Execute($sql); if ($result->RecordCount() > 0) { while (!$result->EOF) { @($avail = unserialize($result->fields['department_avail'])); for ($i = 0; $i < count($avail); $i++) { if ($avail[$i] == $VAR['ticket_department_id']) { ################################################################### ### Mail staff members the new_ticket email template $my = new email_template(); $my->send('ticket_staff_add', $result->fields['account_id'], $this->record_id, $avail[$i], ''); $i = count($avail); } } $result->MoveNext(); } } } }
function add($VAR) { global $_FILES, $smarty, $C_debug, $C_translate; if ($VAR['file_location_type'] == '') { return false; } $lt = $VAR['file_location_type']; // UPLOADED FILE FROM LOCAL PC if ($lt == 0) { ### Validate the file upoad: if (!isset($_FILES['upload_file']) || $_FILES['upload_file']['size'] <= 0) { global $C_debug; $C_debug->alert('You must go back and enter a file for upload!'); return; } $VAR['file_size'] = $_FILES['upload_file']['size']; $VAR['file_type'] = $_FILES['upload_file']['type']; $VAR['file_name'] = $_FILES['upload_file']['name']; } elseif ($lt == 1) { ### Validate the remote file can be opened and is greater than 0K $file = $VAR['url_file']; if (empty($file) || !($fp = fopen($file, "r"))) { # error $C_debug->alert($C_translate->translate('remote_file_err', 'file', '')); return; } else { $VAR['file_location'] = $file; $fn = explode("/", $file); $count = count($fn) - 1; $VAR['file_name'] = $fn[$count]; $headers = stream_get_meta_data($fp); $headers = $headers['wrapper_data']; for ($i = 0; $i < count($headers); $i++) { if (preg_match('/^Content-Type:/i', $headers[$i])) { $VAR['file_type'] = preg_replace('/Content-Type: /i', '', $headers[$i]); } elseif (preg_match('/^Content-Length:/i', $headers[$i])) { $VAR['file_size'] = preg_replace('/Content-Length: /i', '', $headers[$i]); } } } } elseif ($lt == 2) { @($file = $VAR['local_file']); if (is_file($file) && is_readable($file)) { if (preg_match("@/@", $file)) { $fn = explode("/", $file); } else { if (preg_match("@\\@", $file)) { $fn = explode("\\", $file); } else { $fn[0] = $file; } } $count = count($fn) - 1; $VAR['file_name'] = $fn[$count]; $VAR['file_size'] = filesize($file); $VAR['file_location'] = $file; include_once PATH_CORE . 'file_extensions.inc.php'; $ext = new file_extensions(); $VAR['file_type'] = $ext->content_type($file); } else { $C_debug->alert($C_translate->translate('local_file_err', 'file', '')); return; } } else { return false; } ### Create the record $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $id = $db->add($VAR, $this, $type); ### Copy the uploaded file, or exit if fail: if ($lt == 0) { if (isset($id) && $id > 0) { if (!copy($_FILES['upload_file']['tmp_name'], PATH_FILES . 'file_' . $id . '.dat')) { $C_debug->alert($C_translate->translate('copy_file_err', 'file', '')); } } unlink($_FILES['upload_file']['tmp_name']); } }
function add($VAR) { $VAR['host_server_keycode'] = md5(rand(99, 999) . microtime()); $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); }
function add($VAR) { global $_FILES; # Validate the files for ($i = 1; $i <= 12; $i++) { if (isset($_FILES['upload_file' . $i]) && $_FILES['upload_file' . $i]['size'] > 0) { $VAR['campaign_type' . $i] = $_FILES['upload_file' . $i]['type']; $VAR['campaign_file' . $i] = $_FILES['upload_file' . $i]['name']; } } ## Attempt to add the record: $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $campaign_id = $db->add($VAR, $this, $type); ### Copy the files & delete temp files if ($campaign_id > 0) { for ($i = 1; $i <= 12; $i++) { if (isset($_FILES['upload_file' . $i]) && $_FILES['upload_file' . $i]['size'] > 0) { if (!copy($_FILES['upload_file' . $i]['tmp_name'], PATH_FILES . 'campaign_' . $campaign_id . '_' . $i . '.dat')) { ### ERROR: } #unlink any temp files unlink($_FILES['upload_file' . $i]['tmp_name']); } } } }
function add($VAR) { $this->charge_construct(); if (!empty($VAR['attributes'])) { $attr = false; for ($i = 0; $i < count($VAR['attributes']); $i++) { if (!empty($VAR['attributes'][$i][0])) { $attr .= "{$VAR['attributes'][$i][0]}=={$VAR['attributes'][$i][1]}\r\n"; } } $VAR['charge_attributes'] = $attr; } $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); }
function add($VAR) { $type = "add"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $id = $db->add($VAR, $this, $type); if ($id && !empty($VAR['faq_question'])) { # Insert translation $db =& DB(); $idx = $db->GenID(AGILE_DB_PREFIX . 'faq_translate_id'); $sql = "INSERT INTO\t" . AGILE_DB_PREFIX . "faq_translate\n\t\t\t\t\tSET\n\t\t\t\t\tsite_id = " . DEFAULT_SITE . ",\n\t\t\t\t\tid = {$idx},\n\t\t\t\t\tfaq_id = {$id},\n\t\t\t\t\tdate_orig = " . time() . ",\n\t\t\t\t\tdate_last = " . time() . ",\n\t\t\t\t\tlanguage_id = '" . DEFAULT_LANGUAGE . "',\n\t\t\t\t\tanswer = " . $db->qstr(@$VAR['faq_answer']) . ",\n\t\t\t\t\tquestion = " . $db->qstr(@$VAR['faq_question']); $db->Execute($sql); } }
function add($VAR) { global $C_debug, $C_translate; # Get the last 4 digits of the cc: @($VAR['account_billing_card_num4'] = substr($VAR['account_billing_card_num'], strlen($VAR['account_billing_card_num']) - 4, 4)); # Validate the req fields if (empty($VAR['account_billing_card_exp_month']) || empty($VAR['account_billing_card_exp_year']) || empty($VAR['account_billing_card_num'])) { $msg = $C_translate->translate('val_missing', 'account_billing', ''); $C_debug->alert($msg); return false; } # Validate the exp date if (mktime(0, 0, 0, $VAR['account_billing_card_exp_month'], date('d'), $VAR['account_billing_card_exp_year']) <= time()) { $msg = $C_translate->translate('val_exp', 'account_billing', ''); $C_debug->alert($msg); return false; } # Validate the card against the card type include_once PATH_CORE . 'validate.inc.php'; $validate = new CORE_validate(); if (!$validate->validate_cc($VAR['account_billing_card_num'], 'card_num', $VAR['account_billing_card_type'], false)) { $msg = $C_translate->translate('val_cc', 'account_billing', ''); $C_debug->alert($msg); return false; } $this->construct(); $type = "add"; $this->method["{$type}"] = explode(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); }
/** Add new pin(s) */ function add($VAR) { if (!empty($VAR['bulk'])) { if (empty($VAR['voip_prepaid_account_id']) || empty($VAR['voip_prepaid_product_id']) || empty($VAR['voip_prepaid_balance']) || empty($VAR['voip_prepaid_qty']) || empty($VAR['voip_prepaid_bulk'])) { print "Failed: Please check that you have provided an account, product, balance, and quantity, and bulk reference number"; return; } else { $db =& DB(); for ($i = 0; $i < $VAR['voip_prepaid_qty']; $i++) { if ($pin = $this->genPin()) { // insert the record $fields["pin"] = $pin; $fields["account_id"] = $VAR['voip_prepaid_account_id']; $fields["product_id"] = $VAR['voip_prepaid_product_id']; $fields["balance"] = $VAR['voip_prepaid_balance']; $fields['date_expire'] = $VAR['voip_prepaid_date_expire']; $fields["bulk"] = $VAR['voip_prepaid_bulk']; $db->Execute(sqlInsert($db, "voip_prepaid", $fields)); } } echo "Added Batch Successfully!"; echo "<script>document.location='?_page=core:search&module=voip_prepaid&voip_prepaid_bulk={$VAR['voip_prepaid_bulk']}';</script>"; } } else { $type = "add"; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $db = new CORE_database(); $db->add($VAR, $this, $type); } }