(模板修改功能)在后台直接修改代码
2013-10-31 12:45
387 查看
例如:修改网站beau根目录下的index文件,
<?php
require_once '../include/adminfunction.php';
date_default_timezone_set('PRC');
checkadmin();//sysfunction.php里面的方法,验证是否已经登录
$action=var_request("action","");//获取action的值
$errmsg = "";
if($action=="ok"){
$ctxtsubmit = var_request("txtsubmit","");
//写入到缓存中.
file_put_contents ("../index.php",$ctxtsubmit);
redirect_to("admin_tpl_index.php?add=ok");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>admin_tpl_index</title>
<link rel="stylesheet" href="css/admin_center.css" type="text/css" />
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="admin_index_nav">
<div class="index_nav_left">模板功能导航 ></div>
<div class="index_nav_right">
<ul>
<li><a href="admin_tpl_index.php" target="centerFrame" style="color:#FF3300">首页模板</a></li>
<li><a href="admin_tpl_list.php" target="centerFrame">列表页模板</a></li>
<li style="display:none"><a href="admin_tpl_goods.php" target="centerFrame">商品页模板</a></li>
<li><a href="admin_tpl_header.php" target="centerFrame">头部模板</a></li>
<li><a href="admin_tpl_footer.php" target="centerFrame">底部模板</a></li>
</ul>
</div>
</div>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15" height="30"><img src="images/main_01.gif" width="15" height="30" /></td>
<td width="1101" background="images/main_02.gif"><img src="images/center_ico01.gif" width="16" height="16" /> <span class="STYLE1">首页模板 index.php</span></td>
<td width="281" background="images/main_02.gif"><table border="0" align="right" cellpadding="0" cellspacing="0">
</table></td>
<td width="14"><img src="images/main_03.gif" width="14" height="30" /></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9" background="images/main_04.gif"> </td>
<td bgcolor="#f3ffe3"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#c0de98">
<tr>
<td width="100%" height="580" bgcolor="#FFFFFF" class="STYLE2">
<form name="form" method="post" action="admin_tpl_index.php?action=ok">
<textarea name="txtsubmit" cols="150" rows="40" style="border:solid 1px #cadcb2; font-size:12px; color:#333;">
<?php
$fp = file_get_contents("../index.php");
echo $fp;
?>
</textarea>
</form>
</td>
</tr>
</table></td>
<td width="9" background="images/main_06.gif"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15" height="29"><img src="images/main_07.gif" width="15" height="29" /></td>
<td width="100%" background="images/main_08.gif" style="text-align:right">
<img src="images/button02.gif" style="cursor:hand; padding-right:10px;" onClick="javascript:form.submit();">
<img src="images/button03.gif" style="cursor:hand; padding-right:10px;" onClick="javascript:form.reset();">
</td>
<td width="14"><img src="images/main_09.gif" width="14" height="29" /></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
require_once '../include/adminfunction.php';
date_default_timezone_set('PRC');
checkadmin();//sysfunction.php里面的方法,验证是否已经登录
$action=var_request("action","");//获取action的值
$errmsg = "";
if($action=="ok"){
$ctxtsubmit = var_request("txtsubmit","");
//写入到缓存中.
file_put_contents ("../index.php",$ctxtsubmit);
redirect_to("admin_tpl_index.php?add=ok");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>admin_tpl_index</title>
<link rel="stylesheet" href="css/admin_center.css" type="text/css" />
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="admin_index_nav">
<div class="index_nav_left">模板功能导航 ></div>
<div class="index_nav_right">
<ul>
<li><a href="admin_tpl_index.php" target="centerFrame" style="color:#FF3300">首页模板</a></li>
<li><a href="admin_tpl_list.php" target="centerFrame">列表页模板</a></li>
<li style="display:none"><a href="admin_tpl_goods.php" target="centerFrame">商品页模板</a></li>
<li><a href="admin_tpl_header.php" target="centerFrame">头部模板</a></li>
<li><a href="admin_tpl_footer.php" target="centerFrame">底部模板</a></li>
</ul>
</div>
</div>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15" height="30"><img src="images/main_01.gif" width="15" height="30" /></td>
<td width="1101" background="images/main_02.gif"><img src="images/center_ico01.gif" width="16" height="16" /> <span class="STYLE1">首页模板 index.php</span></td>
<td width="281" background="images/main_02.gif"><table border="0" align="right" cellpadding="0" cellspacing="0">
</table></td>
<td width="14"><img src="images/main_03.gif" width="14" height="30" /></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9" background="images/main_04.gif"> </td>
<td bgcolor="#f3ffe3"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#c0de98">
<tr>
<td width="100%" height="580" bgcolor="#FFFFFF" class="STYLE2">
<form name="form" method="post" action="admin_tpl_index.php?action=ok">
<textarea name="txtsubmit" cols="150" rows="40" style="border:solid 1px #cadcb2; font-size:12px; color:#333;">
<?php
$fp = file_get_contents("../index.php");
echo $fp;
?>
</textarea>
</form>
</td>
</tr>
</table></td>
<td width="9" background="images/main_06.gif"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15" height="29"><img src="images/main_07.gif" width="15" height="29" /></td>
<td width="100%" background="images/main_08.gif" style="text-align:right">
<img src="images/button02.gif" style="cursor:hand; padding-right:10px;" onClick="javascript:form.submit();">
<img src="images/button03.gif" style="cursor:hand; padding-right:10px;" onClick="javascript:form.reset();">
</td>
<td width="14"><img src="images/main_09.gif" width="14" height="29" /></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
相关文章推荐
- (模板修改功能)在后台直接修改代码
- PHP直接修改表内容DataGrid功能实现代码
- PHP直接修改表内容DataGrid功能实现代码
- 善用Eclipse的代码模板功能
- eclipse中安装thymeleaf插件完成thymeleaf模板中自动代码提示功能
- ASP.NET程序中动态修改web.config中的设置项目(后台CS代码)
- PyDev:修改代码模板自动添加encoding=utf8,避免中文乱码
- 修改Myeclipse中Servlet和jsp的模板代码
- 通过.NET实现后台自动发送Email功能的代码示例
- 将jeecms中微信后台功能和前台认证以及接收消息的功能,修改为插件形式
- 基本上,把switch,用设计模式代替,肯定是bug和过度设计。想想,本来修改一个文件几行代码可以解决的问题,变成修改3-6个类才能实现一样的功能。不是傻是什么?
- HttpModule 实现 ASP.Net (*.aspx) 中文简繁体的自动转换,不用修改原有的任何代码,直接部署即可!
- dede织梦后台页面及功能修改及精简操作方法
- VS2010快速生成代码模板功能介绍
- asp.net中用LinkButton控制后台代码使其可以进行编辑,预览,删除功能
- IntelliJ IDEA 中如何设置如:sys直接输出一行等等的快捷编辑操作----即:代码的快捷编辑模板(Live Templates)设置
- powerdesigner 生成实体代码 模板的修改
- 简易后台代码模板
- MyEclipse使用总结——修改MyEclipse默认的Servlet和jsp代码模板
- 善用Eclipse的代码模板功能