$allDataRawArr = explode('>>', $allDataStr);
        foreach ($allDataRawArr as $data) {
            if (!empty($data)) {
                $dataInfo = explode('<<', $data);
                $dataArr[] = ['username' => $dataInfo[0], 'text' => $dataInfo[1], 'date' => $dataInfo[2]];
            }
        }
    }
    return isset($dataArr) ? $dataArr : false;
}
if (sizeof($_POST)) {
    if (isset($_POST['username']) && isset($_POST['text'])) {
        $userName = trim(strip_tags($_POST['username']));
        $text = trim(htmlspecialchars($_POST['text']));
        $dataArr = ['username' => $userName, 'text' => $text, 'date' => date('Y-M-d H:m:s')];
        saveText($path, $dataArr);
    }
}
?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        #guest-desk {
            float: left;
            position: relative;
            display: block;
            border: 2px solid white;
Exemplo n.º 2
0
        array_push($error, "Ошибка сохранения");
        return;
    }
    $query = "UPDATE `text`\n    SET\n      `access` = {$access_code}\n    WHERE\n      `text_id` = {$text_id}";
    executeQuery($query);
    if (count($error) > 0) {
        return;
    }
    header('Location: edit.php?id=' . $text_id . '&status=ok');
    die;
}
//=================================== Основной код
$error = array();
switch ($_POST["operation"]) {
    case "save":
        saveText();
        break;
    case "save_access":
        saveAccess();
        break;
    default:
        header('Location: /');
        die;
        break;
}
$title = 'Ошибка сохранения';
include '../header.php';
?>

  <div class="content" style="border: 0px;">
    <div>