예제 #1
0
 /**
  * Endpoint to export basic user data along with all custom fields into CSV.
  */
 public function utilityController_exportProfiles_create($sender)
 {
     // Clear our ability to do this.
     $sender->permission('Garden.Settings.Manage');
     if (Gdn::userModel()->pastUserMegaThreshold()) {
         throw new Gdn_UserException('You have too many users to export automatically.');
     }
     // Determine profile fields we need to add.
     $fields = $this->getProfileFields();
     $columnNames = array('Name', 'Email', 'Joined', 'Last Seen', 'Discussions', 'Comments', 'Points');
     // Set up our basic query.
     Gdn::sql()->select('u.Name')->select('u.Email')->select('u.DateInserted')->select('u.DateLastActive')->select('u.CountDiscussions')->select('u.CountComments')->select('u.Points')->from('User u')->where('u.Deleted', 0)->where('u.Admin <', 2);
     if (val('DateOfBirth', $fields)) {
         $columnNames[] = 'Birthday';
         Gdn::sql()->select('u.DateOfBirth');
         unset($fields['DateOfBirth']);
     }
     $i = 0;
     foreach ($fields as $slug => $fieldData) {
         // Add this field to the output
         $columnNames[] = val('Label', $fieldData, $slug);
         // Add this field to the query.
         Gdn::sql()->join('UserMeta a' . $i, "u.UserID = a{$i}.UserID and a{$i}.Name = 'Profile.{$slug}'", 'left')->select('a' . $i . '.Value', '', $slug);
         $i++;
     }
     // Get our user data.
     $users = Gdn::sql()->get()->resultArray();
     // Serve a CSV of the results.
     exportCSV($columnNames, $users);
     die;
     // Useful for query debug.
     //$sender->render('blank');
 }
예제 #2
0
<?php

if ($_POST) {
    exportCSV($_POST);
}
function exportCSV($data)
{
    $string = $data['data'];
    $file = fopen('csv/' . $data['filename'], 'w');
    fwrite($file, $string);
    fclose($file);
    echo 'success';
}
<?php

