当有人移除我的主题页脚的电源时,如何发出通知提醒

时间:2010-04-29 09:35:37

标签: php

我的页脚上的示例链接

$powered = 'Powered by <a href="htp://stackoverflow.com">Stackoverflow</a>';

主题文件

<?php echo $powered; ?>

如果从我的页脚中删除$powered并且错误/提醒通知它,如何制作。

示例die('Do not remove the powered link')

3 个答案:

答案 0 :(得分:6)

简短回答:不可能。

答案 1 :(得分:2)

可能......您可以使用Zend Guard来保护您的代码不被更改。

答案 2 :(得分:2)

答案很长:

<?php

$powered = 'Powered by <a href="htp://stackoverflow.com">Stackoverflow</a>';

ob_start();
echo $powered;
$html = ob_get_clean();

/*
 * If you remove the "echo $powered;" part, please don't remove the following lines
 * so I can detect the license violation. Thank you for your cooperation!
 */
if( strpos($html, $powered)===FALSE ){
    echo die('Do not remove the powered link');
}else{
    echo $html;
}

?>