您的位置:首页 > 编程语言

(模板修改功能)在后台直接修改代码

2013-01-09 11:09 218 查看
例如:修改网站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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: