$th = "../tulokset";
$dbhost = "localhost";
$dbname = "jouniaaltonenfi";
$dbuser = "jouni";
$dbpass = "ebollah";
$taulu_alku = "tulokset_";
include("/usr/local/share/tuloskone/controller/funktioita.php");
include("/usr/local/share/tuloskone/model/mysql.php");
if ( isset($_GET[kisa]) ) {
$sql = "select nimi,otsikko from $taulu_alku"."kisat where nimi='$_GET[kisa]' order by aika desc";
} else {
$sql = "select nimi,otsikko from $taulu_alku"."kisat order by aika desc";
}
$result = mysql_kysely($sql);
print mysql_error();
$kisat = array();
while ( $kisa = mysql_fetch_array( $result ) ) {
$sql = "select MAX(osa_lkm) from $taulu_alku"."sarjat where kisan_nimi='$kisa[nimi]'";
//print $sql;
$res = mysql_kysely($sql);
print mysql_error();
$s = mysql_fetch_array($res);
print mysql_error();
//pa($s);
if ( $s[0] > 1 ) {
for ( $p = 1 ; $p <= $s[0] ; ++$p ) {
$tied = $th."/ographapplet_$kisa[nimi]"."_$p.txt";
//print $tied."
";
if ( file_exists($tied) ) {
$kisat[] = array( "name" => $kisa[otsikko]." $p. päivä",
"file" => $tied );
}
}
} else {
$tied = $th."/ographapplet_$kisa[nimi].txt";
//print $tied."
";
if ( file_exists($tied) ) {
$kisat[] = array( "name" => $kisa[otsikko],
"file" => $tied );
}
}
}
?>