function displayReservations() { $res = MyDB::getInstance()->getResults('SELECT R.*, S.cislo_stolu FROM rezervace R JOIN stoly S ON R.id_stolu = S.id ORDER BY R.datum DESC'); $result = ''; foreach ($res as $v) { $result .= '<tr> <td>' . strenc_topage($v['jmeno']) . '</td> <td>' . $v['cislo_stolu'] . '</td> <td>' . $v['pocet_lidi_u_stolu'] . '</td> <td>' . $v['datum'] . '</td> <td>' . $v['stav'] . '</td> <td> <a href="rezervace.php?action=zrusit&id=' . $v['id'] . '"><img src="images/cross.png"></a> <a href="rezervace.php?action=potvrdit&id=' . $v['id'] . '"><img src="images/accept.png"></a> </td> </tr>'; } return $result; }
function getFood() { $res = MyDB::getInstance()->getResults('SELECT * FROM kategorie ORDER BY nazev'); $result = ''; foreach ($res as $v) { $result .= '<optgroup label="' . strenc_topage($v['nazev']) . '">'; $res2 = MyDB::getInstance()->getResults('SELECT * FROM jidelni_listek WHERE viditelnost = 1 AND id_kategorie = ' . $v['id']); foreach ($res2 as $v2) { $result .= '<option value="' . $v2['id'] . '">' . strenc_topage($v2['nazev']) . '</option>'; } $result .= '</optgroup>'; } return $result; }
} $doc = new DomDocument(); $file = realpath(XMLDB_USERS); if ($file && $doc->load($file)) { $xpath = new DomXPath($doc); $query = @"//user[@login='******' and " . "normalize-space()='{$upwd}']"; $pwd_list = $xpath->query($query); if ($pwd_list->length == 1) { $pwd_item = $pwd_list->item(0); $login = $xpath->query('@login', $pwd_item)->item(0)->value; $role = $xpath->query('@role', $pwd_item)->item(0)->value; $name = $xpath->query('@name', $pwd_item)->item(0)->value; $surname = $xpath->query('@surname', $pwd_item)->item(0)->value; $company = $xpath->query('@company', $pwd_item)->item(0)->value; assert('$login'); assert('$role'); strenc_topage($name); strenc_topage($surname); strenc_topage($company); session_regenerate_id(true); $_SESSION['user'] = $login; $_SESSION['role'] = $role; $_SESSION['name'] = $name; $_SESSION['surname'] = $surname; $_SESSION['company'] = $company; } } } } header('Location: index.php'); exit;