<?php

session_start();
require 'src/mysql.php';
require 'src/auth.php';
if (isset($_POST['id']) && isset($_POST['sent'])) {
    if (erase_bericht($_POST['id'])) {
        header('Location: redakteur.php');
    } else {
        echo mysql_error();
    }
} elseif (isset($_GET['id']) && ist_bericht($_GET['id'])) {
    $bericht = get_bericht($_GET['id']);
} else {
    header('Location: redakteur.php');
}
if (isset($_POST['sent']) && isset($_POST['id'])) {
}
?>
<html>

<head>
    <title>Handball-Dachau // Redakteur // Bericht &Auml;ndern</title>

    <meta charset="UTF-8">
    <meta name="description" content="Handballer des ASV Dachau">

    <link href="src/style_red.css" type="text/css" rel="stylesheet">
</head>

    
    $name = $_POST['name'];
} else {
    $name = "";
}
if ($_POST['text'] != "") {
    $text = $_POST['text'];
} else {
    $text = "";
}
if ($_POST['berichtid'] != "") {
    $berichtid = $_POST['berichtid'];
} else {
    $berichtid = $_GET['id'];
}
if (isset($_POST['sent']) && $_POST['sent'] == "absenden") {
    if ($name != "" && $text != "" && ist_bericht($berichtid)) {
        if (strpos($text, " dress ") == false && strpos($name, " dress ") == false && strpos($text, " dresses ") == false && strpos($name, " dresses ") == false) {
            add_kommentar($name, $text, $berichtid);
        }
        header('Location: ' . $_SERVER['REQUEST_URI']);
    }
}
$kommentare = get_kommentare($_GET['id']);
?>
<!DOCTYPE html>
<html>
<head>
    <title>Handball Dachau</title>
    <meta charset="UTF-8">
    <meta name="description" content="Handballer des ASV Dachau">
    <link href="src/style.css" type="text/css" rel="stylesheet">
<?php

session_start();
require 'src/mysql.php';
require 'src/auth.php';
if (isset($_GET['id'])) {
    if (!ist_bericht($_GET['id'])) {
        header('Location: redakteur.php');
    } else {
        $bericht = get_bericht($_GET['id']);
    }
} else {
    header('Location: redakteur.php');
}
$e = 0;
if (isset($_POST['titel'])) {
    if ($_POST['titel'] != "") {
        $titel = $_POST['titel'];
    } else {
        $e = 1;
        $titel = "";
    }
} else {
    $titel = $bericht['titel'];
}
if (isset($_POST['text'])) {
    if ($_POST['text'] != "") {
        $text = $_POST['text'];
    } else {
        $e = 2;
        $text = "";