Пример #1
0
        <li> <a href="guest.php" > Гостевая книга </a>
        <li> <a href="blog.php"> Мой блог </a>
    </ul>
</div>
<div class="navigation" id = "inter">
    <script src = "scripts/lists.js"></script>
</div>
<div class="bodyc">
    <?php 
$comment = new DataBase("comments");
if (isset($_POST['submit'])) {
    $val = new FormValidation();
    $val->setRule('email', "/^[-\\w.]+@([A-z0-9][-A-z0-9]+\\.)+[A-z]{2,4}\$/");
    $val->setRule('fio', "/^[А-Яа-яA-Za-z]+ [А-Яа-яA-Za-z]+ [А-Яа-яA-Za-z]+\$/");
    $val->setRule('mes', "/\\w+/");
    $val->validate($_POST);
    $er = $val->showErrors();
    if (strripos($er, "Error") == false) {
        $fio = $_POST['fio'];
        $email = $_POST['email'];
        $mes = $_POST['mes'];
        $date = date('Y-m-d');
        $comment = new CommentRecord("comments", $fio, $email, $mes, $date);
        $comment->save($pd);
    } else {
        echo $er . "<br>";
    }
}
?>
    <form method = post action="guest.php">
       <a href = "openComment.php" id = "history">Открыть файл с записями </a>
Пример #2
0
        <li> <a href="#" onclick = "showList()" id = "int" onmouseover="setBackground('int')" onmouseout="restore('int')"> Мои интересы </a>
        <li> <a href="study.php" onmouseover="setBackground('study')" onmouseout="restore('study')"> Учеба </a>
        <li> <a href="contacts.php" onmouseover="setBackground('contacts')" onmouseout="restore('contacts')"> Контакты </a>
        <li> <a href="tests.php" onmouseover="setBackground('tests')" onmouseout="restore('tests')"> Тесты </a>

        <li> <a href="guest.php" > Гостевая книга </a>
        <li> <a href="blog.php"> Мой блог </a>
    </ul>
</div>
<div class = "navigation" id = "inter">
    <script src = "scripts/lists.js"></script>
</div>
<div class = "bodyc">
    <?php 
include '/php/FormValidation.php';
$error_div = "";
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['submit'])) {
    $validator = new FormValidation();
    $validator->setRule('email', "/^[-\\w.]+@([A-z0-9][-A-z0-9]+\\.)+[A-z]{2,4}\$/");
    $validator->setRule('fio', "/^[А-Яа-яA-Za-z]+ [А-Яа-яA-Za-z]+ [А-Яа-яA-Za-z]+\$/");
    $validator->setRule('mes', "/\\w+/");
    $validator->setRule('phone', "/^[73]\\d{8,10}\$/");
    $validator->validate($_POST);
    $error_div = $validator->showErrors();
}
echo $error_div;
echo "<script>setInterval(function(){\n                history.go(-1);\n                }, 5000);</script>\n                <br><center>Вернетесь обратно через 5 секунд</center>";
?>
</div>
</body>
</html>