<?php
//error_reporting(E_ALL ^ E_DEPRECATED); ini_set('display_errors', 1);

// Cookie Simon löschen ;-)
setcookie("werchzueglade","",time() - 3600);

session_start();
include('script/variablen.php');
include('connect.php');

if ( $_SERVER['HTTP_HOST'] == "www.makita-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "makita-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.makita-schweiz.ch/hauptrubrik.php?marke=1");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.bosch-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "bosch-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.bosch-schweiz.ch/hauptrubrik.php?marke=2");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.flex-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "flex-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.flex-schweiz.ch/hauptrubrik.php?marke=5");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.collomix-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "collomix-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.collomix-schweiz.ch/hauptrubrik.php?marke=6");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.hikoki-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "hikoki-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.hikoki-schweiz.ch/hauptrubrik.php?marke=8");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.metabo-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "metabo-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.metabo-schweiz.ch/hauptrubrik.php?marke=10");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.panasonic-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "panasonic-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.panasonic-schweiz.ch/hauptrubrik.php?marke=14");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.jet-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "jet-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.jet-schweiz.ch/hauptrubrik.php?marke=28");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.jet-handwerkzeug.ch" OR $_SERVER['HTTP_HOST'] == "jet-handwerkzeug.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.jet-handwerkzeug.ch/hauptrubrik.php?marke=31");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.technocraft-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "technocraft-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.technocraft-schweiz.ch/hauptrubrik.php?marke=15");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.pro-fit-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "pro-fit-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.pro-fit-schweiz.ch/hauptrubrik.php?marke=34");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.eibenstock-schweiz.ch" OR $_SERVER['HTTP_HOST'] == "eibenstock-schweiz.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.eibenstock-schweiz.ch/hauptrubrik.php?marke=42");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.amb-elektrik.ch" OR $_SERVER['HTTP_HOST'] == "amb-elektrik.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.amb-elektrik.ch/hauptrubrik.php?marke=45");
header("Connection: close");
}
elseif ( $_SERVER['HTTP_HOST'] == "www.ewo-life.ch" OR $_SERVER['HTTP_HOST'] == "ewo-life.ch" )
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.ewo-life.ch/hauptrubrik.php?marke=47");
header("Connection: close");
}

	// Seit wie vielen Jahren
	$fux_seit = strtotime('1990-06-01');

	$dateStart = new DateTime();
	$dateStart->setTimestamp($fux_seit);
	$dateNow = new DateTime();

	$seit_jahre = $dateStart->diff($dateNow);
?>
<!DOCTYPE html>
<html lang="de-CH">
<head>

<?php include('page_meta.php'); ?>

	<title>Fux Elektrowerkzeuge GmbH, Rümlingen - Die Metabo Vertretung</title>

<?php include('page_css.php'); ?>

<?php include('page_script_top.php'); ?>

</head>

<?php
// WENN Cookie Admin aktiv
if ( !empty($_COOKIE["administrator"]) == 1 )
{
	echo '<body class="admin">'."\n";
}
else
{
	echo '<body oncontextmenu="return false">'."\n";
}

include('page_header.php'); ?>

<div id="content">

<section>

	<h1 id="index_h1">Fux Elektrowerkzeuge GmbH, Rümlingen</h1>

	<article>
	<div class="box_center">Seit <?php echo $seit_jahre->y; ?> Jahren Ihr kompetenter und fairer Partner für Ihr neues oder reparaturbedürftiges Elektrowerkzeug</div><br>

<?php
include('page_infotext.php');
include('page_ferien.php');
include('page_banner.php');

// S kein Black
$result_black = mysqli_query($dbi,"SELECT titel FROM black WHERE black_von <= '$datum' AND black_bis >= '$datum'");
if ( mysqli_num_rows($result_black) == 0 )
{
echo '		<a href="black_fuxday_specials.php" class="navi titel rahmen rahmen_ohne_bottom rund_oben" id="index_black_alle_top">Fux Specials</a>
			<div class="index_black_box rahmen rund_unten">';

	$result_special = mysqli_query($dbi,"SELECT nummer, produkt, preis, rabatt FROM produkte WHERE special='1' AND bild='1' ORDER BY RAND() LIMIT 12");

	echo '<div class="owl-special owl-carousel owl-theme">'."\n";

			while($row = mysqli_fetch_assoc($result_special)) {

			echo '				<div class="index_black_produkt_box"><a href="produkt.php?produkt='.$row['nummer'].'"><div class="navi_sehr_klein index_black_titel">'.$row['produkt'].'</div><img src="images/produkte/neuheit/'.$row['nummer'].'.jpg?'.filemtime('images/produkte/neuheit/'.$row['nummer'].'.jpg').'" alt="'.$row['produkt'].'" width="263" height="263"/><div class="navi_sehr_klein index_black_preis">';
			
			$prozent = $row['rabatt'];
			$rabatt = $row['preis'] / 100 * $prozent;
			$preis = $row['preis'] - $rabatt;

			if ( $preis != $row['preis'] )
			{
				echo ''.number_format(round($preis, 0), 2, '.', "'").' statt '.number_format(round($row['preis']), 2, '.', "'").'';
			}
			else
			{
				echo number_format(round($preis, 0), 2, '.', "'");
			}
			echo '</div></a></div>'."\n";
			}

	echo '			</div>
		</div>
		<a href="black_fuxday_specials.php" class="navi titel rahmen rahmen_ohne_top rund_unten abstand_bottom" id="index_black_alle"><div class="shake_2">Alle Fux Specials anzeigen</div></a>';
}
// E kein Black

