function PublishWebMessage($alias, $text, $tz, $c, $dbh)
{
    $publish = false;
    $query = "SELECT message_text,message_order FROM message WHERE channel_id = " . $c . " ORDER BY message_id DESC LIMIT 0,1";
    $result = mysql_query($query, $dbh);
    if ($row = mysql_fetch_array($result, MYSQL_NUM)) {
        if (urldecode($row[0]) != $text) {
            $publish = true;
            $new_order = $row[1] + 1;
        }
    } else {
        $publish = true;
        $new_order = 1;
    }
    if ($publish) {
        $currentDate = GetChannelDate($tz);
        $text = urlencode($text);
        $alias = urlencode($alias);
        $query = "INSERT INTO message (channel_id,message_text,message_date,message_sender,message_order) VALUES ({$c},'{$text}','{$currentDate}','{$alias}',{$new_order})";
        $result = mysql_query($query, $dbh);
    }
}
Example #2
0
    $c = $_GET['c'];
    $date = $_GET['date'];
    $from = $_GET['from'];
} else {
    if (isset($_POST['id']) && isset($_POST['add'])) {
        $id = $_POST['id'];
        $alias = $_POST['alias'];
        $pass = $_POST['pass'];
        $comment = $_POST['comment'];
        $c = $_POST['c'];
        $date = $_POST['date'];
        $from = $_POST['from'];
        $ret = VerifyUserAccess($alias, $pass, $dbh);
        if ($ret) {
            if (trim($comment) != "") {
                $comment_date = GetChannelDate($time_zone);
                $query = "INSERT INTO comment (message_id, user_id, comment_date, comment_text) VALUES ({$id}, {$alias}, '{$comment_date}', '{$comment}')";
                $result = mysql_query($query, $dbh);
                header("location: {$main_page}?c={$c}&date={$date}&from={$from}#{$id}");
                break;
            }
        } else {
            $error_msg = $ov_comment_wrong_password[$language];
        }
    }
}
?>
<html>
<head>
<title><?php 
echo $global_channel_name . ": " . $ov_comments_page_text[$language];