function addHotelData() { $ab = "SELECT DISTINCT * FROM Zimmerbuchung JOIN Hotel ON hotelid=Hotel.id WHERE personenid='" . $_SESSION["username"] . "'\n\t\t\tGROUP BY hotelid ORDER BY Hotel.name"; $res = mysql_query($ab); // echo $ab; if (mysql_num_rows($res) == 0) { echo "keine Daten verfügbar"; } else { while ($hotel = mysql_fetch_object($res)) { $belegung = getBelegteZimmerZahl($hotel->id, TRUE) . "/" . $hotel->zimmerzahl; echo '<div class="hotel"> <div class="hotelBildDiv"> <img id="hotelBild" src="images/hotels/' . getHotelBild($hotel->name) . '" /> </div> <div class="hotelBeschreibungDiv"> <div class="hotelBeschreibung"> <div class="hotelHeader"> <div class="hotelName">' . $hotel->name . '</div> <div class="sterndiv">' . addSterne($hotel->sterne, "images/") . '</div> </div> <div class="adresseDiv"> <div class="adresse">' . $hotel->strasse . '</div> <div class="adresse">' . $hotel->ort . '</div> <div class="adresse">' . getLandNameByISO($hotel->land) . ' ' . getFlagByFlughafenID($hotel->naherFlughafen) . '</div> </div> <div class="naherFlughafen"> Naher Flughafen:</br> ' . getFlughafenOrtByID($hotel->naherFlughafen) . ' (' . $hotel->naherFlughafen . ') </div> <div class="belegung"> Zimmerbelegung:</br> ' . $belegung . ' </div> </div> </div> </div>'; } } }
function addTableData() { $abfrage = "SELECT * FROM Hotel"; $ergebnis = mysql_query($abfrage); if (mysql_num_rows($ergebnis) == 0) { echo "keine Daten vorhanden"; } while ($row = mysql_fetch_row($ergebnis)) { //Land besorgen $ab = "SELECT * FROM Countries WHERE iso2='" . $row[6] . "'"; $land = mysql_fetch_object(mysql_query($ab)); //Zimmerbuchungen besorgen $ab1 = "SELECT * FROM Zimmerbuchung WHERE hotelid='" . $row[0] . "' AND von<'" . date("Y-m-d H:i:s") . "' AND bis>'" . date("Y-m-d H:i:s") . "'"; $zimmer = mysql_num_rows(mysql_query($ab1)); $zimmer = !$zimmer ? "0" : $zimmer; $hotelname = getHotelNameByID($row[0]); //Tabellenzeile einfügen echo "<tr>"; echo '<td><div class="box"> <p class"hover">' . $row[0] . '</p> <div class="mask"><img class="minipic" src="../images/hotels/' . getHotelBild($hotelname) . '" width="250" height="270" border="0" alt=' . $hotelname . '></div> </td>'; // echo "<td>" . $row[0] . "</td>"; echo '<td class="name">' . $row[1] . '<input type="button" class="showZimmer" value="Zimmer" onclick=\'window.location.href = "#' . $row[0] . '"\'/></td>'; echo "<td style='width:125px;'><p hidden>" . $row[2] . "</p>" . addSterne($row[2]) . "</td>"; echo '<td><span class="pie">' . $zimmer . '/' . $row[3] . '</span><br>' . $zimmer . '/' . $row[3] . '</td>'; echo "<td>" . $row[4] . "<br>" . $row[5] . "<br>" . $land->country . "<img src='../images/flags/" . strtolower($row[6]) . ".png'></td>"; $flughafen = getDistance($row[4] . " " . $row[5], "airport " . $row[8]); echo "<td>" . getOrtAndFlag($row[8]) . "<br>" . $flughafen . " km</td>"; echo "<td><a href='" . $row[7] . "'>Link</a></td>"; echo "<td><a href='../phpdata/hotelAendern.php?"; echo addEditList($row[0], "Hotel"); echo "#openModal'><img src='../images/edit.png' class='bin'></td>"; echo "<td><a href='../phpdata/hotelLoeschen.php?id=" . $row[0] . "'><img src='../images/loeschen.png' class='bin'></td>"; echo "</tr>"; } }
function addAutoBild($hotelname) { // echo file_exists("../images/autos/".getHotelBild($hotelname)); if (file_exists("../images/autos/" . getHotelBild($hotelname))) { // echo "../images/hotels/".getHotelBild($hotelname); return "<img class='autoBild' src='/design2/images/autos/" . getHotelBild($hotelname) . "'>"; } }
require "mysqlinit.php"; require "getLists.php"; init(); 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>
validateSession("../admin/hotels.php"); for ($i = 0; $i < 8; $i++) { if ($i == 6) { $valarray[$i] = getLandNameByISO($_GET["6"]); } else { $valarray[$i] = $_GET[$i]; } } $id = $_GET['0']; if (isset($_POST['submit'])) { if ($id == "") { $id = $_POST["0"]; } // echo $_FILES["hotelpic"]["tmp_name"]; if ($_FILES["hotelpic"]["tmp_name"] != "") { ftpupload($_FILES["hotelpic"]["tmp_name"], HOTEL_DIR, getHotelBild($_POST['1'])); } $nearAirport = getNearestAirport($_POST["5"], getLandISOByName($_POST["6"])); $abfrage = "UPDATE Hotel SET\n\t\t\t\tid='{$id}', \n\t\t\t\tname='" . $_POST["1"] . "',\n\t\t\t\tsterne='" . $_POST["2"] . "',\n\t\t\t\tzimmerzahl='" . $_POST["3"] . "',\n\t\t\t\tstrasse='" . $_POST["4"] . "',\n\t\t\t\tort='" . $_POST["5"] . "',\n\t\t\t\tland='" . getLandISOByName($_POST["6"]) . "',\n\t\t\t\thomepage='" . $_POST["7"] . "',\n\t\t\t\tnaherFlughafen='" . $nearAirport[0] . "'\n\t\t\t\tWHERE id='" . $id . "'"; // echo var_dump($nearAirport); // echo $abfrage; mysql_query($abfrage); header('Location: ../admin/hotels.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" />
function genHotel($id, $button = TRUE, $versorgung = null) { $ab2 = "SELECT * FROM Hotel WHERE id='{$id}'"; $res = mysql_query($ab2); $hotel = mysql_fetch_object($res); $belegung = getBelegteZimmerZahl($hotel->id) . "/" . $hotel->zimmerzahl; $frei = $hotel->zimmerzahl - mysql_num_rows($res); $dist = getDistance($hotel->strasse . "" . $hotel->ort, "airport " . $hotel->naherFlughafen); $preis = $button ? "ab " . getHotelPreis($hotel->id, null, 0, TRUE) : $_SESSION["preis"]["hotel"]; // <input class="selectzimmer' . $hotel -> zimmerid . '" Name = "selectzimmer[' . $hotel -> zimmerid . ']" // onclick="toggle_visibility_class(\'$selectzimmer' . $hotel -> zimmerid . '\')" value="Zimmer"> $onclick = "toggle_visibility('zimmer" . $hotel->id . "');"; $select = $button ? '<input id="suchen" type="button" onclick="' . $onclick . '" name = "selecthotel[' . $id . ']" value="Zimmer">' : ''; echo '<div class="hotel' . ($button ? "" : 2) . '"> <div class="hotelBildDiv"> <img id="hotelBild" src="images/hotels/' . getHotelBild($hotel->name) . '" /> </div> <div class="hotelBeschreibungDiv"> <div class="hotelBeschreibung"> <div class="hotelHeader"> <div class="hotelName">' . $hotel->name . ' (<a href="' . $hotel->homepage . '" target="_blank">info</a>) </div> <div class="sterndiv">' . addSterne($hotel->sterne, "images/") . '</div> </div> <div class="belegung"> freie Zimmer: ' . $frei . ' </div> <div class="adresseDiv"> <div class="adresse">' . $hotel->strasse . '</div> <div class="adresse">' . $hotel->ort . '</div> <div class="adresse">' . getLandNameByISO($hotel->land) . ' ' . getFlagByFlughafenID($hotel->naherFlughafen) . '</div> </div> <div class="naherFlughafen"> Nächster Flughafen:</br> ' . getFlughafenOrtByID($hotel->naherFlughafen) . ' (' . $hotel->naherFlughafen . '): ' . $dist . ' km </div> <div class="hotelPreis"> ' . $preis . ' € </div> ' . $select . ' </div> </div> </div>'; }