コード例 #1
0
ファイル: index.php プロジェクト: joksnet/php-old
$id_posts = isset($_GET['id_posts']) ? $_GET['id_posts'] : (isset($_POST['id_posts']) ? $_POST['id_posts'] : 0);
$id_users = isset($_GET['id_users']) ? $_GET['id_users'] : (isset($_POST['id_users']) ? $_POST['id_users'] : 0);
list($users_data, $users_submenu) = get_users();
list($data, $posts, $pagination, $comments) = get_posts($id_posts, $id_users, $start);
if ($id_posts > 0) {
    if (isset($_POST['author'])) {
        $ins = new Insert('comments', $db);
        $ins->col['id_posts'] = $id_posts;
        $ins->col['author'] = $_POST['author'];
        $ins->col['author_email'] = $_POST['author_email'];
        $ins->col['author_url'] = $_POST['author_url'];
        $ins->col['author_ip'] = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : $_SERVER['REMOTE_ADDR'];
        $ins->col['agent'] = $_SERVER['HTTP_USER_AGENT'];
        $ins->col['date'] = 'NOW()';
        $ins->col['content'] = strip_tags(specialchars($_POST['comment']), '<h1><b><i><a><ul><li><pre><hr><blockquote><img><p>');
        $ins->update();
        redirect('?id_posts=' . $id_posts);
    }
    $id_users = $data['id_users'];
    $comments_reply = '
<h1>Leave a Comment</h1>
<form name="frm" id="frm" action="" method="post">
    <label for="author">Author</label><input type="text" name="author" id="author" /><br />
    <label for="author_email">Email</label><input type="text" name="author_email" id="author_email" /><br />
    <label for="author_url">URL</label><input type="text" name="author_url" id="author_url" /><br />
    <label for="comment">Comment</label><textarea name="comment" id="comment"></textarea><br />
</form>
<p align="center"><a href="javascript:send();">Send</a></p>
<script language="javascript" type="text/javascript">
<!--
    function send()