reset ($_POST);
while (list ($key, $val) = each ($_POST)) {
${$key} =$val;
}
while (list ($key,$val) = each ($_GET)) {
${$key} =$val;
}
mysql_connect("localhost","labellos","ZIG-ZAG");
if (isset($umkreis))
{
echo "
Ergebnisse für Postleitzahl: $plz Umkreis: $distance km";
$anfrage = "SELECT loc_id
FROM `geodb_textdata` where text_val=\"$plz\" limit 1";
$result=mysql_db_query("labellos",$anfrage);
$row=mysql_fetch_row($result);
if (empty($row))
{
echo "Bitte gib eine richtige Postleitzahl an!";
die;
}
$id= $row[0];
$anfrage="SELECT c.text_val, acos( sin( PI( ) * ( b.lat ) /180 ) * sin( PI( ) * ( a.lat ) /180 ) + cos( PI( ) * ( b.lat ) /180 ) * cos( PI( ) * ( a.lat ) /180 ) * cos( PI( ) * ( b.lon ) /180 - PI( ) * ( a.lon ) /180 ) ) *6380 as entfernung
FROM geodb_coordinates a, geodb_coordinates b, geodb_textdata c
WHERE a.loc_id = $id
AND acos( sin( PI( ) * ( b.lat ) /180 ) * sin( PI( ) * ( a.lat ) /180 ) + cos( PI( ) * ( b.lat ) /180 ) * cos( PI( ) * ( a.lat ) /180 ) * cos( PI( ) * ( b.lon ) /180 - PI( ) * ( a.lon ) /180 ) ) *6380 <=$distance
AND b.loc_id = c.loc_id
AND c.text_type =500300000 group by c.text_val";
$result=mysql_db_query("labellos",$anfrage);
echo "
";
$i=0;
$date=time();
while ($row=mysql_fetch_array($result))
{
$plz2 = $row[0];
$entfernung = round($row[1],2);
$anfrage2 = "select b.gigcal_gigs_id,a.bandname, b.gigdate , c.venuename, b.gigcal_bands_id
from jos_gigcal_bands a, jos_gigcal_gigs b, jos_gigcal_venues c where c.zip=$plz2
and c.gigcal_venues_id = b.gigcal_venues_id
and b.gigdate>$date and a.gigcal_bands_id=b.gigcal_bands_id";
$result2=mysql_db_query("labellos",$anfrage2);
while ($row2=mysql_fetch_array($result2))
{
$id=$row2[0];
$bandname2=$row2[1];
$ort=$row2[3];
$date2= $row2[2];
$bandid= $row2[4];
$data[] = array('id' => $id, 'name' => $bandname2 ,'ort'=>$ort, 'date' => $date2, 'entfernung'=>$entfernung, 'bandid'=>$bandid);
$i++;
}
$s++;
}
if (!isset($sort))
{
$sort="date";
$dir ="asc";
}
$feldname = $sort;
// Dann alles wie gehabt:
foreach($data as $id => $datensatz) {
$test[$id] = $datensatz[$feldname];
}
if ($dir=="asc")
asort($test);
else
arsort($test);
echo "";
echo "$name | ";
echo "$date2 | ";
echo "$ort | ";
$addlink="index.php?option=com_gigcal&task=details&gigcal_gigs_id=$id";
echo "Info | ";
echo "$entfernung km | ";
echo "
";
}
echo "
";
}
elseif (isset($band))
{
$anfrage ="select bandname from jos_gigcal_bands where gigcal_bands_id=$id";
$result=mysql_db_query("labellos",$anfrage);
$row=mysql_fetch_array($result);
echo "Ergebnisse für $row[0]";
$date=time();
$anfrage2 = "select b.gigcal_gigs_id,a.bandname, b.gigdate ,c.venuename from jos_gigcal_bands a, jos_gigcal_gigs b, jos_gigcal_venues c where a.gigcal_bands_id=$id and c.gigcal_venues_id = b.gigcal_venues_id and b.gigdate>$date and a.gigcal_bands_id=b.gigcal_bands_id";
$result2=mysql_db_query("labellos",$anfrage2);
echo "
";
while ($row2=mysql_fetch_array($result2))
{
$id=$row2[0];
echo "";
echo "$row2[1] | ";
$date2 = date("d.m.Y", $row2[2]);
echo "$date2 | ";
echo "$row2[3] | ";
$addlink="index.php?option=com_gigcal&task=details&gigcal_gigs_id=$id&Itemid=32";
echo "Info | ";
echo "
";
}
echo "
";
}
elseif (isset($band2))
{
echo "Ergebnisse für $name";
$date=time();
$anfrage2 = "select b.gigcal_gigs_id,a.bandname, b.gigdate ,c.venuename from jos_gigcal_bands a, jos_gigcal_gigs b, jos_gigcal_venues c where a.bandname LIKE '%$name%' and c.gigcal_venues_id = b.gigcal_venues_id and b.gigdate>$date and a.gigcal_bands_id=b.gigcal_bands_id";
$result2=mysql_db_query("labellos",$anfrage2);
echo "
";
while ($row2=mysql_fetch_array($result2))
{
$id=$row2[0];
echo "";
echo "$row2[1] | ";
$date2 = date("d.m.Y", $row2[2]);
echo "$date2 | ";
echo "$row2[3] | ";
$addlink="index.php?option=com_gigcal&task=details&gigcal_gigs_id=$id&Itemid=32";
echo "Info | ";
echo "
";
}
echo "
";
}
else
{
echo "Konzertsuche nach Umkreis
";
echo "Gib hier Deine PLZ und den gewünschten Umkreis (Luftlinie) ein, dann werden Dir alle Konzerte und Festivals
in diesem Umkreis angezeigt.
";
echo "";
// $anfrage= "select gigcal_bands_id,bandname from jos_gigcal_bands order by bandname";
// $anfrage ="SELECT count(jos_gigcal_bands.gigcal_bands_id)
// FROM jos_gigcal_bands
// LEFT JOIN content_festivals ON jos_gigcal_bands.bandname = content_festivals.name
// WHERE content_festivals.name IS NULL";
$anfrage ="SELECT jos_gigcal_bands.gigcal_bands_id,jos_gigcal_bands.bandname
FROM jos_gigcal_bands
LEFT JOIN content_festivals ON jos_gigcal_bands.bandname = content_festivals.name
WHERE content_festivals.name IS NULL ORDER BY jos_gigcal_bands.bandname";
$result=mysql_db_query("labellos",$anfrage);
echo "Konzertsuche nach Bands
";
echo "Hier kannst du nach Bandnamen suchen und bekommst alle Konzerte und Festivals dieser Band angezeigt.
";
echo "Du kannst die Band entweder über das Dropdownfeld auswählen oder direkt im unteren Feld eingeben.
";
echo "";
echo "
";
echo "";
echo "
";
}
?>