function addModal($array, $edit, $valarray = null, $typ = null) { $count = 0; // if (!$edit) { // foreach ($array as &$val) { // if ($val == "Flughafen" || $val == "Land" || $val == "Hotel") { // echo '<input type="text" placeholder="' . $val . '" name="' . $count . '" list="' . strtolower($val) . '" autocomplete="off" '; // } elseif ($val == "Farbe") { // echo '<input type="color" style="padding:0px;height:25px" name="' . $count . '" value="#' . $valarray[$count] . '"'; // } elseif ($val == "Hotel1") { // echo '<input type="text" readonly="readonly" name="' . $count . '" value="'; echo getHotelNameByID($valarray[0]); echo '"'; // } else { // echo '<input type="text" placeholder="' . $val . '" name="' . $count . '" '; // } // $count++; // echo 'class="feld" /><br>'; // } // } else { foreach ($array as &$val) { echo $edit ? "<p class='row'>" . $val : ""; if ($val == "Land" || $val == "Hotel" || $val == "Versorgung") { echo '<input type="text" placeholder="' . $val . '" name="' . $count . '" list="' . strtolower($val) . '" value="' . $valarray[$count] . '" autocomplete="off"'; } elseif ($val == "Flughafen") { echo '<input type="text" placeholder="' . $val . '" name="' . $count . '" list="' . strtolower($val) . '" value="' . getFlughafenOrtByID($valarray[$count]) . '" autocomplete="off"'; } elseif ($val == "Farbe") { echo '<input type="color" style="padding:0px;height:25px" name="' . $count . '" value="#' . $valarray[$count] . '"'; } elseif ($val == "HOTEL") { echo '<input type="text" readonly="readonly" name="' . $count . '" value="' . getHotelNameByID($valarray[1]) . '"'; } elseif ($val == "Zimmer-ID") { echo '<input type="text" readonly="readonly" name="' . $count . '" value="' . $valarray[$count] . '"'; } elseif (strtolower($val) == "id" && $typ == "hotel") { echo '<input type="text" readonly="readonly" placeholder="' . $val . '" name="' . $count . '" value="' . $valarray[$count] . '"'; } else { echo '<input type="text" placeholder="' . $val . '" name="' . $count . '" list="' . strtolower($val) . '"value="' . $valarray[$count] . '"'; } echo "class='feld' />"; echo $edit ? "</p>" : ""; echo "</br>"; $count++; } // } }
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>"; } }
<?php require "../mysql_config.php"; require "getLists.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'"); validateSession("../admin/hotels.php"); $id = $_GET["0"]; $larray = array("Hotel1", "Quadratmeter", "Typ", "Bettenzahl", "Preisfaktor"); $valarray = array(getHotelNameByID($id)); if (isset($_POST["submit"])) { $ab = "INSERT INTO Zimmer (hotelid, quadratmeter, typ, bettenzahl, preisfaktor) VALUES (\n\t\t\t'" . getHotelIDByName($_POST["0"]) . "', \n\t\t\t'" . $_POST["1"] . "', \n\t\t\t'" . $_POST["2"] . "', \n\t\t\t'" . $_POST["3"] . "', \n\t\t\t'" . $_POST["4"] . "');"; // echo $ab; mysql_query($ab); header("Location: ../admin/hotels.php#" . getHotelIDByName($_POST["0"])); } ?> <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: 290px; margin-bottom: 5px; float: center; }