Ejemplo n.º 1
0
getpost_ifset(array ( 'var_export', 'var_export_type' ));

if (strlen($var_export) == 0) {
	$var_export = 'pr_sql_export';
}


#  Set the parameters: SQL Query, hostname, databasename, dbuser and password
$dumpfile = new iam_csvdump;

#  Call the CSV Dumping function and THAT'S IT!!!!  A file named dump.csv is sent to the user for download

if (strlen($_SESSION[$var_export]) < 10) {
	echo gettext("ERROR CSV EXPORT");
} else {
	$log = new Logger();
	if (strcmp($var_export_type, "type_csv") == 0) {
		$myfileName = "Dump_" . date("Y-m-d");
		$log->insertLog($_SESSION["admin_id"], 2, "FILE EXPORTED", "A File in CSV Format is exported by User, File Name= " . $myfileName . ".csv", '', $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'], '');
		$dumpfile->dump($_SESSION[$var_export], $myfileName, "csv", DBNAME, USER, PASS, HOST, DB_TYPE);
	}
	elseif (strcmp($var_export_type, "type_xml") == 0) {
		$myfileName = "Dump_" . date("Y-m-d");
		$log->insertLog($_SESSION["admin_id"], 2, "FILE EXPORTED", "A File in XML Format is exported by User, File Name= " . $myfileName . ".xml", '', $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'], '');
		$dumpfile->dump($_SESSION[$var_export], $myfileName, "xml", DBNAME, USER, PASS, HOST, DB_TYPE);
	}
	$log = null;
}

Ejemplo n.º 2
0
<?php

include_once dirname(__FILE__) . "/lib/defines.php";
include_once dirname(__FILE__) . "/lib/Class.Table.php";
include_once dirname(__FILE__) . "/lib/iam_csvdump.php";
session_start();
#  Set the parameters: SQL Query, hostname, databasename, dbuser and password                                       #
#####################################################################################################################
$dumpfile = new iam_csvdump();
#  Call the CSV Dumping function and THAT'S IT!!!!  A file named dump.csv is sent to the user for download          #
#####################################################################################################################
if (strlen($_SESSION["pr_sql_export"]) < 10) {
    echo "ERROR CSV EXPORT";
} else {
    //echo $_SESSION["pr_sql_export"];
    $dumpfile->dump($_SESSION["pr_sql_export"], "Report_cdr_" . date("Y-m-d"), "csv", DBNAME, USER, PASS, HOST, DB_TYPE);
    //$dumpfile->dump($_SESSION["pr_sql_export"], "", "csv", DBNAME, USER, PASS, HOST );
}
Ejemplo n.º 3
0
            array_push($export_fields, 'buyrate', 'buyrateinitblock', 'buyrateincrement', 'rateinitial', 'initblock', 'billingblock', 'connectcharge', 'disconnectcharge', 'stepchargea', 'chargea', 'timechargea', 'billingblocka', 'stepchargeb', 'chargeb', 'timechargeb', 'billingblockb', 'stepchargec', 'chargec', 'timechargec', 'billingblockc');
            $sql_str = str_dbparams($DBHandle, 'SELECT ' . implode(', ', $export_fields) . ' FROM cc_ratecard WHERE idtariffplan = %1;', array($id_tp));
            $log_str = "Ratecard #%0 exported in csv format, all fields in peer format";
            $myfileName = "Ratecard_" . $tp_id;
            $prolog = "# Export of tp #{$id_tp}\n";
            $prolog .= "#fields: " . implode(';', $export_fields) . "\n";
            break;
        default:
            echo "Wrong export style:" . $export_style . "\n<br>\n";
            die;
    }
    $myfileName .= date("Y-m-d");
    $log->insertLog($_SESSION["admin_id"], 2, "FILE EXPORTED", str_params($log_str, array($id_tp, $export_style)), '', $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'], '');
    $dumpfile->sep = ';';
    $dumpfile->prolog = $prolog;
    $dumpfile->dump($sql_str, $myfileName, "csv", DBNAME, USER, PASS, HOST, DB_TYPE);
    DBDisconnect($DBHandle);
    /*  if(strcmp($var_export_type,"type_csv")==0)
        {
    		$myfileName = "Dump_". date("Y-m-d");
    		$log -> insertLog($_SESSION["admin_id"], 2, "FILE EXPORTED", "A File in CSV Format is exported by User, File Name= ".$myfileName.".csv", '', $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'],'');
            $dumpfile->dump($_SESSION[$var_export], $myfileName, "csv", DBNAME, USER, PASS, HOST, DB_TYPE );
        }
        elseif(strcmp($var_export_type,"type_xml")==0)
        {
            $myfileName = "Dump_". date("Y-m-d");
    		$log -> insertLog($_SESSION["admin_id"], 2, "FILE EXPORTED", "A File in XML Format is exported by User, File Name= ".$myfileName.".xml", '', $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'],'');
    		$dumpfile->dump($_SESSION[$var_export], $myfileName, "xml", DBNAME, USER, PASS, HOST, DB_TYPE );
        }
    	$log = null;*/
}
<?php

include_once "common/iam_csvdump.php";
require_once 'functions.php';
$amp_conf = parse_amportal_conf("/etc/amportal.conf");
$dbhost = $amp_conf['AMPDBHOST'];
$dbname = $amp_conf['AMPDBNAME'];
$dbuser = $amp_conf['AMPDBUSER'];
$dbpw = $amp_conf['AMPDBPASS'];
$dumpfile = new iam_csvdump();
$query = "(select data from sip where keyword = 'callerid') UNION (select data from iax where keyword = 'callerid') UNION (select data from zap where keyword = 'callerid') ORDER BY data ASC";
$dumpfile->dump($query, "local_extensions_" . date("d-m-Y"), "csv", $dbname, $dbuser, $dbpw, $dbhost, "mysql");