function outgoing_getprefix($id) { if ($id) { $db_query = "SELECT prefix FROM " . _DB_PREF_ . "_featureOutgoing WHERE id='{$id}'"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $prefix = outgoing_display_prefix($db_row['prefix']); } return $prefix; }
if (!$add_username) { $add_uid = 0; } } $add_dst = $_POST['add_dst']; // sanitize prefixes $add_prefix = $_POST['add_prefix']; $prefixes = explode(',', $add_prefix); $add_prefix = ''; foreach ($prefixes as $c_prefix) { $c_prefix = core_sanitize_numeric($c_prefix); if ($c_prefix = (string) substr($c_prefix, 0, 8)) { $add_prefix .= '[' . $c_prefix . '],'; } } $add_prefix = rtrim(trim($add_prefix), ','); $add_smsc = $_POST['add_smsc'] ? $_POST['add_smsc'] : 'blocked'; if ($add_dst) { $db_query = "\n\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_featureOutgoing (uid,dst,prefix,smsc)\n\t\t\t\t\tVALUES ('{$add_uid}','{$add_dst}','{$add_prefix}','{$add_smsc}')"; if ($new_uid = @dba_insert_id($db_query)) { $_SESSION['dialog']['info'][] = _('Route has been added') . " (" . _('destination') . ": {$add_dst}, " . _('prefix') . ": " . outgoing_display_prefix($add_prefix) . ")"; } else { $_SESSION['dialog']['danger'][] = _('Fail to add route') . " (" . _('destination') . ": {$add_dst}, " . _('prefix') . ": " . outgoing_display_prefix($add_prefix) . ")"; } } else { $_SESSION['dialog']['danger'][] = _('You must fill all fields'); } header("Location: " . _u('index.php?app=main&inc=feature_outgoing&op=outgoing_add')); exit; break; }