⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit.php

📁 某自制区政府网站源代码.数据库为Access,包含完整的数据库.
💻 PHP
字号:
<?php

// ------------------------- -------- ------------------------- //

require ("../include/config.inc.php");
require ("./global.php");

// ------------------------- -------- ------------------------- //

mysql_connect($dbhost,$dbuser,$dbpasswd) or die ("数据库连接失败");

// check cookie
islogin($HTTP_COOKIE_VARS[$cookie_name][1],$HTTP_COOKIE_VARS[$cookie_name][2]);

$cookie_user = $HTTP_COOKIE_VARS[$cookie_name][1];


// check id
if ($id>"0" && $id<"999999999"):


// ------------------------- sendedit -------------------------

if ($sendedit):
editrecord($id,$title,$author,$fromsite,$text,$img,$download,$sortid,$today_view,$view,$isshow,$ishtml);
echo "<br><center><a href=add.php>已修改</a><br>";
echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=list.php'>";
exit;
endif;


// ------------------------- -------- ------------------------- //

include ("../include/header.inc.php");


echo "<title>控制面板</title>\n";
echo "<center><br>\n";


// 搜索跳转 ------------------------------

echo "<br><table border=0 cellpadding=3 cellspacing=0 style='border-collapse:collapse' bordercolor=#efefef width=735>\n";
echo "<tr>\n";
echo "<td class=shadow2 width=190 valign=bottom>\n";


// 本类/总数 ------------------------------

all_and_this();


// 搜索表单 ------------------------------

$typesql = "SELECT COUNT(*) AS rcnt FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
$typerow = mysql_fetch_array($typeresult);

$typesql = "SELECT * FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);


echo "</td>\n";
echo "<form method=POST action=list.php>\n";
echo "<td width=405 align=center valign=bottom>\n";
echo "<img src='../images/search.gif' width=16 heigth=16> ";

echo "标题<input type=checkbox name=title value='1' ";
echo ($name == 0 ? '' : checked);
echo ">\n";

echo "内容<input type=checkbox name=text value='1' ";
echo ($brief == 0 ? '' : checked);
echo ">\n";

echo "<input class=border type=text name=keyword size=12 style='color:#000000; background-color:#efefef'>\n";

echo "<select size=1 name=searchtype style='color:#000000; border-style:solid; border-width:1; background-color:#efefef'>\n";
echo "<option value=0 selected>所有文章</option>\n";
while ($typerow=mysql_fetch_array($typeresult)) {
echo "<option value=".$typerow[id].">".$typerow[name]."</option>\n";
}


echo "</select> \n";

echo "<input class=border type=submit value=搜索 name=search style='color: #000000; background-color: #efefef'>\n";
echo "</td></form>";


// 跳转分类 -----------------------------

goto($type);

echo "</tr>\n";
echo "</table>\n";
echo "<br>\n";


// ---------------------------------------

echo "<table border=0 cellspacing=0 style='border-collapse:collapse' width=735 height=233 cellpadding=3>\n";
echo "<tr>\n";


// 栏目菜单 ------------------------------

echo "<td width=185 valign=top>\n";
adminmenu();
echo "</td>\n";


// ---------------------------------------

echo "<td width=550 height=233 valign=top>\n";


// 转到搜索 ------------------------------

if ($search):
search($keyword,$searchtype,$title,$text);
end;
else:


// ------------------------- open record -------------------------

$sql = "SELECT * FROM $ym_article_table WHERE id=$id";
$result = mysql_db_query($dbname, $sql);
$row = mysql_fetch_array($result);
$date = date($datetxt,$row[date]);

?>

<center>
<table  style="border-collapse: collapse" bordercolor="#111111" bgcolor=#efefef border=1 cellspacing=0 cellpadding=3 width=500><col width=100><col width=400>

<tr bgcolor=#f7f7f7>
<form action="edit.php" method="POST">
<td align=right>ID:</td>
<td><input type=text name=id size=40 value="<? echo $id;?>" readonly></td>
</tr>

<tr>
<td align=right>标题:</td>
<td><input type=text name=title size=40 value="<? echo $row[title];?>"></td>
</tr>

<tr bgcolor=#f7f7f7>
<td align=right>作者:</td>
<td><input type=text name=author size=20 value="<? echo $row[author];?>"></td>
</tr>

<tr>
<td align=right>来源:</td>
<td><input type=text name=fromsite size=20 value="<? echo $row[fromsite];?>"></td>
</tr>

