// user checked box if(isset($_POST["option$i"])) $option[$i] = htmlspecialchars($_POST["option$i"]); // user didn't check box else $option[$i] = "0"; } // add options to array containing all user input $input['option'] = $option; $input['tokens'] = $poll['tokens']; $input['id'] = extract_id($url); // generate xml for post request $input['xml'] = update_xml($input); // send request using this input $response = submit_poll($input); // if unknown error... if($response == false) apologize("Sorry, an unknown error occurred. Please try again."); /*if user reaches this point, submission successful*/ } else // prevent user from jumping straight to this page apologize("Sorry, an error occurred. Please try again."); ?>
function analysis_data($path, $every_year = false) { global $year_arr, $_lang; $detail_arr = array($_lang['total'], $_lang['witkey_task'], $_lang['witkey_shop'], $_lang['payitem_service'], $_lang['user_auth']); if (strtolower(CHARSET) == 'gbk') { $detail_arr = kekezu::gbktoutf($detail_arr); } $series = ''; $total = $bid_ins = $service_ins = $item_ins = $auth_ins = 0; foreach ($year_arr as $key => $value) { $bid_in = db_factory::get_count(sprintf(" select sum(site_profit) as cash from %switkey_finance where (fina_action='task_bid' or fina_action='pub_task') and site_profit>0 and (fina_type='in' or fina_type='out') and YEAR(FROM_UNIXTIME(fina_time))=%d", TABLEPRE, $value['year'])); $bid_ins += $bid_in; $service_in = db_factory::get_count(sprintf(" select sum(site_profit) as cash from %switkey_finance where fina_action='sale_service' and fina_type='in' and YEAR(FROM_UNIXTIME(fina_time))=%d", TABLEPRE, $value['year'])); $service_ins += $service_in; $item_in = db_factory::get_count(sprintf(" select sum(site_profit) as cash from %switkey_finance where fina_action='payitem' and fina_type='out' and YEAR(FROM_UNIXTIME(fina_time))=%d", TABLEPRE, $value['year'])); $item_ins += $item_in; $auth_in = db_factory::get_count(sprintf(" select sum(site_profit) as cash from %switkey_finance where INSTR(fina_action,'_auth') and fina_type='out' and YEAR(FROM_UNIXTIME(fina_time))=%d", TABLEPRE, $value['year'])); $auth_ins += $auth_in; $point = ''; $point .= '<point name="' . $detail_arr['1'] . '" y="' . $bid_in . '"/>'; $point .= '<point name="' . $detail_arr['2'] . '" y="' . $service_in . '"/>'; $point .= '<point name="' . $detail_arr['3'] . '" y="' . $item_in . '"/>'; $point .= '<point name="' . $detail_arr['4'] . '" y="' . $auth_in . '"/>'; if ($every_year == true) { $year_path = sprintf($path, $value['year']); update_xml($year_path, '<data><series name="Series 1">' . $point . '</series></data>', 'analysis'); } } $str = ''; $str .= '<series name="Series 1">'; $str .= '<point name="' . $detail_arr['1'] . '" y="' . $bid_ins . '"/>'; $str .= '<point name="' . $detail_arr['2'] . '" y="' . $service_ins . '"/>'; $str .= '<point name="' . $detail_arr['3'] . '" y="' . $item_ins . '"/>'; $str .= '<point name="' . $detail_arr['4'] . '" y="' . $auth_ins . '"/>'; $str .= '</series>'; return update_xml(sprintf($path, 'total'), '<data>' . $str . '</data>', 'analysis'); }
$key = @($struct[$i][1] == INDEX_PRIMORY_KEY) ? 1 : 0; $type = get_type($fmt[$i]); $field = null; if (isset($struct[$i]) && $struct[$i] != '') { $field = is_array($struct[$i]) ? $struct[$i][0] : $struct[$i]; } $out = array($f, $i, $field, $key, $count, $fmt[$i], $type); $DB->query('INSERT INTO `_dbc_fields_` VALUES(?a)', $out); if ($count > 1) { $i += $count - 1; } } } } if (isset($_POST['update_xml'])) { update_xml(); } if (isset($_POST['update_fmt_from_db'])) { $data = $DB->selectPage($count, "SELECT * FROM `_dbc_info_`"); $ffmt = fopen('core/fmt.php.ini', 'wb'); $str_fmt = "'%s' => '%s'%s // rows: %s, cols: %s\r\n"; fprintf($ffmt, "<?php\r\n// dbc format v4.0.0\r\n\$DBCfmt = array(\r\n"); foreach ($data as $c => $d) { $strlen = strlen($d['format']); $str_inc = $c + 1 == $count ? '' : ','; if ($strlen != $d['columns']) { $d['columns'] = $d['columns'] . '(' . $strlen . ')'; $DB->query("UPDATE `_dbc_info_` SET `valid`=0 WHERE `file`=? ", $d['file']); } fprintf($ffmt, $str_fmt, $d['file'], $d['format'], $str_inc, $d['rows'], $d['columns']); }
//settings file $settings = 'native.flashradio.rating.settings.xml'; //generate unique user fingerprint if (!isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $user = md5($_SERVER['REMOTE_ADDR']); } else { $user = md5($_SERVER['HTTP_X_FORWARDED_FOR']); } if (isset($_POST['song']) && isset($_POST['name']) && isset($_POST['set'])) { $song = $_POST['song']; $name = $_POST['name']; $set = $_POST['set']; if (file_exists($settings)) { if (validate_values($song, $name, $set, $settings)) { if (file_exists($xmlFile)) { update_xml($user, $song, $name, $set, $xmlFile); echo "update"; } else { create_xml($user, $song, $name, $set, $xmlFile); echo "create"; } } else { echo "not valid"; } } else { echo "settings not found"; } } function validate_values($song, $name, $set, $settings) { $found = false;