Location: PHPKode > projects > ERPSOD > erpsod/exp_userlogs.php
<?PHP
include_once("config.php");
$ok=role_check();
if (!$ok){
	header("Location: login.php"); 
}
$sql=" select username, loggedin from userlog order by username,loggedin";
$result = mysql_query($sql) or die(mysql_error());
// Put the name of all fields
$out  = "Username";
$out .= ",";
$out .= "Date";
$out .="\n";
// Add all values in the table
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
	$out .= trim("$row[0]") ;
	$out .= ",";
	$out .= trim("$row[1]");
	$out .="\n";
}
// Output to browser
header('Content-type: text/richtext');
header("Content-Disposition: attachment; filename=userlogs_exported.csv");
echo $out;
Return current item: ERPSOD