<tr bgcolor=#f7f7f7>
<td align=right>内容:</td>
<td><textarea rows=8 name=text cols=50><? echo $row[text];?></textarea></td>
</tr>

<tr>
<td align=right>图片文件:</td>
<td><input type=text name=img size=30 value="
<?
if (empty($img_name)):
echo $row[img];
else:
echo $img_name;
endif;
?>
">
只需填文件名, 如有请先上传↓</td>
</tr>

<tr bgcolor=#f7f7f7>
<td align=right>压缩文件:</td>
<td><input type=text name=download size=30 value="
<?
if (empty($file_name)):
echo $row[download];
else:
echo $file_name;
endif;
?>
">
只需填文件名, 如有请先上传↓</td>
</tr>

<tr>
<td align=right>原日期:</td>
<td><? echo $date;?></td>
</tr>

<tr bgcolor=#f7f7f7>
<td align=right>程序分类:</td>
<?

$typesql = "SELECT COUNT(*) AS rcnt FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql) or die ("查询失败");
$typerow = mysql_fetch_array($typeresult);

$typesql = "SELECT * FROM $ym_article_sort_table ORDER BY id";
$typeresult = mysql_db_query($dbname, $typesql);
?>
<td><select size=1 name=sortid>
<?
while ($typerow=mysql_fetch_array($typeresult)){
if ($typerow[id] == $row[sortid]):
echo "<option value=".$typerow[id]." selected>".$typerow[name]."</option>\n";
else:
echo "<option value=".$typerow[id].">".$typerow[name]."</option>\n";
endif;
}


?>
</select>
</td>
</tr>

<tr>
<td align=right>今日浏览:</td>
<td><input type=text name=today_view size=20 value="<? echo $row[today_view];?>"></td>
</tr>

<tr bgcolor=#f7f7f7>
<td align=right>总浏览:</td>
<td><input type=text name=view size=20 value="<? echo $row[view];?>"></td>
</tr>

<tr>
<td align=right>是否显示:</td>
<td><input type=checkbox name=isshow value='1' 
<? echo ($row[isshow] == 0 ? '' : checked);?>
></td>
</tr>

<tr bgcolor=#f7f7f7>
<td align=right>使用HTML:</td>
<td><input type=checkbox name=ishtml value='1' 
<? echo ($row[ishtml] == 0 ? '' : checked);?>
></td>
</tr>

<tr>
<td width=492 colspan=2 align=center>
<input type=submit value=" 提交 " name=sendedit>
<input type=reset value=" 重填 "></td>
</form>
</tr>
</table>
<br>

<table border=0 cellspacing=0 cellpadding=3 width=500>
<col width=100><col width=400>
<tr><td width=100% align=center><img src=../images/note.gif>
<b>注意: 上传文件的同时也将删除旧的文件.</b>
</td></tr>
</table>

<br>
<table  style="border-collapse: collapse" bordercolor="#111111" bgcolor=#efefef border=1 cellspacing=0 cellpadding=3 width=500>
<col width=100><col width=400>
<tr><form enctype="multipart/form-data" action="

<?
if (empty($img_name)):
$old_img_name = $row[img];
else:
$old_img_name = $img_name;
endif;
echo "up_img.php?file=edit.php&id=$id&file_name=$file_name&old_img_name=$old_img_name";
?>

" method="POST">
<td align=right>图片文件:</td>
<td>
<input type=file name=upfile size=30 value="">
<input type=submit value=" 上传 ">
</td>
</form>
</tr>
</table>
<br>
<table  style="border-collapse: collapse" bordercolor="#111111" bgcolor=#efefef border=1 cellspacing=0 cellpadding=3 width=500>
<col width=100><col width=400>
<tr>
<form enctype="multipart/form-data" action="

<?
if (empty($file_name)):
$old_file_name = $row[download];
else:
$old_file_name = $file_name;
endif;
echo "up_file.php?file=edit.php&id=$id&img_name=$img_name&old_file_name=$old_file_name";
?>

" method="POST">
<td align=right>压缩文件:</td>
<td>
<input type=file name=upfile size=30 value="">
<input type=submit value=" 上传 ">
</td>
</form>
</tr>
</table>


<?

endif; // if search

echo "</td>\n";

echo "</tr>\n";
echo "</table>\n";
echo "<br><hr width=735>\n";


// ------------------------- -------- ------------------------- //

include ("../include/footer.inc.php");

// ------------------------- -------- ------------------------- //

//check id
else:
echo "<br><center><a href=list.php>ID 错误</a><br>";
echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=list.php'>";
exit;
endif;

mysql_close();

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -