-PHP 应用&模版引用&Smarty 渲染&MVC 模型&数据联动&RCE 安全

新闻列表

1 、数据库创建新闻存储
2 、代码连接数据库读取
3 、页面进行自定义显示

自写模版引用

1 、页面显示样式编排
2 、显示数据插入页面
3 、引用模版调用触发
很容易触发代码执行漏洞
#Smarty 模版引用(第三方模板)
下载: https://github.com/smarty-php/smarty/releases
使用:
1 、创建一个文件夹,命名为 smarty-demo 。
2 、下载 Smarty 对应版本并解压缩到该文件夹中。
3 、创建一个 PHP 文件,命名为 index.php ,并在文件中添加以下代码:
<?php
// 引入 Smarty 类文件
require('smarty-demo/libs/Smarty.class.php');
// 创建 Smarty 实例
smarty = new Smarty; // 设置 Smarty 相关属性 smarty->template_dir = 'smarty-demo/templates/';
smarty-\>compile_dir = 'smarty-demo/templates_c/'; smarty->cache_dir = 'smarty-demo/cache/';
smarty-\>config_dir = 'smarty-demo/configs/'; // 赋值变量到模板中 smarty->assign('title', ' 欢迎使用 Smarty');
// 显示模板
smarty-\>display('index.tpl'); ?\> 4 、创建一个名为 index.tpl 的模板文件,并将以下代码复制到上述点定义文件夹中 \ \ \ \{title}</title>
</head>
<body>
<h1>{$title}</h1>
<p> 这是一个使用 Smarty 的例子。 </p>

相关推荐
梦6502 小时前
网络传输七层协议
开发语言·网络·php
lifeng43213 小时前
2、 网络安全基础 -- 传输层详解 -- DDos攻击
网络·安全·web安全
lpfasd1233 小时前
Docker 使用注意事项:从磁盘爆满到安全实践的完整避坑指南
安全·docker·容器
程序员哈基耄3 小时前
安全高效,本地运行:全能文件格式转换工具
大数据·python·安全
Whisper_Sy4 小时前
Flutter for OpenHarmony移动数据使用监管助手App实战 - 周报告实现
开发语言·javascript·网络·flutter·php
源力祁老师5 小时前
Odoo日志系统核心组件_logger
网络·数据库·php
哪里不会点哪里.6 小时前
Spring MVC 核心原理解析:从请求到响应到底发生了什么?
java·spring·mvc
acrelgxy6 小时前
工商业用电“降本+安全”双解:安科瑞AESB储能一体机,开启用电新范式
安全·电能管理系统·电力监控系统·智能电力仪表
pwn蒸鱼7 小时前
buuctf中的mrctf2020_shellcode
linux·安全