<%args>
$reqkey=>undef
</%args>
<%init>
my $dbh = $m->comp("/_shared/procs/utils/dbi_connect.m", database=>'guianet');
my ($id, $filename) = $dbh->selectrow_array("select id,filename from tdownloads where reqkey='$reqkey'");
return undef unless $id; # record must exist
if ($filename){
	$dbh->do("update tdownloads set lastrequest=NOW() where id=$id");
}else{
	$filename = $m->comp("newfilename.m",id=>$id,reqkey=>$reqkey);
} 
return $filename;
</%init>
