locomputing
bmenu.php Teil 1 
Menü auflisten
<?php
if (isset($_SESSION['id']) && $_SESSION['id']==1)
{
if($jumpi=='blind')
{
echo'<table class="table">';
echo'<tr>';
echo'<th colspan="3">Blind-Menue</th>';
echo'<th colspan="3">';
echo'<a href="index.php?page=99&jump=3&jumpi=bnew&jumps=bneu">Blind-Menüpunkt erstellen</a>';
echo'</th>';
echo'</tr>';
echo'<tr class="big">';
echo'<td>ID</td>';
echo'<td>Menüname</td>';
echo'<td>Wohin</td>';
echo'<td>Ziel</td>';
echo'<td>Edit</td>';
echo'<td>Del</td>';
echo'</tr>';
$stmt = $pdo->prepare("SELECT id, labels, ziels, linken_url FROM blind_menu ORDER BY id");
$stmt->bindColumn(1,$bmen_id);
$stmt->bindColumn(2,$m_labels);
$stmt->bindColumn(3,$m_ziels);
$stmt->bindColumn(4,$m_links);
$stmt->execute();
while($stmt->fetch())
{
echo'<tr>';
echo'<td>'.$bmen_id.'</td>';
echo'<td>'.$m_labels.'</td>';
echo'<td>'.$m_ziels.'</td>';
echo'<td>'.$m_links.'</td>';
echo'<td>';
echo'<a href="index.php?page=99&jump=3&jumpi=brecht&bmen_id='.$bmen_id.'"></a>';
echo'</td>';
echo'<td>';
echo'<a href="index.php?page=99&jump=3&jumpi=bdel&bmen_id='.$bmen_id.'">✘</a>';
echo'</td>';
echo'</tr>';
}
echo'</table>';
}
?>
= &#9997; und = &#10008;
bmenu.php Teil 2 
Menüpunkt erstellen
<?php
if($jumpi=='bnew')
{
echo'<table class="table">';
echo'<tr>';
echo'<th>ID</th>';
echo'<th>Menüname</th>';
echo'<th>Wohin</th>';
echo'<th>Ziel</th>';
echo'</tr>';
$stmt = $pdo->prepare("SELECT id, labels, ziels, linken_url FROM blind_menu ORDER BY id");
$stmt->bindColumn(1,$bmen_id);
$stmt->bindColumn(2,$m_labels);
$stmt->bindColumn(3,$m_ziels);
$stmt->bindColumn(4,$m_links);
$stmt->execute();
while($stmt->fetch())
{
echo'<tr>';
echo'<td>'.$bmen_id.'</td>';
echo'<td>'.$m_labels.'</td>';
echo'<td>'.$m_ziels.'</td>';
echo'<td>'.$m_links.'</td>';
echo'</tr>';
}
echo'</table>';
if($jumps=='bneu')
{
echo'<div class="bigg">Blind Menüpunkt erstellen</div>';
echo'<form action="index.php?page=99&jump=3&jumpi=bwrite&jumps=bschreib" method="post">';
echo'<input name="jumpo" type="hidden" value="schreib">';
echo'<div class="form-face">';
echo'<input required="required" placeholder="ID:" class="form-control" name="ids" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder="Menüname:" class="form-control" name="labels" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder="Wohin:" class="form-control" name="ziels" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder="Ziel:" class="form-control" name="linksurl" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input type="submit" name="schreib" value="Menüpunkt erstellen" class="butt button-blue">';
echo'<input type="reset" value="Löschen" class="butt button-red">';
echo'</div>';
echo'</form>';
}
}
?>
bmenu.php Teil 3 
Menüpunkt eintragen
<?php
if($jumpi=='bwrite')
{
if($jumps=='bschreib')
{
$ids = isset($_POST['ids']) ? $_POST['ids'] : '';
$labels = isset($_POST['labels']) ? $_POST['labels'] : '';
$ziels = isset($_POST['ziels']) ? $_POST['ziels'] : '';
$linksurl = isset($_POST['linksurl']) ? $_POST['linksurl'] : '';
$stmt = $pdo->prepare("INSERT INTO blind_menu (id,labels,ziels,linken_url) VALUES (:id,:label,:ziel,:linkurl)");
$stmt->bindParam(':id',$ids,PDO::PARAM_INT);
$stmt->bindParam(':label',$labels,PDO::PARAM_STR);
$stmt->bindParam(':ziel',$ziels,PDO::PARAM_INT);
$stmt->bindParam(':linkurl',$linksurl,PDO::PARAM_STR);
if($stmt->execute())
{
header("Location:index.php?page=99&jump=3&jumpi=blind");
}
else
{
echo"Da ist was schief gelaufen";
}
}
}
?>
bmenu.php Teil 4 
Menüpunkt editieren
<?php
if($jumpi=='brecht')
{
echo'<form method="post" action="index.php?page=99&jump=3&jumpi=brecht&bmen_id='.$bmen_id.'">';
echo'<table class="tables faces">';
echo'<tr>';
echo'<th colspan="2">Blind-Menü Edit</th>';
echo'</tr>';
$stmt = $pdo->prepare("SELECT id,labels,ziels,linken_url FROM blind_menu WHERE id=:id");
$stmt->bindParam(':id',$bmen_id,PDO::PARAM_INT);
$stmt->bindColumn(1,$bmen_id);
$stmt->bindColumn(2,$m_labels);
$stmt->bindColumn(3,$m_ziels);
$stmt->bindColumn(4,$m_links);
$stmt->execute();
while($stmt->fetch())
{
echo'<tr>';
echo'<td>ID:</td>';
echo'<td>';
echo'<input class="form-controle" type="text" name="ids" value="'.$bmen_id.'">';
echo'</td>';
echo'</tr>';
echo'<tr>';
echo'<td>Menüname:</td>';
echo'<td>';
echo'<input class="form-controle" type="text" name="labels" value="'.$m_labels.'">';
echo'</td>';
echo'</tr>';
echo'<tr>';
echo'<td>Wohin:</td>';
echo'<td>';
echo'<input class="form-controle" type="text" name="ziels" value="'.$m_ziels.'">';
echo'</td>';
echo'</tr>';
echo'<tr>';
echo'<td >Link_Url:</td>';
echo'<td>';
echo'<input class="form-controle" type="text" name="linksurl" value="'.$m_links.'">';
echo'</td>';
echo'</tr>';
}
echo'<td>';
echo'<input class="butli button-blue" type="submit" name="labelsneu" value="Speichern">';
echo'</td>';
echo'<td>';
echo'<button class="butli" type="submit" formaction="index.php?page=99&jump=3&jumpi=blind">zurück</button>';
echo'</td>';
echo'</table>';
echo'</form>';
if(isset($_POST['labelsneu']))
{
$id = $bmen_id;
$labels = isset($_POST['labels']) ? $_POST['labels'] : '';
$ziels = isset($_POST['ziels']) ? $_POST['ziels'] : '';
$linksurl = isset($_POST['linksurl']) ? $_POST['linksurl'] : '';
$stmt = $pdo->prepare("UPDATE blind_menu SET labels=:label,ziels=:ziel,linken_url=:linkurl WHERE id=:id");
$stmt->bindParam(':id',$id,PDO::PARAM_INT);
$stmt->bindParam(':label',$labels,PDO::PARAM_STR);
$stmt->bindParam(':ziel',$ziels,PDO::PARAM_INT);
$stmt->bindParam(':linkurl',$linksurl,PDO::PARAM_STR);
if($stmt->execute())
{
header("Location:index.php?page=99&jump=3&jumpi=blind");
}
else
{
echo"Da ist was schief gelaufen";
}
}
}
?>
bmenu.php Teil 5 
Menüpunkt löschen
<?php
if($jumpi=='bdel')
{
$stmt = $pdo->prepare("SELECT id,labels FROM blind_menu WHERE id=:id");
$stmt->bindParam(':id',$bmen_id,PDO::PARAM_INT);
$stmt->bindColumn(1,$bmen_id);
$stmt->bindColumn(2,$m_labels);
$stmt->execute();
while($stmt->fetch())
{
echo'<p class="center">Blind-Menüpunkt <b>'.trim($m_labels).'</b> wirklich löschen? <a href="index.php?page=99&jump=3&jumpi=loeschen&bmen_id='.IntVal($bmen_id).'">Ja</a> | ';
echo'<a href="index.php?page=99&jump=3&jumpi=blind">Nein</a></p>';
}
}
if($jumpi=='loeschen')
{
$stmt = $pdo->prepare("DELETE FROM blind_menu WHERE id=:id");
$stmt->bindParam(':id',$bmen_id,PDO::PARAM_INT);
if($stmt->execute())
{
header("Location:index.php?page=99&jump=3&jumpi=blind");
}
else
{
echo"Da ist was schief gelaufen";
}
}
}
else
{
header("Location: index.php?page=1");
exit();
}
?>