// *******************************************************
// consumerLoanCSVexport.php
// Version 1.0
// Date: 2015-12-15
// *******************************************************
require_once 'config.php';
require_once 'companyExportData.php';
$product = 'Wells Fargo';
$strsql = SQL_WF;
exportCSV($strsql, $product);
// +----------------------------------------------------------------------+
// | Authors: Programmer<*****@*****.**>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
include "../includes/config.php";
include "../includes/session.php";
include "../classes/cls_CSV.php";
include "../includes/functions.php";
if (isset($_GET["dload"]) and $_GET["dload"] != '') {
    exportCSV($_GET["id"]);
    exit;
}
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if (isset($_SESSION["sess_artistid"]) and $_SESSION["sess_artistid"] != "") {
    $artistid = $_SESSION["sess_artistid"];
} else {
    header("Location:login.php");
    exit;
}
$currencycode = getSellerCurrencySybol($artistid);
$currencySymbol = getCurrencySybol($currencycode);
예제 #5
0
});
/*
Third:
Rainfall in the world of any weatherstation of the current day
(from the current time till 00:00, going back)
*/
$app->get('/rainfall/:station', authenticateUser(), function ($station) use($app) {
    $export = isset($_GET['export']) ? $_GET['export'] : false;
    $conn = Connection::getInstance();
    $query = "\n            SELECT time, prcp\n            FROM measurements\n            WHERE stn = {$station}\n            AND date = '" . date("Y-m-d") . "'\n            ORDER BY time ASC";
    if ($export == "true") {
        $stmt = $conn->db->prepare("Select name from stations where stn = :stn");
        $stmt->execute([':stn' => $station]);
        $res = $stmt->fetchAll();
        $name = $station;
        if (count($res) > 0) {
            $name = $res[0]['name'];
        }
        $headerArray = array('time', 'Prcp');
        $filename = "Rainfall_{$name}_" . date("Y-m-d");
        exportCSV($query, $headerArray, $filename);
    } else {
        $statement = $conn->db->prepare($query);
        $statement->execute();
        $results = $statement->fetchAll(PDO::FETCH_ASSOC);
        $app->response->headers->set('Content-Type', 'application/json');
        $json = json_encode($results);
        echo $json;
    }
});
$app->run();
예제 #6
0
 logger("Running report: {$rgQuery}");
 $result = mysql_query($rgQuery) or die("Invalid Query: " . mysql_error());
 $num_fields = mysql_num_fields($result);
 while ($row = mysql_fetch_assoc($result)) {
     $array[] = $row;
 }
 $_CONDS = putConditionsBack($rptAction, $rgDefault, $query, $USR_DATERANGE, $SAVED_CLAUSE, $selAction, $selHost, $selVolume, $selUser, $selPrinter);
 $summary = putSummary($_CONDS, $currDate, $rptAction, $rptName);
 $toPrint = true;
 if ($rptAction == 'mailhtml' || $rptAction == 'mailcsv') {
     $toPrint = false;
 }
 if (isset($rptAction) && ($rptAction == 'exportcsv' || $rptAction == 'mailcsv')) {
     $selMailFormat = "CSV";
     // Print CSV output to be dumped into a hidden IFRAME
     $rgOutput = exportCSV($toPrint, $array, $rptName);
 } else {
     if (isset($rptAction) && ($rptAction == 'exporthtml' || $rptAction == 'preview' || $rptAction == 'print' || $rptAction == 'mailhtml')) {
         $selMailFormat = "HTML";
         logger("Temlate - {$selTemplate}");
         // Print HTML output to be dumped into a new window
         $rgOutput = exportHTML($toPrint, $array, $rptAction, $selSummary, $rptName, $summary, $selTemplate);
     } else {
         // Print Tabularized output for formatting later - see ULTRA COOL in filter.js
         resultTable($toPrint, $array, $rptAction);
     }
 }
 if ($rptAction == 'mailhtml' || $rptAction == 'mailcsv') {
     if ($servername == "") {
         $servername = $_SERVER['SERVERNAME'];
     }
예제 #7
0
<?php

// B to B Export
$btob = filter_input(INPUT_POST, 'B', FILTER_SANITIZE_STRING);
$btobZip = filter_input(INPUT_POST, 'zip', FILTER_SANITIZE_STRING);
if ($btob === 'B to B Export') {
    if ($btobZip !== false) {
        exportCSV($db, "B", $btobZip);
    } else {
        exportCSV($db, "B");
    }
    unset($_POST);
    exit;
}
// B to C Export
$btoc = filter_input(INPUT_POST, 'C', FILTER_SANITIZE_STRING);
$btocZip = filter_input(INPUT_POST, 'zip', FILTER_SANITIZE_STRING);
if ($btoc === 'B to C Export') {
    if ($btocZip !== false) {
        exportCSV($db, "C", $btocZip);
    } else {
        exportCSV($db, "C");
    }
    unset($_POST);
    exit;
}
예제 #8
0
        transferInventory($_POST, $dbh);
        break;
    case 'findWineByUPC':
        findWineByUPC($_POST, $dbh);
        break;
    case 'summaryByUPC':
        summaryByUPC($_POST, $dbh);
        break;
    case 'completeInventory':
        completeInventory($_POST, $dbh);
        break;
    case 'exportPDF':
        exportPDF($_POST, $dbh);
        break;
    case 'exportCSV':
        exportCSV($_POST, $dbh);
        break;
}
function addWine($arr, $dbh)
{
    $wine = new Wine($dbh);
    if ($arr['upc'] != '' && $arr['name'] != '' && $arr['sell_price'] != '' && $arr['cost'] != '' && $arr['type'] != '') {
        if (!$wine->fetchWineByUPC($arr['upc'])) {
            if ($arr['sell_price'] <= 0 || $arr['cost'] <= 0) {
                die('Cost and Selling Price must be greater than zero');
            }
            $wine->setUPC($arr['upc']);
            $wine->setName($arr['name']);
            $wine->setType($arr['type']);
            $wine->setVintage($arr['vintage']);
            $wine->setSellPrice($arr['sell_price']);