function getNearestAirport($ort, $land) { $ort = ucfirst($ort); $ab = "SELECT * FROM Flughafen WHERE INSTR(ort, '{$ort}') > 0"; $res = mysql_query($ab); if (mysql_num_rows($res) != 0) { $flughafen = array(); $strecke = array(); $count = 0; while ($airport = mysql_fetch_object($res)) { $strecke[$count] = getDistance($ort, "airport " . $airport->id); $flughafen[$count] = $airport->ort; // echo $strecke[$count]."-->".$flughafen[$count]; $count++; } $min = getNearest($strecke); return array(getFlughafenIDByOrt($flughafen[$min]), $strecke[getNearest($strecke)]); } $ab = "SELECT * From Flughafen WHERE land_id='{$land}'"; $res = mysql_query($ab); $flughafen = array(); $strecke = array(); $count = 0; while ($airport = mysql_fetch_object($res)) { $strecke[$count] = getDistance($ort, $airport->id); $flughafen[$count] = $airport->ort; $count++; } $min = getNearest($strecke); return array(getFlughafenIDByOrt($flughafen[$min]), $strecke[getNearest($strecke)]); }
mysql_query("SET NAMES 'utf8'"); $larray = array("id", "Marke", "Modell", "Farbe", "Plätze", "Türen", "Kraftstoff", "Verbrauch", "Schaltung", "PS", "km", "Flughafen", "Vermieter", "Preis"); if (!isset($_SESSION["username"])) { header('Location: ../login.php'); } //Prüft, ob Session-User admin ist validateSession("../konto.php"); $greet = $_SESSION["username"]; if (isset($_POST["submit"])) { ftpupload($_FILES["autopic"]["tmp_name"], AUTO_DIR, getHotelBild($_POST['0'])); $_POST["3"] = str_replace("#", "", $_POST["3"]); $ab = "INSERT INTO Auto VALUES ("; $ab .= "'" . $_POST["0"] . "'"; for ($i = 1; $i < 14; $i++) { if ($i == 11) { $ab .= ", '" . getFlughafenIDByOrt($_POST[$i]) . "'"; } else { $ab .= ", '" . $_POST[$i] . "'"; } } $ab .= ");"; // echo $ab; mysql_query($ab); } //Tabellenübersicht erzeugen function addTableData() { $abfrage = "SELECT * FROM Auto"; $ergebnis = mysql_query($abfrage); $tabledata = ""; if (mysql_num_rows($ergebnis) == 0) {
validateSession("../admin/autos.php"); $larray = array("id", "Marke", "Modell", "Farbe", "Plätze", "Türen", "Kraftstoff", "Verbrauch", "Schaltung", "PS", "km", "Flughafen", "Vermieter", "Preis"); $valarray = array(); for ($i = 0; $i < 14; $i++) { $valarray[$i] = $_GET[$i]; } $id = $_GET['0']; if (isset($_POST['submit'])) { if ($id == "") { $id = $_POST["0"]; } if ($_FILES["autopic"]["tmp_name"] != "") { ftpupload($_FILES["autopic"]["tmp_name"], AUTO_DIR, getHotelBild($_POST['0'])); } $farbe = str_replace("#", "", $_POST["3"]); $abfrage = "UPDATE Auto SET\n\t\t\t\tid='" . $_POST["0"] . "',\n\t\t\t\tmarke='" . $_POST["1"] . "',\n\t\t\t\tmodell='" . $_POST["2"] . "',\n\t\t\t\tfarbe='" . $farbe . "',\n\t\t\t\tplatzzahl='" . $_POST["4"] . "',\n\t\t\t\ttüren='" . $_POST["5"] . "',\n\t\t\t\tkraftstoff='" . $_POST["6"] . "',\n\t\t\t\tverbrauch='" . $_POST["7"] . "',\n\t\t\t\tschaltung='" . $_POST["8"] . "',\n\t\t\t\tps='" . $_POST["9"] . "',\n\t\t\t\tkm='" . $_POST["10"] . "',\n\t\t\t\tflughafen_id='" . getFlughafenIDByOrt($_POST["11"]) . "',\n\t\t\t\tvermieter_id='" . $_POST["12"] . "',\n\t\t\t\tpreis='" . $_POST["13"] . "'\n\t\t\t\tWHERE id='" . $id . "'"; // echo $abfrage; mysql_query($abfrage); header('Location: ../admin/autos.php'); } ?> <html> <head> <link rel="stylesheet" type="text/css" href="../css/dialog.css"> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style> input.feld { padding: 5px; width: 150px;
require "mysql_config.php"; mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to MySQL server.'); mysql_select_db(DB_DATABASE); mysql_query("SET NAMES 'utf8'"); $urlArray = array("flug", "hotel", "auto", "von", "nach", "an", "ab", "zimmer", "kinder", "erwachsene"); if ($_POST['login']) { header('Location: login.php'); } if (isset($_POST['submit'])) { $goto = "suchen.php?seite=hotel"; //?flug=" . $_POST["flug"] . "&hotel=" . $_POST["hotel"] . "&auto=" . $_POST["auto"] . "&von=" . getFlughafenIDByOrt($_POST["von"]) . "&nach=" . getFlughafenIDByOrt($_POST["nach"]) . "&an=" . $_POST["an"] . "&ab=" . $_POST["ab"] . "&zimmer=" . $_POST["zimmer"] . "&kinder=" . $_POST["kinder"] . "&erwachsene=" . $_POST["erwachsene"]; foreach ($urlArray as &$val) { $_SESSION["suchen"][$val] = $_POST[$val]; } $_SESSION["suchen"]["von"] = getFlughafenIDByOrt($_POST["von"]); $_SESSION["suchen"]["nach"] = getFlughafenIDByOrt($_POST["nach"]); if ($_POST["auto"] != "on") { $_SESSION["auto"] = "skip"; } if ($_POST["hotel"] == "on") { $_SESSION["hotel"] = ""; header("Location: suchen.php?seite=hotel"); } else { $_SESSION["hotel"] = "skip"; header("Location: suchen.php?seite=flug"); } // print_r($_SESSION["suchen"]["hotel"]=="on"); // header("Location: " . $goto); } function genLogin() {