我一直在写一个 php/html 页面编码器/解码器...我知道它已经存在但它是一个大学项目所以继续 XDDD
我对我想保护的页面进行编码让我们假设使用 base64_encode
并且当我收到任何页面的请求时我有一个加载器读取编码页面,解密它并使用 eval
执行它。当我尝试解密和执行混合的 php/html 页面时,真正的问题出现了。显然 eval
不能执行 html 代码,所以我的问题是我是否真的对拆分执行 php 代码的页面并打印 html 感到疯狂?另外,如果我包含一个编码的 php 或 php/html 页面,我真的必须重用这里的方法吗?
我希望有人能真正帮助我,因为我距离截止日期还有一周,此时我无法更改项目。
chris 这里是函数和第一个调用 $param[0] 的文件名
function MyInclude($filename)
{
// create the temp file
$temp_filename = "tmp.php";
$handle = fopen($temp_filename , 'w+');
if (!$handle)
die('Error creating temp file');
// write the decrypted data, close the handle
$tmp=file_get_contents($filename);
$data=MCrypt_Decode($tmp,'PFL_EPU_V100_mia');
fwrite($handle,$data );
fclose($handle);
// start output buffering to contain any output the script creates
ob_start();
try {
include($temp_filename);
} catch (Exception $e) {
die('There was an error in the encrypted file, cannot process');
}
// get the output, clear the buffer
$output = ob_get_contents();
ob_end_clean();
//destroy the temp file
unlink($temp_filename);
// now you can output the buffer, if desired:
echo $output;
}
MyInclude($param[0]);
$param[0] 文件在这里
<?php
session_start();
$_SESSION['title']='Home';
MyInclude("header.php");
?>
<body>
sono il body <?php echo APP_PATH; ?>
</body>
<?
echo "boss";
MyInclude("footer.php");
?>
有什么想法吗???或者你需要一些其他代码???让我知道T_T
迈克
最佳答案
您可以 eval() 一个包含混合 html 和 php 的字符串,只要包含标签即可。
关于php问题eval/html/php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7181366/