示例#1
0
    } else {
        echo " <a href=\"{$edit_page}?c={$c}&date=" . $days[$i] . "#content\">{$day}</a>";
    }
}
?>
</font></form>
</td>
<td></td>
</tr>

<tr><td bgcolor="#<?php 
echo $textcolor;
?>
" height="3"></td></tr>
<?php 
$order = GetChannelAscendDescend($dbh, $c);
$query = "SELECT message_text, message_date, message_sender, message_subject, message_id, message_order FROM message WHERE channel_id = {$c} AND DATE(message_date) = '{$date}' ORDER BY message_order {$order}";
$result = mysql_query($query, $dbh);
$ct = 0;
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
    $message_text = urldecode($row[0]);
    $message_date = $row[1];
    $message_sender = $row[2];
    $message_subject = $row[3];
    $message_id = $row[4];
    $message_order = $row[5];
    $val = $message_id;
    ?>
<tr><td><form name="form1" method="post" action="edit_channel.php?c=<?php 
    echo $c;
    ?>
function MoveMessage($dbh, $c, $o, $move, $m, $t)
{
    $o = $t - $o;
    $oo = GetChannelAscendDescend($dbh, $c);
    $query = "SELECT message_order FROM message WHERE channel_id = {$c} ORDER BY message_order {$oo} LIMIT {$o},1";
    $result = mysql_query($query, $dbh);
    $row = mysql_fetch_array($result, MYSQL_NUM);
    $from = $row[0];
    $move = $t - $move;
    $query = "SELECT message_order FROM message WHERE channel_id = {$c} ORDER BY message_order {$oo} LIMIT {$move},1";
    $result = mysql_query($query, $dbh);
    $row = mysql_fetch_array($result, MYSQL_NUM);
    $to = $row[0];
    if ($to > $from) {
        $start = $from;
        $end = $to;
        $query = "UPDATE message SET message_order=message_order-1 WHERE message_order > {$start} AND message_order <= {$end} AND channel_id = {$c} ORDER BY message_order ASC";
    } else {
        $start = $to;
        $end = $from;
        $query = "UPDATE message SET message_order=message_order+1 WHERE message_order >= {$start} AND message_order < {$end} AND channel_id = {$c} ORDER BY message_order DESC";
    }
    $upd = mysql_query($query, $dbh);
    $query = "UPDATE message SET message_order={$to} WHERE message_id = {$m}";
    $upd = mysql_query($query, $dbh);
}