查看文件: ad_newsedit.php
大小: 4.76 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE news SET title=%s, idate=%s, doc=%s, link=%s, fn=%s,homefn=%s,fck=%s WHERE id=%s", GetSQLValueString($_POST['title'], "text"), GetSQLValueString($_POST['idate'], "text"), GetSQLValueString(nl2br($_POST['doc']), "text"), GetSQLValueString($_POST['link'], "text"), GetSQLValueString($_POST['fn'], "text"), GetSQLValueString($_POST['homefn'], "text"), GetSQLValueString($_POST['fck'], "text"), GetSQLValueString($_POST['id'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $write='資料已更新...'; $insertGoTo = $_POST['url']; // header(sprintf("Location: %s", $insertGoTo)); echo "<script>alert('".$write."');location.href='".$_POST['url']."';</script>"; } $colname_Rt2 = "-1"; if (isset($_GET['id'])) { $colname_Rt2 = $_GET['id']; } mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT * FROM news WHERE id = '%s'", GetSQLValueString($colname_Rt2, "int")); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); ?> <form action="" method="post" name="form1" id="form1"> <input name="id" type="hidden" id="id" value="<?php echo $row_Rt2['id']; ?>" /> <table width="100%" align="center"> <tr valign="baseline"> <td align="right" valign="top"><label></label></td> <td align="right" valign="top"> </td> </tr> <tr valign="baseline"> <td align="right" valign="top" class="font2">是否顯示/</td> <td align="left" valign="top" ><select name="fn" id="fn"> <option value="Y" <?php if (!(strcmp("Y", $row_Rt2['fn']))) {echo "selected=\"selected\"";} ?>>Y</option> <option value="N" <?php if (!(strcmp("N", $row_Rt2['fn']))) {echo "selected=\"selected\"";} ?>>N</option> </select> </td> </tr> <tr valign="baseline"> <th align="right" valign="top" nowrap="nowrap" class="font2">顯示在主頁</th> <td valign="middle"><select name="homefn" id="homefn"> <option value="Y" <?php if (!(strcmp("Y", $row_Rt2['homefn']))) {echo "selected=\"selected\"";} ?>>Y</option> <option value="N" <?php if (!(strcmp("N", $row_Rt2['homefn']))) {echo "selected=\"selected\"";} ?>>N</option> </select></td> </tr> <tr valign="baseline"> <th align="right" valign="top" nowrap="nowrap" class="font2">審核</th> <td valign="middle"><select name="fck" id="fck"> <option value="Y" <?php if (!(strcmp("Y", $row_Rt2['fck']))) {echo "selected=\"selected\"";} ?>>Y</option> <option value="N" <?php if (!(strcmp("N", $row_Rt2['fck']))) {echo "selected=\"selected\"";} ?>>N</option> </select></td> </tr> <tr valign="baseline"> <th width="9%" align="right" valign="top" nowrap="nowrap" class="font2">主旨/</th> <td width="91%" valign="middle"><input type="text" name="title" value="<?php echo $row_Rt2['title']; ?>" size="50" /></td> </tr> <tr valign="baseline"> <th align="right" valign="top" nowrap="nowrap" class="font2">發佈日期/</th> <td valign="middle" class="font3"><input name="idate" type="text" id="idate" value="<? echo $row_Rt2['idate'] ;?>" size="50" /> 例 2010-01-31 <input type="hidden" name="link" value="<?php echo $row_Rt2['link']; ?>" size="50" /> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" size="50" /></td> </tr> <tr valign="baseline"> <th align="right" valign="top" nowrap="nowrap"> </th> <td valign="middle"> <td valign="middle"> </td> </tr> <tr valign="baseline"> <th align="right" valign="top" nowrap="nowrap" class="font2">內容/</th> <td><textarea name="doc" cols="50" rows="12" id="doc"><?= preg_replace('/<br\\s*?\/??>/i','',$row_Rt2['doc']); ?></textarea></td> </tr> <tr valign="baseline"> <td height="40" align="center" valign="middle" nowrap="nowrap"></td> <td align="center" valign="middle"> <input type="submit" value="更新資料" /></td> </tr> </table> <input type="hidden" name="MM_update" value="form1" /> </form> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表