www.gusucode.com > weenCompany闻名企业网站系统 4.0.0 繁体中英文 UTF8源码程序 > modules/m7_chatterbox/m7_settings.php
<?php // +---------------------------------------------+ // | Copyright 2003-2005 weenCompany | // | http://www.weentech.com | // | This file may not be redistributed. | // +---------------------------------------------+ if(!defined('IN_WEENCOMPANY')) { die("File not found!"); } // ############################## UPDATE COMMENTS ############################## function UpdateComments() { global $DB; global $refreshpage; // post vars $commentid = $_POST['commentid']; $username = $_POST['username']; $comment = $_POST['comment']; $deletecommentid = $_POST['deletecommentid']; // first update comments for($i = 0; $i < count($comment); $i++) { $DB->query("UPDATE " . TABLE_PREFIX . "m7_chatterbox SET comment = '$comment[$i]', username = '$username[$i]' WHERE commentid = '$commentid[$i]'"); } // now delete comments (if user selected to delete any) for($i = 0; $i < count($deletecommentid); $i++) { $DB->query("DELETE FROM " . TABLE_PREFIX . "m7_chatterbox WHERE commentid = '" . $deletecommentid[$i] . "'"); } PrintRedirect($refreshpage, 1); } // ############################## DISPLAY DEFAULT ############################## function DisplayDefault() { global $DB; global $moduleid; global $refreshpage; PrintModuleSettings($moduleid, '模塊設置', $refreshpage); $getchatterbox = $DB->query("SELECT * FROM " . TABLE_PREFIX . "m7_chatterbox ORDER BY commentid DESC LIMIT 0, 10"); $chatterboxrows = $DB->get_num_rows($getchatterbox); PrintSection("內容條目"); echo '<form method="post" action="" name="deletemessages"> <input type="hidden" name="action" value="updatecomments" /> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td class="tdrow1">時間</td> <td class="tdrow1">用戶名</td> <td class="tdrow1">內容</td> <td class="tdrow1" width="75"><input type="checkbox" checkall="group" onclick="javascript: return select_deselectAll (\'deletemessages\', this, \'group\');"> 刪除</td> </tr>'; while($chatterbox = $DB->fetch_array($getchatterbox)) { echo '<tr> <td class="tdrow3">'.DisplayDate($chatterbox['datecreated'], 'Y.m.d-H:i:s').'</td> <td class="tdrow2"><input type="text" name="username[]" size="15" value="' . CleanFormValue($chatterbox['username']) . '" /></td> <td class="tdrow3"><input type="text" name="comment[]" size="50" value="' . CleanFormValue($chatterbox['comment']) . '" /> <input type="hidden" name="commentid[]" value="'.$chatterbox['commentid'].'" /> </td> <td class="tdrow2"><input type="checkbox" name="deletecommentid[]" value="'.$chatterbox['commentid'].'" checkme="group" /></td> </tr>'; } echo '</td> </tr> <tr> <td class="tdrow1" bgcolor="#FCFCFC" colspan="4" align="center"> <input type="submit" value=" 保存更新 " /> </td> </tr> </table> </form>'; EndSection(); } // ############################# FUNCTION CALLING ############################## switch($action) { case 'updatecomments': UpdateComments(); break; default: DisplayDefault(); } ?>