<link rel="stylesheet" href="css/main.css" type="text/css" /> <script type="text/javascript" language="javascript"> </script> </head> <body> <h1>TCAT :: Export URLs</h1> <?php validate_all_variables(); $filename = get_filename_for_export('urlsExport'); $csv = new CSV($filename, $outputformat); $csv->writeheader(array('tweet_id', 'url', 'url_expanded', 'url_followed')); $sql = "SELECT t.id as id, u.url as url, u.url_expanded as url_expanded, u.url_followed as url_followed FROM " . $esc['mysql']['dataset'] . "_tweets t, " . $esc['mysql']['dataset'] . "_urls u "; $sql .= sqlSubset(); $sql .= " AND u.tweet_id = t.id ORDER BY id"; $sqlresults = mysql_unbuffered_query($sql); $out = ""; if ($sqlresults) { while ($data = mysql_fetch_assoc($sqlresults)) { $csv->newrow(); $csv->addfield($data['id'], 'integer'); $csv->addfield($data['url'], 'string'); if (isset($data['url_followed']) && strlen($data['url_followed']) > 1) { $csv->addfield($data['url'], 'string');
function get_file($what) { validate_all_variables(); // get filename (this also validates the data) global $database; $filename = get_filename_for_export($what); generate($what, $filename); // redirect to file $location = str_replace("index.php", "", ANALYSIS_URL) . filename_to_url($filename); if (defined('LOCATION')) { $location = LOCATION . $location; } header("Content-type: text/csv"); header("Location: {$location}"); }