Files
wachter/inhalte/objekte.php

249 lines
8.5 KiB
PHP

<?php
if ( !isset ( $_GET['topic'] ) )
{
echo "<h1>Unsere Immobilienangebote!</h1>\n";
// Wohnungen zur Miete
$sql_wm = "SELECT * FROM objekte WHERE KAT = 'wohnen' AND O_TYP = 'Wohnung' AND V_TYP = 'Miete' AND Aktiv = '1' AND Deaktiv = '0' ORDER BY RAND();";
$result_wm = $db->query ( $sql_wm );
$anz_wm = $result_wm->num_rows;
$pic = false;
if ( '0' != $anz_wm )
{
echo "<div class=\"haupt\">\n";
while ( $nt_wm = $result_wm->fetch_assoc() )
{
if ( file_exists ( 'img/objekte/' . $nt_wm['ID'] . '_1.jpg' ) )
{
$image_info = getimagesize ( 'img/objekte/' . $nt_wm['ID'] . '_1.jpg' );
if ( $image_info[0] > $image_info[1] )
{
echo " <a href=\"index.php?section=immobilien&topic=wohnung_miete\"><img style=\"float:left; margin-right:20px;\" src=\"img/objekte/" . $nt_wm['ID'] . "_1.jpg\" width=\"100\" /></a>\n";
$pic = true;
break;
}
}
}
if ( !$pic )
{
echo " <div style=\"width:120px;height:75px;float:left;\">&nbsp;</div>\n";
}
echo " <a href=\"index.php?section=immobilien&topic=wohnung_miete\"><h2>Wohnungen zur Miete</h2></a>\n";
if ( '1' == $anz_wm )
{
echo " <a href=\"index.php?section=immobilien&topic=wohnung_miete\">Zur Zeit haben wir eine Wohnung im Angebot.</a>\n";
}
else
{
echo " <a href=\"index.php?section=immobilien&topic=wohnung_miete\">Zur Zeit haben wir " . $anz_wm . " Wohnungen im Angebot.</a>\n";
}
echo "<br style=\"clear:both;line-height:1px;height:1px;\" />\n";
echo "</div>\n";
}
// Ende Wohnungen zur Miete
// Wohnungen zum Kauf
$sql_wk = "SELECT * FROM objekte WHERE KAT = 'wohnen' AND O_TYP = 'Wohnung' AND V_TYP = 'Kauf' AND Aktiv = '1' AND Deaktiv = '0' ORDER BY RAND();";
$result_wk = $db->query ( $sql_wk );
$anz_wk = $result_wk->num_rows;
$pic = false;
if ( '0' != $anz_wk )
{
echo "<div class=\"haupt\">\n";
while ( $nt_wk = $result_wk->fetch_assoc() )
{
if ( file_exists ( 'img/objekte/' . $nt_wk['ID'] . '_1.jpg' ) )
{
$image_info = getimagesize ( 'img/objekte/' . $nt_wk['ID'] . '_1.jpg' );
if ( $image_info[0] > $image_info[1] )
{
echo " <a href=\"index.php?section=immobilien&topic=wohnung_kauf\"><img style=\"float:left; margin-right:20px;\" src=\"img/objekte/" . $nt_wk['ID'] . "_1.jpg\" width=\"100\" /></a>\n";
$pic = true;
break;
}
}
}
if ( !$pic )
{
echo " <div style=\"width:120px;height:75px;float:left;\">&nbsp;</div>\n";
}
echo " <a href=\"index.php?section=immobilien&topic=wohnung_kauf\"><h2>Wohnungen zum Kauf</h2></a>\n";
if ( '1' == $anz_wk )
{
echo " <a href=\"index.php?section=immobilien&topic=wohnung_kauf\">Zur Zeit haben wir eine Wohnung im Angebot.</a>\n";
}
else
{
echo " <a href=\"index.php?section=immobilien&topic=wohnung_kauf\">Zur Zeit haben wir " . $anz_wk . " Wohnungen im Angebot.</a>\n";
}
echo "<br style=\"clear:both;\" />\n";
echo "</div>\n";
}
// Ende Wohnungen zum Kauf
// Häuser zur Miete
$sql_hm = "SELECT * FROM objekte WHERE KAT = 'wohnen' AND O_TYP = 'Haus' AND V_TYP = 'Miete' AND Aktiv = '1' AND Deaktiv = '0' ORDER BY RAND();";
$result_hm = $db->query ( $sql_hm );
$anz_hm = $result_hm->num_rows;
$pic = false;
if ( '0' != $anz_hm )
{
echo "<div class=\"haupt\">\n";
while ( $nt_hm = $result_hm->fetch_assoc() )
{
if ( file_exists ( 'img/objekte/' . $nt_hm['ID'] . '_1.jpg' ) )
{
$image_info = getimagesize ( 'img/objekte/' . $nt_hm['ID'] . '_1.jpg' );
if ( $image_info[0] > $image_info[1] )
{
echo " <a href=\"index.php?section=immobilien&topic=haus_miete\"><img style=\"float:left; margin-right:20px;\" src=\"img/objekte/" . $nt_hm['ID'] . "_1.jpg\" width=\"100\" /></a>\n";
$pic = true;
break;
}
}
}
if ( !$pic )
{
echo " <div style=\"width:120px;height:75px;float:left;\">&nbsp;</div>\n";
}
echo " <a href=\"index.php?section=immobilien&topic=haus_miete\"><h2>Häuser zur Miete</h2></a>\n";
if ( '1' == $anz_hm )
{
echo " <a href=\"index.php?section=immobilien&topic=haus_miete\">Zur Zeit haben wir ein Haus im Angebot.</a>\n";
}
else
{
echo " <a href=\"index.php?section=immobilien&topic=haus_miete\">Zur Zeit haben wir " . $anz_hm . " Häuser im Angebot.</a>\n";
}
echo "<br style=\"clear:both;\" />\n";
echo "</div>\n";
}
// Ende Häuser zur Miete
// Häuser zum Kauf
$sql_hk = "SELECT * FROM objekte WHERE KAT = 'wohnen' AND O_TYP = 'Haus' AND V_TYP = 'Kauf' AND Aktiv = '1' AND Deaktiv = '0' ORDER BY RAND();";
$result_hk = $db->query ( $sql_hk );
$anz_hk = $result_hk->num_rows;
$pic = false;
if ( '0' != $anz_hk )
{
echo "<div class=\"haupt\">\n";
while ( $nt_hk = $result_hk->fetch_assoc() )
{
if ( file_exists ( 'img/objekte/' . $nt_hk['ID'] . '_1.jpg' ) )
{
$image_info = getimagesize ( 'img/objekte/' . $nt_hk['ID'] . '_1.jpg' );
if ( $image_info[0] > $image_info[1] )
{
echo " <a href=\"index.php?section=immobilien&topic=haus_kauf\"><img style=\"float:left; margin-right:20px;\" src=\"img/objekte/" . $nt_hk['ID'] . "_1.jpg\" width=\"100\" /></a>\n";
$pic = true;
break;
}
}
}
if ( !$pic )
{
echo " <div style=\"width:120px;height:75px;float:left;\">&nbsp;</div>\n";
}
echo " <a href=\"index.php?section=immobilien&topic=haus_kauf\"><h2>Häuser zum Kauf</h2></a>\n";
if ( '1' == $anz_hk )
{
echo " <a href=\"index.php?section=immobilien&topic=haus_kauf\">Zur Zeit haben wir ein Haus im Angebot.</a>\n";
}
else
{
echo " <a href=\"index.php?section=immobilien&topic=haus_kauf\">Zur Zeit haben wir " . $anz_hk . " Häuser im Angebot.</a>\n";
}
echo "<br style=\"clear:both;\" />\n";
echo "</div>\n";
}
// Ende Häuser zum Kauf
// Sonstige Objekte
$sql_so = "SELECT * FROM objekte WHERE KAT != 'wohnen' AND Aktiv = '1' AND Deaktiv = '0' ORDER BY RAND();";
$result_so = $db->query ( $sql_so );
$anz_so = $result_so->num_rows;
$pic = false;
if ( '0' != $anz_so )
{
echo "<div class=\"haupt\">\n";
while ( $nt_so = $result_so->fetch_assoc() )
{
if ( file_exists ( 'img/objekte/' . $nt_so['ID'] . '_1.jpg' ) )
{
$image_info = getimagesize ( 'img/objekte/' . $nt_hk['ID'] . '_1.jpg' );
if ( $image_info[0] > $image_info[1] )
{
echo " <a href=\"index.php?section=immobilien&topic=sonstige_objekte\"><img style=\"float:left; margin-right:20px;\" src=\"img/objekte/" . $nt_so['ID'] . "_1.jpg\" width=\"100\" /></a>\n";
$pic = true;
break;
}
}
}
if ( !$pic )
{
echo " <div style=\"width:120px;height:75px;float:left;\">&nbsp;</div>\n";
}
echo " <a href=\"index.php?section=immobilien&topic=sonstige_objekte\"><h2>Sonstige Objekte</h2></a>\n";
if ( '1' == $anz_so )
{
echo " <a href=\"index.php?section=immobilien&topic=sonstige_objekte\">Zur Zeit haben wir ein Objekt im Angebot.</a>\n";
}
else
{
echo " <a href=\"index.php?section=immobilien&topic=sonstige_objekte\">Zur Zeit haben wir " . $anz_so . " Objekte im Angebot.</a>\n";
}
echo "<br style=\"clear:both;line-height:1px;height:1px;\" />\n";
echo "</div>\n";
echo "<br style=\"clear:both;line-height:50px;height:50px;\" />\n";
}
// Ende Sonstige Objekte
}
else
{
if ( 'wohnung_miete' == $_GET['topic'] )
{
include 'inhalte/wohn/wm.php';
}
elseif ( 'wohnung_kauf' == $_GET['topic'] )
{
include 'inhalte/wohn/wk.php';
}
elseif ( 'haus_miete' == $_GET['topic'] )
{
include 'inhalte/wohn/hm.php';
}
elseif ( 'haus_kauf' == $_GET['topic'] )
{
include 'inhalte/wohn/hk.php';
}
elseif ( 'sonstige_objekte' == $_GET['topic'] )
{
include 'inhalte/sonstige/overview.php';
}
elseif ( 'gewerbe_kauf' == $_GET['topic'] )
{
include 'inhalte/gewerbe/kauf.php';
}
elseif ( 'gewerbe_miete' == $_GET['topic'] )
{
include 'inhalte/gewerbe/miete.php';
}
elseif ( 'anlage' == $_GET['topic'] )
{
include 'inhalte/sonstige/anlage.php';
}
}
?>