查看文件: set_menu_data.php
大小: 4.38 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE alldoc SET mid_2=%s, title_2=%s, kind=%s, doc=%s WHERE id=%s", GetSQLValueString($_POST['mid_2'], "int"), GetSQLValueString($_POST['title_2'], "text"), GetSQLValueString($_POST['kind'], "text"), GetSQLValueString($_POST['doc1'], "text"), GetSQLValueString($_POST['id'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); if ($_POST['kind']=='D'){ $updateSQL = sprintf("UPDATE jscookmenu SET link_tag = '%s',link = '%s' WHERE mid='%s'",$_POST['link_tag'],"index.php?menu=".$_POST['mid_2'],$_POST['mid_2']); } elseif( $_POST['kind']=='L'){ $updateSQL = sprintf("UPDATE jscookmenu SET link_tag = '%s',link = '%s' WHERE mid='%s'",$_POST['link_tag'],$_POST['doc1'],$_POST['mid_2']); } mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $updateGoTo = "#"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } $colname_Rt2 = "-1"; if (isset($_GET['id'])) { $colname_Rt2 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']); } if ($colname_Rt2>0 ){ mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT a.*,b.title,b.link_tag FROM alldoc as a,jscookmenu as b WHERE a.mid_2=b.mid and a.mid_2 = %s", $colname_Rt2); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); if ($totalRows_Rt2<1){ mysql_free_result($Rt2); mysql_select_db($database_BE2, $BE2); $query_up = sprintf("insert into alldoc (mid_2) VALUES ('%s')", $colname_Rt2); mysql_query($query_up, $BE2) or die(mysql_error()); $query_Rt2 = sprintf("SELECT a.*,b.title FROM alldoc as a,jscookmenu as b WHERE a.mid_2=b.mid and a.mid_2 = %s", $colname_Rt2); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); } ?> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table width="668" align="center"> <tr valign="baseline"> <td width="725">抬頭標題 <input type="text" name="title_2" value="<?php echo $row_Rt2['title']; ?>" size="50" readonly> <select name="kind"> <option value="D" <? if ($row_Rt2['kind']=='D'){ echo "selected" ;}?>>資料庫內文檔</option> <option value="L" <? if ($row_Rt2['kind']=='L'){ echo "selected" ;}?>>網頁連結</option> <option value="P" <? if ($row_Rt2['kind']=='P'){ echo "selected" ;}?>>程式連結(唯讀)</option> </select> <select name="link_tag"> <option value="_blank" <? if ($row_Rt2['link_tag']=='_blank'){ echo "selected" ;}?>>開新頁面</option> <option value="_self" <? if ($row_Rt2['link_tag']=='_self'){ echo "selected" ;}?>>繼承本頁</option> </select></td> </tr> <tr valign="baseline"> <td><input type="hidden" name="doc" size="32"> <? include("../fckeditor/fckeditor.php") ; $sBasePath = $_SERVER['PHP_SELF'] ; $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ; $oFCKeditor = new FCKeditor('doc1') ; $oFCKeditor->BasePath = '/fckeditor/';//$sBasePath ; $oFCKeditor->Width = 668 ; $oFCKeditor->Height = 600 ; $oFCKeditor->Value = $row_Rt2['doc']; $oFCKeditor->Config['EnterMode'] = 'br'; // turn off auto <p> tags wrapping content $oFCKeditor->Create() ; ?> </td> </tr> <tr valign="baseline"> <td> <? if ($row_Rt2['kind']<>'P'){ ?> <input type="submit" value="更新記錄"> <? } ?> </td> </tr> </table> <input type="hidden" name="mid_2" value="<?php echo $row_Rt2['mid_2']; ?>"> <input type="hidden" name="MM_update" value="form1"> <input type="hidden" name="id" value="<?php echo $row_Rt2['id']; ?>"> </form> <? mysql_free_result($Rt2); } ?>
保存
取消
返回文件列表