/** * Created by PhpStorm. * User: matedealer * Date: 3/23/16 * Time: 7:29 PM */ function users_export_controller($type) { if (isset($_REQUEST['key']) && preg_match("/^[0-9a-f]{32}\$/", $_REQUEST['key'])) { $key = $_REQUEST['key']; } else { die("Missing key."); } $user = User_by_api_key($key); if ($user === false) { die("Unable to find user."); } if ($user == null) { die("Key invalid."); } if (!in_array('admin_user', privileges_for_user($user['UID']))) { die("No privilege for export users."); } if ($type == 'csv') { export_csv(); } elseif ($type == 'mail') { export_mail(); } }
} db_connect($db_server, $db_name, $db_user, $db_pass); if ($db_charset && 'mysql' == $db_driver) { db_exe("SET NAMES {$db_charset}"); } if (isset($_GET['dump_all']) && 1 == $_GET['dump_all']) { dump_all($data = false); } if (isset($_GET['dump_all']) && 2 == $_GET['dump_all']) { dump_all($data = true); } if (isset($_GET['dump_table']) && $_GET['dump_table']) { dump_table($_GET['dump_table']); } if (isset($_GET['export']) && 'csv' == $_GET['export']) { export_csv(base64_decode($_GET['query']), $_GET['separator']); } if (isset($_POST['sqlfile']) && $_POST['sqlfile']) { $files = sql_files_assoc(); if (!isset($files[$_POST['sqlfile']])) { exit('File not found. md5 = ' . $_POST['sqlfile']); } $sqlfile = $files[$_POST['sqlfile']]; layout(); echo '<div>Importing: <b>' . $sqlfile . '</b> (' . size(filesize($sqlfile)) . ')</div>'; echo '<div>Database: <b>' . $db_name . '</b></div>'; flush(); import($sqlfile, post('ignore_errors'), post('transaction'), post('force_myisam'), post('query_start', 'int')); exit; } if (isset($_POST['drop_table']) && $_POST['drop_table']) {
* the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. * * allocPSA is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with allocPSA. If not, see <http://www.gnu.org/licenses/>. */ // Get an exported representation of something (at the moment, only a project) // Call as: get_export.php?entity=project&id=1&format=planner require_once "../alloc.php"; if (isset($_GET["id"]) && isset($_GET["entity"])) { switch ($_GET["entity"]) { case "project": switch ($_GET["format"]) { case "planner": header('Content-Type: application/xml'); header('Content-Disposition: attachment; filename="allocProject.planner"'); echo export_gnome_planner(intval($_GET["id"])); break; case "csv": header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="allocProject.csv"'); echo export_csv(intval($_GET["id"])); } break; } }
case "weight_chart": $sth = $conn->prepare("SELECT strftime('%s',date)*1000 AS datetime, hiveweight, hiverawweight FROM allhivedata WHERE date > datetime('now','{$sqlperiod}') ORDER BY datetime"); $sth->execute(); $result = $sth->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $r) { $out[] = array((double) $r['datetime'], (double) $r['hiveweight']); } break; case "weight_data": $sth = $conn->prepare("SELECT hiveid, date, hiveweight, hiverawweight FROM allhivedata WHERE date > datetime('now','{$sqlperiod}') ORDER BY date"); $sth->execute(); break; } switch ($output) { case "csv": export_csv($sth, $type, $period); break; case "json": export_json($sth); break; case "highcharts": export_highcharts($out); break; } #echo "Period is $sqlperiod"; #echo "Type is $type"; // Get Weather/Hive Data First - from a DB view, this may be very slow function export_highcharts($out) { //?type=temp&period=month&output=highcharts' // Convert time to Unix EPOCH, output one value only.
*/ include "../functions/functions.export.php"; if (isset($_GET['data'])) { export_fixed_width(intval($_GET['data'])); exit; } if (isset($_GET['ddi'])) { export_ddi(intval($_GET['ddi'])); exit; } if (isset($_GET['csv'])) { export_csv(intval($_GET['csv'])); exit; } if (isset($_GET['csvl'])) { export_csv(intval($_GET['csvl']), true, true); exit; } if (isset($_GET['pspp'])) { export_pspp(intval($_GET['pspp'])); exit; } if (isset($_GET['psppn'])) { export_pspp(intval($_GET['psppn']), false); exit; } xhtml_head(T_("Export Data"), true, array("../css/table.css"), array("../js/display.js")); $data_id = 0; if (isset($_GET['data_id'])) { $data_id = intval($_GET['data_id']); }
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace')); Display::display_header($nameTools); // Database Table Definitions $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_track_exercice = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); /* MAIN CODE */ $sql_course = "SELECT title, code, id FROM {$tbl_course} as course ORDER BY title ASC"; $result_course = Database::query($sql_course); if (Database::num_rows($result_course) > 0) { if (isset($_POST['export'])) { $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet. Display::display_error_message($export_result); } echo '<table class="data_table"><tr><th>' . get_lang('Course') . '</th><th>' . get_lang('TempsFrequentation') . '</th><th>' . get_lang('Progression') . '</th><th>' . get_lang('MoyenneTest') . '</th></tr>'; $header = array(get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', '')); while ($a_course = Database::fetch_array($result_course)) { // TODO: This query is to be checked, there are no HotPotatoes tests results. $sql_moy_test = "SELECT exe_result,exe_weighting\n\t\t\tFROM {$tbl_track_exercice}\n\t\t\tWHERE c_id = " . $a_course['id']; $result_moy_test = Database::query($sql_moy_test); $result = 0; $weighting = 0; while ($moy_test = Database::fetch_array($result_moy_test)) { $result = $result + $moy_test['exe_result']; $weighting = $weighting + $moy_test['exe_weighting']; }
function _wpr_export() { $nid = $_POST['newsletter']; export_csv($nid); exit; }
if (!defined('SYSTEM_ROOT')) { die('Insufficient Permissions'); } function export_csv($filename, $data) { header("Content-type:text/csv"); header("Content-Disposition:attachment;filename=" . $filename); header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); header('Expires:0'); header('Pragma:public'); echo $data; } if (isset($_REQUEST['e'])) { global $m; $m->query('TRUNCATE TABLE `' . DB_NAME . '`.`' . DB_PREFIX . 'fyy_errorlog`'); Redirect(SYSTEM_URL . 'index.php?mod=admin:tools&ok'); } elseif (isset($_REQUEST['d'])) { global $m; $csv = $m->query('SELECT * FROM `' . DB_NAME . '`.`' . DB_PREFIX . 'fyy_errorlog` ORDER BY `time`'); $str = "错误信息,时间,种类,路径,行数\n"; $str = iconv('utf-8', 'gb2312', $str); while ($row = $m->fetch_array($csv)) { $row['error'] = iconv('utf-8', 'gb2312', $row['error']); $row['type'] = iconv('utf-8', 'gb2312', $row['type']); $row['file'] = iconv('utf-8', 'gb2312', $row['file']); $row['line'] = iconv('utf-8', 'gb2312', $row['line']); $str .= $row['error'] . "," . $row['time'] . "," . $row['type'] . "," . $row['file'] . "," . $row['line'] . "\n"; } $filename = '错误信息' . date('Ymd') . '.csv'; export_csv($filename, $str); }
//print _T('None', 'msc')." ".$verb[0]." "; } elseif ($ss[0] == '1') { print _T('One', 'msc') . " " . $verb[0] . " "; } else { print $ss[0] . " " . $verb[1] . " "; } if ($ss[0] != '0') { print $sl[1]; } if (count($sl) == 4 and $ss[0] != '0') { print " " . sprintf($sl[3], $status[$l[0]][$sl[2]][0]); } if ($ss[0] == 0) { //print "</td><td><img src='modules/msc/graph/nocsv.png' alt='no csv export possible'/></td></tr>"; } else { print "</td>" . export_csv($cmd_id, $_GET['bundle_id'], $sl[0]) . "</tr>"; } } } /* * bundle treatment: * ----------------- * * machines can be stored in more than one status (one package can be success, and another in fail state) * * If one package is failed, bundle is in fail status * If no failed, but one running package, bundle is in running status * For package paused => running status * For package stopped => failed status */ if (strlen($_GET['bundle_id']) and !isset($_GET['tab'])) {
if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) { header("Location: ../../login.php"); } $ini_array = parse_ini_file("../../config/cmdb.conf"); $dbhost = $ini_array['db_host']; $dbport = $ini_array['db_port']; $dbuser = $ini_array['db_user']; $dbpass = $ini_array['db_pass']; $dbname = $ini_array['db_name']; $conn = mysql_connect("{$dbhost}:{$dbport}", $dbuser, $dbpass) or die('Error connecting to mysql'); mysql_select_db($dbname); include_once '../../classes/Contact.php'; $file_name = trim($_GET['report_name']) . ".csv"; header("Content-type:text/octect-stream"); header("Content-Disposition:attachment;filename=\"{$file_name}\""); $csv_data = export_csv(); print $csv_data; function export_csv() { if (isset($_GET['report_name']) && $_GET['report_name'] != '') { $name = $_GET['report_name']; } else { return "<b>Sorry invalid report name " . $_GET['report_name'] . "</b>"; } $query = "select accounting_reports.id, accounting_reports.profile_id, accounting_reports.report_name, \n\t\t\taccounting_reports.date1, accounting_reports.date2, \n\t\t\taccounting_reports.avg_in, accounting_reports.avg_out, \n\t\t\taccounting_reports.max_in, accounting_reports.max_out,95_in as in95,\n\t\t\taccounting_reports.95_out as out95 , accounting_reports.tot_in, accounting_reports.tot_out,\n\t\t\taccounting_reports.sample_date1, accounting_reports.sample_date2, \n\t\t\taccounting_reports.traffic_cap, accounting_profiles.client_id\n\t\t\tfrom \n\t\t\taccounting_reports, accounting_profiles where report_name = '{$name}'\n\t\t\tAND accounting_profiles.profile_id = accounting_reports.profile_id"; $result = mysql_query($query); if (!$result) { return "failed to execute query {$query}<br>"; } $heading = array("Client", "Accounting Profile", "Report Name", "Start date", "End date", "Average In (b/s)", "Average out (b/s)", "Max In (b/s)", "Max out (b/s)", "95% In (b/s)", "95% out (b/s)", "95% Billing (b/s)", "95% Billing (Mb/s)", "Committed Traffic (b/s)", "Commitment Status", "Total In (Bytes)", "Total out (Bytes)", "First Sample date", "Last Sample date"); $content = implode(",", $heading);
} $data .= "\n"; foreach ($items as $item) { foreach ($data_field as $key => $value) { $item[$key] = str_replace(" ", " ", $item[$key]); $item[$key] = htmlspecialchars_decode($item[$key]); //$item[$key] = str_replace(',', ' ', $item[$key]); $item[$key] = preg_replace("/[\r\n]+/", ' ', $item[$key]); $data .= '"' . $item[$key] . '"' . ','; } $data .= "\n"; } return $data; } else { return 'no data'; } } if ($_GET['active'] == 'true') { $user_data = get_data($activity_id, true); } else { $user_data = get_data($activity_id, false); } $user_data = mb_convert_encoding($user_data, 'GBK', 'UTF-8'); if ($_GET['active'] == 'true') { $filename = 'actived_user-' . date('Ymd') . '.csv'; } else { $filename = 'processing_user-' . date('Ymd') . '.csv'; } $filename = iconv('UTF-8', 'GBK', $filename); export_csv($filename, $user_data);
*/ include "../config.inc.php"; /** * XHTML functions */ include "../functions/functions.xhtml.php"; /** * DB functions */ include "../db.inc.php"; /** * Export functions */ include "../functions/functions.export.php"; if (isset($_GET['download']) && isset($_GET['data_id']) && isset($_GET['code_column']) && isset($_GET['text_column'])) { export_csv(intval($_GET['data_id']), true, false, false, array(intval($_GET['code_column']), intval($_GET['text_column'])), false); exit; } xhtml_head(T_("Export code keyword correspondence"), true, array("../css/table.css"), array("../js/display.js")); $data_id = 0; if (isset($_GET['data_id'])) { $data_id = intval($_GET['data_id']); } //Select a data file to export data from $sql = "SELECT data_id as value,description, CASE WHEN data_id = '{$data_id}' THEN 'selected=\\'selected\\'' ELSE '' END AS selected\r\n\tFROM data"; print "<div>" . T_("Select data file: "); display_chooser($db->GetAll($sql), 'data_id', 'data_id'); print "</div>"; if ($data_id != 0) { $code_column = 0; if (isset($_GET['code_column'])) {
// Database Table Definitions $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_track_exercice = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); /* MAIN CODE */ $sql_course = "SELECT title,code FROM $tbl_course as course ORDER BY title ASC"; $result_course = Database::query($sql_course); if (Database::num_rows($result_course) > 0) { if (isset($_POST['export'])) { $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet. Display :: display_error_message($export_result); } echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('TempsFrequentation').'</th><th>'.get_lang('Progression').'</th><th>'.get_lang('MoyenneTest').'</th></tr>'; $header = array(get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', '')); while ($a_course = Database::fetch_array($result_course)) { // TODO: This query is to be checked, there are no HotPotatoes tests results. $sql_moy_test = "SELECT exe_result,exe_weighting FROM $tbl_track_exercice WHERE exe_cours_id = '".$a_course['code']."'"; $result_moy_test = Database::query($sql_moy_test); $result = 0; $weighting = 0; while ($moy_test = Database::fetch_array($result_moy_test)) { $result = $result + $moy_test['exe_result']; $weighting = $weighting + $moy_test['exe_weighting'];
<?php $mysqli = new mysqli("localhost", "skostyukovich", "mansion471", "u95648_instat"); if (mysqli_connect_errno()) { echo "Подключение невозможно: " . mysqli_connect_error(); } $mysqli->set_charset('utf8'); function export_csv($table, $afields, $filename, $delim = ',', $enclosed = '"', $escaped = '\\', $lineend = '\\r\\n') { $q_export = "SELECT " . implode(',', $afields) . " INTO OUTFILE '" . $_SERVER['DOCUMENT_ROOT'] . $filename . "' " . "FIELDS TERMINATED BY '" . $delim . "' ENCLOSED BY '" . $enclosed . "' " . " ESCAPED BY '" . $escaped . "' " . "LINES TERMINATED BY '" . $lineend . "' " . "FROM " . $table; // Если файл существует, при экспорте будет выдана ошибка if (file_exists($_SERVER['DOCUMENT_ROOT'] . $filename)) { unlink($_SERVER['DOCUMENT_ROOT'] . $filename); } return mysql_query($q_export); } $table = "request"; $afields = array('authorization', 'source', 'goal'); $filename = "file3.csv"; var_dump(export_csv($table, $afields, $filename, $delim = ',', $enclosed = '"', $escaped = '\\', $lineend = '\\r\\n'));
exit("Ошибка " . mysql_error()); } if (mysql_num_rows($kar)) { $fd = fopen('../files/' . $file_name, "w"); $header = array('id', 'iditem', 'name', 'space1', 'space2', 'price', 'manufected', 'category', 'keywords', 'image', 'vip', 'levl', 'public', 'chpu', 'h1', 'title', 'description', 'rating', 'share', 'view'); fputcsv($fd, $header, $delimiter = ';'); while ($kart = mysql_fetch_array($kar)) { $query = "SELECT name FROM manufekted WHERE id='" . $kart['manufekted'] . "'"; $result = mysql_query($query); $res = mysql_fetch_row($result); $query = "SELECT name FROM catecory WHERE id='" . $kart['category'] . "'"; $result = mysql_query($query); $res1 = mysql_fetch_row($result); // перекодировка и запись в файл для того что бы читалось в exel $order = mb_convert_encoding(str_replace('"', ' ', $kart['id']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding($kart['iditem'], "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['name']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding('', "Windows-1251", "UTF-8") . ";" . mb_convert_encoding('', "Windows-1251", "UTF-8") . ";" . mb_convert_encoding($kart['price'], "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $res[0]), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $res1[0]), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['keywords']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['image']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['vip']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['levl']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['publick']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['chpu']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['h1']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['title']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['description']), "Windows-1251", "UTF-8") . ";" . mb_convert_encoding(str_replace($search, ' ', $kart['rating']), "Windows-1251", "UTF-8") . ";" . str_replace($search, ' ', $kart['share']) . ";" . str_replace($search, ' ', $kart['view']) . "\r\n"; fwrite($fd, $order); } fclose($fd); } return 1; } $db = mysql_connect("localhost", "garantma_user", "crKAyqBMMaEq"); mysql_select_db("garantma_db", $db); //$db=mysql_connect("localhost", "root", ""); //mysql_select_db("garantmarket", $db); $afields[] = 'name'; $afields[] = 'id'; $f_name = 'garant-' . date('dmY_G.i') . '.csv'; if (export_csv($f_name)) { echo $f_name; }
echo '<tr><th>' . get_lang('LastName') . '</th><th>' . get_lang('FirstName') . '</th><th>' . get_lang('Email') . '</th></tr>'; } } } else { $css_class = "row_even"; } $i++; if (api_is_western_name_order()) { echo "<tr class=" . $css_class . "><td>{$firstname}</td><td>{$lastname}</td><td><a href='mailto:" . $email . "'>{$email}</a></td></tr>"; } else { echo "<tr class=" . $css_class . "><td>{$lastname}</td><td>{$firstname}</td><td><a href='mailto:" . $email . "'>{$email}</a></td></tr>"; } if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) { $data[$user_id]["firstname"] = $firstname; $data[$user_id]["lastname"] = $lastname; } else { $data[$user_id]["lastname"] = $lastname; $data[$user_id]["firstname"] = $firstname; } $data[$user_id]["email"] = $email; } } else { // No results echo '<tr><td colspan="3">' . get_lang('NoResults') . '</td></tr>'; } echo '</table>'; if (isset($_POST['export'])) { export_csv($header, $data, 'administrators.csv'); } echo "\n <br /><br />\n <form method='post' action='admin.php'>\n <button type='submit' class='save' name='export' value='" . get_lang('ExportExcel') . "'>\n " . get_lang('ExportExcel') . "\n </button>\n <form>\n"; Display::display_footer();
break; } $tempRe .= $uItem['DEST_IP'] . "(" . $uItem['TOTALBYTES'] . "MB) "; $i++; } } $item['REMARKS'] = $tempRe; foreach ($userLoginTimes as $tItem) { if ($uname == $tItem['VPN_USER']) { $item['TOTALTIME'] = $tItem['TIMES']; break; } } } $list = array_reverse($list); export_csv($list); function export_csv($list) { $filename = date('YmdHis') . ".csv"; //文件名 header("Content-type:text/csv"); header("Content-Disposition:attachment;filename=" . $filename); header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); header('Expires:0'); header('Pragma:public'); echo array_to_string($list); } function array_to_string($result) { $data = i('用户名,时长(分钟),流入(MB),流出(MB),总流量(MB),主要流量分布' . "\n"); //栏目名称
function lzwg_output() { $awardtype = I('award_type'); $uid = $map['uid'] = $this->mid; if ($awardtype == 2 || $awardtype == 1) { if ($awardtype == 2) { $awardtype = 0; } $award_ids = D('sport_award')->where(array('award_type' => $awardtype, 'uid' => $uid))->getFields('id'); $award_ids = implode(',', $award_ids); if (!empty($award_ids)) { $map['award_id'] = array('exp', ' in (' . $award_ids . ') '); } else { $map['award_id'] = 0; } } $search = I('search'); if ($search) { $this->assign('search', $search); $map1['name'] = array('like', '%' . htmlspecialchars($search) . '%'); $map1['uid'] = $uid; $award_ids = D('sport_award')->where($map1)->getFields('id'); $award_ids = implode(',', $award_ids); $map2['truename'] = array('like', '%' . htmlspecialchars($search) . '%'); $map3['mobile'] = array('like', '%' . htmlspecialchars($search) . '%'); $mobile_follow_ids = $truename_follow_ids = D('user')->where($map2)->getFields('uid'); $truename_follow_ids = implode(',', $truename_follow_ids); $mobile_follow_ids = implode(',', $mobile_follow_ids); if (!empty($award_ids)) { $map['award_id'] = array('exp', ' in (' . $award_ids . ') '); } else { if (!empty($truename_follow_ids)) { $map['follow_id'] = array('exp', ' in (' . $truename_follow_ids . ') '); } else { if (!empty($mobile_follow_ids)) { $map['follow_id'] = array('exp', ' in (' . $mobile_follow_ids . ') '); } else { $map['id'] = 0; } } } } $awardid = I('award'); if ($awardid) { $map['award_id'] = $awardid; } if (I('lzwg_id')) { $map['draw_id'] = I('lzwg_id'); } empty($map) || session('common_condition', $map); $list_data['list_data'] = M('lucky_follow')->field('id')->where($map)->select(); // $type = I ( 'type' ); // $flag = I ( 'flag' ); $dao = D('LuckyFollow'); foreach ($list_data['list_data'] as $vo) { $dd = $dao->getLzwgLuckyFollowInfo($vo['id']); $datas['nickname2'] = $dd['nickname2']; $datas['mobile'] = $dd['mobile']; $datas['truename'] = $dd['truename']; $datas['award_id'] = $dd['award_id']; $datas['sport_id'] = $dd['sport_id']; $datas['zjtime'] = time_format($dd['zjtime']); $datas['djtime'] = time_format($dd['djtime']); // $datas ['drum_count'] = $dd ['drum_count']; $allDatas[] = $datas; } $fieldArr = array('nickname2' => '昵称', 'mobile' => '手机号', 'truename' => '姓名', 'award_id' => '中奖奖品', 'sport_id' => '中奖活动', 'zjtime' => '中奖时间', 'djtime' => '兑奖时间'); foreach ($fieldArr as $k => $vv) { $fields[] = $k; $titleArr[] = $vv; } $dataArr[] = $titleArr; foreach ($allDatas as $v) { $dataArr[] = $v; } vendor('out-csv'); export_csv($dataArr, 'LuckyFollow_lzwg_output'); }
$pname .= $pinfo->fields['products_name'] . '×' . $pinfo->fields['products_quantity'] . ';'; $pnum += $pinfo->fields['products_quantity']; $pinfo->MoveNext(); } } $rs[$i]['pname'] = trim(str_replace('"', '', $pname), ';'); $rs[$i]['pnum'] = $pnum; $new_cid = max($new_cid, $result->fields['customers_id']); $new_oid = max($new_oid, $result->fields['orders_id']); $result->MoveNext(); $i++; } //print_r($rs); $csv_str = array_to_string($rs); if (!empty($_REQUEST['export'])) { export_csv($csv_str); //导出后记录当前cid和oid $new_cid = !empty($new_cid) ? intval($new_cid) : 0; $new_oid = !empty($new_oid) ? intval($new_oid) : 0; cache_write($cache_file, array('cid' => $new_cid, 'oid' => $new_oid, 'ptime' => time())); exit; } elseif (!empty($_REQUEST['json'])) { //json格式输出用于通过接口获取 echo json_encode($rs); exit; } elseif (!empty($_REQUEST['uplogo'])) { //更新日志 $new_cid = !empty($new_cid) ? intval($new_cid) : 0; $new_oid = !empty($new_oid) ? intval($new_oid) : 0; cache_write($cache_file, array('cid' => $new_cid, 'oid' => $new_oid, 'ptime' => time())); } else {
<td>' . $lastname . '</td><td>' . $firstname . '</td> <td>' . $s_connection_time . '</td> <td> <a href="course.php?type=coach&user_id=' . $id_coach . '"> <img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a></td> <td> <a href="student.php?type=coach&user_id=' . $id_coach . '"> <img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a> </td> </tr>'; } if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) { $data[$id_coach]["firstname"] = $firstname; $data[$id_coach]["lastname"] = $lastname; } else { $data[$id_coach]["lastname"] = $lastname; $data[$id_coach]["firstname"] = $firstname; } $data[$id_coach]["connection_time"] = $s_connection_time; } } else { // No results echo '<tr><td colspan="5">' . get_lang("NoResult") . '</td></tr>'; } echo '</table>'; if (isset($_POST['export'])) { export_csv($header, $data, 'coaches.csv'); } echo "<br /><br />"; echo "<form method='post' action='coaches.php'>\n <button type='submit' class='save' name='export' value='" . get_lang('exportExcel') . "'>" . get_lang('exportExcel') . "</button><form>"; Display::display_footer();
<?php // Special for export CSV, we don't want to send any data yet! if ($_GET[action] == 'export_report') { export_csv(); exit; } include_once "sessionCheck.php"; //control bar, $_GET['mode'] is used to determine if this site is in Ajax mode, if it is don't repeat functionalities that are already executed without AJAX if (!isset($_GET['mode'])) { include "controlBar.php"; } ?> <div id="main"> <h1 id="mainTitle">Event Management</h1> <script type="text/javascript" src="js/modal-message.js"></script> <script type="text/javascript" src="js/ajax-dynamic-content.js"></script> <?php include_once 'classes/EdittingTools.php'; include_once 'classes/Property.php'; include_once 'classes/Form.php'; include_once 'classes/Event.php'; include_once 'classes/RRD.php'; include_once 'classes/Property.php'; include_once 'classes/Check.php'; //Make a new contact, a new tool bar, and a new form $tool = new EdittingTools(); $form = new Form("auto", 3); $status_array = array(0 => "Ok", 1 => "Warning", 2 => "Critical", 3 => "Unknown");
public function outExcel($dataArr, $fileName = '', $sheet = false) { require_once VENDOR_PATH . 'download-xlsx.php'; export_csv($dataArr, $fileName, $sheet); unset($sheet); unset($dataArr); }
function show_summary($base, &$results, $csv_file) { $total_time = 0.0; foreach ($results as $test => $time) { $total_time += $time; } if ($total_time <= 0.0) { die('Not enough iterations, please try with more.' . "\n"); } $percentile_times = array(); foreach ($results as $test => $time) { $percentile_times[$test] = $time * 100.0 / $total_time; } $score = (double) $base * 10.0 / $total_time; if (function_exists('php_uname')) { echo 'System : ' . php_uname() . "\n"; } if (function_exists('phpversion')) { echo 'PHP version: ' . phpversion() . "\n"; } echo 'PHPBench : ' . PHPBENCH_VERSION . "\n" . 'Date : ' . date('F j, Y, g:i a') . "\n" . 'Tests : ' . count($results) . "\n" . 'Iterations : ' . $base . "\n" . 'Total time : ' . round($total_time) . ' seconds' . "\n" . 'Score : ' . round($score) . ' (higher is better)' . "\n"; if ($csv_file !== FALSE) { export_csv($csv_file, $results, $percentile_times); } }