// S Black Special
if ( mysqli_num_rows($result_black) == 1 )
{
$row_black_titel = $result_black->fetch_assoc();

echo '		<a href="black_fuxday_specials.php" class="navi titel rahmen rahmen_ohne_bottom rund_oben" id="index_black_alle_top">'.$row_black_titel['titel'].'</a>
			<div class="index_black_box rahmen">';

	$result_special = mysqli_query($dbi,"SELECT nummer, produkt, preis, black_rabatt, black_stk FROM produkte WHERE black='1' AND black_stk!='0' AND bild='1' ORDER BY RAND() LIMIT 12");

	echo '<div class="owl-special owl-carousel owl-theme">'."\n";

			while($row = mysqli_fetch_assoc($result_special)) {

			echo '				<div class="index_black_box_produkt"><a href="produkt.php?produkt='.$row['nummer'].'"><div class="navi_sehr_klein index_black_titel">'.$row['produkt'].'</div><img src="images/produkte/neuheit/'.$row['nummer'].'.jpg?'.filemtime('images/produkte/neuheit/'.$row['nummer'].'.jpg').'" alt="'.$row['produkt'].'" width="263" height="263"/><div class="navi_sehr_klein index_black_preis">';
			
			$prozent = $row['black_rabatt'];
			$rabatt = $row['preis'] / 100 * $prozent;
			$preis = $row['preis'] - $rabatt;

			echo ''.number_format(round($preis, 0), 2, '.', "'").' statt '.number_format(round($row['preis']), 2, '.', "'").'</div></a></div>'."\n";
			}

	echo '			</div>
		</div>
		<a href="black_fuxday_specials.php" class="navi titel rahmen rahmen_ohne_top rund_unten abstand_bottom" id="index_black_alle"><div class="shake_2">Alle '.$row_black_titel['titel'].' anzeigen</div></a>';
}
// E Black Special
?>

	<div id="index_box_div">
		<a href="exklusiv_bei_fux.php" class="angebot_box rahmen rund">
				<picture>
					<source srcset="images/angebot_exklusiv_bei_fux.avif"/>
					<img src="images/angebot_exklusiv_bei_fux.jpg" width="268" height="268" alt="Exklusiv bei Fux Elektrowerkzeuge GmbH Bild"/>
				</picture>
			<div class="angebot_box_text angebot_effect">Exklusiv bei Fux Elektrowerkzeuge GmbH</div>
		</a>

		<a href="aktionen_kataloge.php" class="angebot_box rahmen rund">
				<picture>
					<source srcset="images/angebot_aktionen_kataloge.avif"/>
					<img src="images/angebot_aktionen_kataloge.jpg" width="268" height="268" alt="Aktionen & Kataloge Bild"/>
				</picture>
			<div class="angebot_box_text angebot_effect">Aktionen & Kataloge</div>
		</a>

		<a href="liquidationen_occasionen_demos.php" class="angebot_box rahmen rund">
				<picture>
					<source srcset="images/angebot_liquidationen_occasionen_demos.avif"/>
					<img src="images/angebot_liquidationen_occasionen_demos.jpg" width="268" height="268" alt="Liquidationen & Occasionen & Demos Bild"/>
				</picture>
			<div class="angebot_box_text angebot_effect">Liquidationen & Occasionen & Demos</div>
		</a>
	</div>

	<div class="hg_gruen rund">
		<div class="titel_home center">Neuheiten</div>
		<div class="owl-home owl-carousel owl-theme">
			<?php
			$result_neu = mysqli_query($dbi,"SELECT p.nummer, p.marke, p.unterrubrik, p.unterrubrik_1, p.produkt, p.art, p.volt, p.kurz, p.hauptrubrik, p.unterrubrik, p.neu, p.aktion, p.preis, p.rabatt, p.mit_akku, p.occ, p.occ_2, p.special, p.exklusiv, p.akku_typ, p.akku_typ_1, p.cas, p.koffer, p.black, p.black_rabatt, p.black_stk, p.preissperre, p.made, p.expert, m.marke AS markenname
			FROM produkte p LEFT JOIN marken m ON p.marke = m.nummer
			WHERE ( p.neu='1' AND p.art!='4' AND p.art!='8' AND STR_TO_DATE(p.eingetragen, '%Y-%m-%d %H:%i:%s') < DATE_SUB(NOW(), INTERVAL 5 MINUTE) ) OR ( p.neu='1' AND p.art='4' AND p.preis > 80 AND STR_TO_DATE(p.eingetragen, '%Y-%m-%d %H:%i:%s') < DATE_SUB(NOW(), INTERVAL 5 MINUTE) ) 
			ORDER BY p.nummer DESC LIMIT 30");

			// Prüfen ob Black aktiv
			$result_black = mysqli_query($dbi,"SELECT black_von FROM black WHERE black_von <= '$datum' AND black_bis >= '$datum'");

			while($row = mysqli_fetch_assoc($result_neu)) {
				include('produkte_layout_last.php');
			}
			?>
		</div>
		<div class="positionieren">
			<div class="alle center"><a href="neuheiten.php">Alle Neuheiten<br>anzeigen</a></div>
		</div>
		<div class="abstand_owl clear"></div>
	</div>
	<div class="abstand clear"></div>

	<div class="navi titel rund_oben">Stellen Sie Ihr Set online zusammen!</div>
	<div id="box_set" class="rahmen rund_unten">
		<a href="set_metabo_auswahl.php" class="angebot_box angebot_box_set rahmen rund">
				<picture>
					<source srcset="marken/metabo/metabo_pick_und_mix.avif"/>
					<img src="marken/metabo/metabo_pick_und_mix.jpg" width="268" height="268" alt="Metabo Pick+Mix Bild"/>
				</picture>
			<div class="angebot_box_text angebot_effect">Metabo Pick+Mix</div>
		</a>

		<a href="set_makita_auswahl.php" class="angebot_box angebot_box_set rahmen rund">
				<picture>
					<source srcset="marken/makita/makita_systemkit.avif"/>
					<img src="marken/makita/makita_systemkit.jpg" width="268" height="268" alt="Makita SystemKIT Bild"/>
				</picture>
			<div class="angebot_box_text angebot_effect">Makita SystemKIT</div>
		</a>
		<a href="set_flex.php" class="angebot_box angebot_box_set rahmen rund">
				<picture>
					<source srcset="marken/flex/flex_pack.avif"/>
					<img src="marken/flex/flex_pack.jpg" width="268" height="268" alt="Flex Pack Bild"/>
				</picture>
			<div class="angebot_box_text angebot_effect">Flex Pack</div>
		</a>
	</div>

	<div class="hg_gruen rund">
		<div class="titel_home center">Beliebte Produkte</div>
		<div class="owl-last owl-carousel owl-theme">
			<?php
			$result_neu = mysqli_query($dbi,"SELECT COUNT(op.produkt) AS stueck, p.nummer, p.marke, p.unterrubrik, p.unterrubrik_1, p.produkt, p.art, p.volt, p.kurz, p.hauptrubrik, p.unterrubrik, p.neu, p.aktion, p.preis, p.rabatt, p.mit_akku, p.occ, p.occ_2, p.special, p.exklusiv, p.akku_typ, p.akku_typ_1, p.cas, p.koffer, p.black, p.black_rabatt, p.black_stk, p.preissperre, p.made, p.expert, m.marke AS markenname
			FROM order_produkt op 
			LEFT JOIN produkte p ON op.produkt = p.nummer
			LEFT JOIN marken m ON p.marke = m.nummer
			WHERE p.nummer != '' AND p.preis > 70 AND STR_TO_DATE(op.datum, '%Y-%m-%d %H:%i:%s') < DATE_SUB(NOW(), INTERVAL 24 HOUR)
			GROUP BY op.produkt
			ORDER BY stueck DESC LIMIT 30");
			
			while($row = mysqli_fetch_assoc($result_neu)) {
				$produkt[] = $row;
			}
			shuffle($produkt);
			foreach ($produkt as $produkte => $row)
			{
					include('produkte_layout_last.php');
			}
			?>
		</div>
		<div class="abstand_owl clear"></div>
	</div>
	<div class="abstand clear"></div>
		
<?php include('page_oeffnungszeiten.php'); ?>

<?php include('page_vorteile.php'); ?>
	</article>

<?php include('page_last.php'); ?>

</section>

</div>

<?php include('page_footer.php'); ?>

<?php
// Unbestellte Einträge in Warenkorb löschen
$result_delete_order = mysqli_query($dbi,"DELETE FROM order_produkt WHERE status='0' AND (TO_DAYS(NOW()) - TO_DAYS(datum)) > 1");
?>

<?php include('page_script_bottom.php'); ?>

</body>
</html>