Einchecken des Online-Codes
This commit is contained in:
84
admin/inhalte/stammdaten/unter/links.php
Normal file
84
admin/inhalte/stammdaten/unter/links.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
if ( $_SESSION['IsAdmin'] )
|
||||
{
|
||||
if ( isset ( $_POST['action'] ) AND ( 'Speichern' == $_POST['action'] ) )
|
||||
{
|
||||
if ( isset ( $_POST['type'] ) )
|
||||
{
|
||||
if ( 'new' == $_POST['type'] )
|
||||
{
|
||||
$sql = 'INSERT INTO Links ( linkRef, linkText ) VALUES ( "' . $_POST['linkRef'] . '", "' . $_POST['linkText'] . '" );';
|
||||
$stmt = $db->prepare($sql);
|
||||
if (!$stmt) {
|
||||
die ('Datensatz konnte nicht angelegt werden: '.$db->error);
|
||||
}
|
||||
if (!$stmt->execute()) {
|
||||
die ('Datensatz konnte nicht angelegt werden: '.$stmt->error);
|
||||
}
|
||||
}
|
||||
elseif ( 'edit' == $_POST['type'] )
|
||||
{
|
||||
$sql = 'UPDATE Links SET
|
||||
linkRef = "'.$_POST['linkRef'].'",
|
||||
linkText = "'.$_POST['linkText'].'"
|
||||
WHERE linkId = "'.$_POST['ID'].'";';
|
||||
$stmt = $db->prepare($sql);
|
||||
if ( !$stmt )
|
||||
{
|
||||
die ('Datensatz konnte nicht gespeichert werden: '.$db->error);
|
||||
}
|
||||
if ( !$stmt->execute() )
|
||||
{
|
||||
die ('Datensatz konnte nicht gespeichert werden: '.$stmt->error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( isset ( $_POST['action'] ) AND ( 'Löschen' == $_POST['action'] ) )
|
||||
{
|
||||
$sql = 'DELETE FROM
|
||||
Links
|
||||
WHERE
|
||||
linkId = "'.$_POST['ID'].'";';
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
unset($_POST);
|
||||
} else {
|
||||
echo "Fehler beim löschen";
|
||||
}
|
||||
|
||||
}
|
||||
$sql = "SELECT * FROM Links ORDER BY linkId ASC;";
|
||||
$result = $db->query ( $sql );
|
||||
echo "<h1>Links</h1>\n";
|
||||
while ( $nt = $result->fetch_assoc() )
|
||||
{
|
||||
?>
|
||||
<fieldset>
|
||||
<form name="Edit<?php echo $nt['linkId']; ?>" action="index.php?<?php echo $_SERVER['QUERY_STRING']; ?>" method="post">
|
||||
<input type="hidden" name="type" value="edit" />
|
||||
<input type="hidden" name="ID" value="<?php echo $nt['linkId']; ?>" />
|
||||
<label>Text:</label><br />
|
||||
<textarea name="linkText"><?php echo $nt['linkText']; ?></textarea>
|
||||
<label>Link:</label><br />
|
||||
<input style="float:right;" type="submit" name="action" value="Speichern" />
|
||||
<input style="float:right;" type="submit" name="action" value="Löschen" />
|
||||
<input type="text" name="linkRef" value="<?php echo $nt['linkRef']; ?>" /><br />
|
||||
</form>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<fieldset>
|
||||
<form name="New" action="index.php?<?php echo $_SERVER['QUERY_STRING']; ?>" method="post">
|
||||
<input type="hidden" name="type" value="new" />
|
||||
<label>Text:</label><br />
|
||||
<textarea name="linkText"><?php echo $nt['linkText']; ?></textarea>
|
||||
<label>Link:</label><br />
|
||||
<input style="float:right;" type="submit" name="action" value="Speichern" />
|
||||
<input type="text" name="linkRef" value="<?php echo $nt['linkRef']; ?>" /><br />
|
||||
</form>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user