edit_news.php
来自「聪明星企业wap网站系统 Version 1.0」· PHP 代码 · 共 204 行
PHP
204 行
<?
/* ======================================
* ******smartstar firm wap system******
* ======================================
* AUTHOR :
* =======
* Copyright (C) 2006 Wap-system - A wap system designed for firm
* by smartstar.
*/
?>
<?
include("function.inc.php");
include("../chinese/class.Chinese.php");
?>
<link href=js/common.css rel=stylesheet type=text/css>
<?
if($_POST)
{
if(!empty($_POST["title"]))
{
$id=$_POST["id"];
$sortid=$_POST["sortid"];
$id=intval($id);
$sortid=intval($sortid);
$title=$_POST["title"];
$info=$_POST["info"];
include("../db_connect.php");
$chs_t = new Chinese("GB2312","UTF8",trim($title));
$title = $chs_t->ConvertIT();
$chs_i = new Chinese("GB2312","UTF8",trim($info));
$info = $chs_i->ConvertIT(); // 将GB2312转换为UTF8
mysql_query("update wap_news set sortid='$sortid',title='$title',info='$info' where id='$id'",$db) or die ("query failed");
mysql_close($db);
echo "<p align=center>内容修改成功,3秒后自动返回内容管理页!";
echo "<script>window.setTimeout(\"location.href='admin_news.php'\",3000);</script></p>";
exit;
}
else
{
echo "<p align=center>请填写标题!";
echo "<a href=\"edit_news.php\">返回</a></p>";
exit;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>编辑内容</title></head>
<body>
<script language="JavaScript">
<!--
if(navigator.appName == "Microsoft Internet Explorer")
{
isIE=true;
}
else
{
isIE=false;
}
function AddText(NewCode)
{
if(document.all){
insertAtCaret(document.myform.Content, NewCode);
document.myform.info.focus();
}
else
{
document.myform.info.value += NewCode;
document.myform.info.focus();
}
}
function insertAtCaret (textEl, text){
if (textEl.createTextRange && textEl.caretPos)
{
var caretPos = textEl.caretPos;
caretPos.text += caretPos.text.charAt(caretPos.text.length - 2) == ' ' ? text + ' ' : text;
}
else if(textEl)
{
textEl.value += text;
}
else
{
textEl.value = text;
}
}
function ubbFormat(what)
{
if (document.selection && document.selection.type == "Text")
{
var range = document.selection.createRange();
range.text = "["+what+"]" + range.text + "[/"+what+"]";
}
else
{
txt=window.prompt("请输入内容","");
if (txt!=null) {
AddTxt="["+what+"]"+txt;
AddText(AddTxt);
AddText("[/"+what+"]");
}
}
}
function ubbInsert(what)
{
if (document.selection && document.selection.type == "Text")
{
var range = document.selection.createRange();
range.text = "["+what+"]" + range.text + "[/"+what+"]";
}
else
{
txt=window.prompt("请输入内容","");
if (txt!=null) {
AddTxt="["+what+"]"+txt;
AddText(AddTxt);
AddText("[/"+what+"]");
}
}
}
//-->
</script>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DEDFDE">
<form name ="myform" method="post" action="edit_news.php">
<tr>
<td colspan="2" bgcolor="#f7f7f7"><div align="center"> <strong>内 容 编 辑</strong></div></td>
</tr>
<?
include("../db_connect.php");
$result=mysql_query("select * from wap_news where id='$id'",$db) or die ("query failed");
echo "<tr><td><input type=\"hidden\" name=\"id\" value=\"$id\"></td></tr>\n";
while ($row=mysql_fetch_row($result))
{
$sortid=$row[1];
$title=$row[2];
$info=$row[3];
$chs_t = new Chinese("UTF8","GB2312",trim($title));
$title = $chs_t->ConvertIT();
$chs_i = new Chinese("UTF8","GB2312",trim($info));
$info = $chs_i->ConvertIT(); // 将UTF8转换为GB2312
$result1=mysql_query("select * from wap_newssort where sortid='$sortid'",$db);
$row1=mysql_fetch_row($result1);
$sortname=$row1[2];
$chs_s = new Chinese("UTF8","GB2312",trim($sortname));
$sortname = $chs_s->ConvertIT(); // 将UTF8转换为GB2312
echo "<tr>
<td bgcolor=\"#FFFFFF\">所属菜单:</td>
<td bgcolor=\"#FFFFFF\">";
echo "<select name=\"sortid\">\n";
echo "<option value=\"$row[1]\" selected>$sortname</option>\n"; // 原始所属菜单
$result2=mysql_query("select * from wap_newssort where sortid<>'$sortid' order by sortid asc",$db);
while($row2=mysql_fetch_row($result2))
{
$sortname1=$row2[2];
$chs_s1 = new Chinese("UTF8","GB2312",trim($sortname1));
$sortname1 = $chs_s1->ConvertIT();
echo "<option value=\"$row2[0]\">$sortname1</option>\n";
}
?>
</select></td></tr>
<tr>
<td bgcolor="#FFFFFF">内容标题:</td>
<td bgcolor="#FFFFFF"><input name="title" value="<?echo $title;?>" type="text" class="input_text" id="Title" size="50"></td>
</tr>
<tr>
<td width="120" rowspan="2" bgcolor="#FFFFFF"><p>新闻内容:</p>
<p>换行请按<FONT color=#ff6600>Enter</FONT>,</p>
<p>会wml的朋友</p>
<p>可直接填写wml代码</p>
<p>注意添加内容</p>
<p>后要记得预览.</p>
<td bgcolor="#FFFFFF"><img src="ubb/bold.gif" border="0" alt="粗体" onClick="ubbFormat('B')"><img src="ubb/italicize.gif" border="0" alt="斜体" onClick="ubbFormat('I')"><img src="ubb/underline.gif" border="0" alt="下划线" onClick="ubbFormat('U')"><img src="ubb/url.gif" alt="插入网址" width="23" height="22" border="0" onClick="ubbFormat('URL')"><img src="ubb/image.gif" border="0" alt="插入图片" onClick="ubbInsert('IMG')">
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><textarea name="info" cols="90" rows="25" class="input_text" id="Content"><?echo $info;?></textarea></td>
</tr>
<tr>
<td height="40" colspan="2" bgcolor="#FFFFFF"><div align="center">
<input type="submit" name="edit" value=" 提 交 " class="input_submit">
<input type="reset" name="reset" value=" 重 置 " class="input_submit">
</div></td>
</tr>
</form>
</table>
<p align=center><a href=\"admin_news.php\">返回</a></p>
<?
}
mysql_close($db);
?>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?