73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?php
|
|
set_time_limit(1800); # 30 minut
|
|
|
|
/**
|
|
* 1.8.2017
|
|
* Analiziramo useragent string za vse veljavne respondente in izpisemo v datoteko
|
|
* za KATJO ZRIM
|
|
*/
|
|
|
|
include_once('../../function.php');
|
|
|
|
|
|
// Limit je po defaultu 1000 da ne traja predolgo
|
|
$limit = (isset($_GET['limit'])) ? $_GET['limit'] : 100;
|
|
$year = '2017';
|
|
|
|
// Gledamo respondente
|
|
$sql = sisplet_query("SELECT id, useragent, time_insert, last_status, lurker
|
|
FROM srv_user
|
|
WHERE testdata='0' AND preview='0' AND deleted='0'
|
|
AND YEAR(time_insert)=".$year."
|
|
ORDER BY rand()
|
|
LIMIT 500000
|
|
");
|
|
if (!$sql) {echo mysqli_error($GLOBALS['connect_db']); die();}
|
|
|
|
|
|
$data = array();
|
|
$data[] = array('Tip naprave', 'Čas vnosa', 'Status', 'Lurker');
|
|
|
|
while ($row = mysqli_fetch_array($sql)) {
|
|
|
|
ob_start();
|
|
|
|
$line = array();
|
|
|
|
$browser_detect = get_browser($row['useragent'], true);
|
|
$line[0] = $browser_detect['device_type'];
|
|
$line[1] = $row['time_insert'];
|
|
$line[2] = $row['last_status'];
|
|
$line[3] = $row['lurker'];
|
|
|
|
$data[] = $line;
|
|
|
|
echo implode($line, ';');
|
|
echo '<br />';
|
|
|
|
ob_end_flush();
|
|
}
|
|
|
|
|
|
|
|
/*header('Content-Type: application/excel');
|
|
header('Content-Disposition: attachment; filename="paradata_device_'.$year.'.csv"');
|
|
|
|
$fp = fopen('php://output', 'w');
|
|
foreach($data as $line) {
|
|
//fputcsv($fp, $line, ',');
|
|
fputcsv($fp, $line, ';');
|
|
}
|
|
fclose($fp);*/
|
|
|
|
|
|
|
|
/*foreach($data as $line) {
|
|
echo implode($line, ';');
|
|
echo '<br />';
|
|
}*/
|
|
|
|
|
|
|
|
|
|
?>
|