The basic steps to obfuscate a part of a webpage is the same as obfuscating the whole page, which is explained in the first example.
To obfuscate a part of a webpage,
1 |
first enclose the code that you want to obfuscate inside <?php HObfus_begin(); ?> and <?php HObfus_end(); ?>, like shown below. |
<?php echo HObfus_begin(); ?> <div> <span> <?php echo "The current time is ".date("Y-m-d H:i:s"); ?> </span> </div> <?php HObfus_end(); ?>
Make sure that all paired HTML tags are closed and the HTML is formatted properly. Malformed HTML code can cause issues with HObfus.
2 |
Include hobfus/HObfus.inc.php using the require_once() function, like shown below. |
<?php require_once("PATH-TO-HObfus.inc.php"); ?>
.................
.................
.................
.................
.................
<?php echo HObfus_begin(); ?>
<div>
<span>
<?php echo "The current time is ".date("Y-m-d H:i:s"); ?>
</span>
</div>
<?php HObfus_end(); ?>
You must replace PATH-TO-HObfus.inc.php with the actual path to hobfus/HObfus.inc.php. If you are not sure about the path, see Find path to HObfus.inc.php for more details.
The position of require_once() is usually at the top of the PHP file, however, you can place it anywhere as long as it comes before the first <?php HObfus_begin(); ?>.