<?php
/*
LICENSE
=======
Copyright (C) 2005 Martijn Loots, Cosix Automatisering, NL
PhpCodeBuster is a PHP code obfuscator, written in PHP.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
A copy of the GNU General Public License is available at
http://www.gnu.org/copyleft/gpl.html
*/
// This script is a VERY simplistic demo / proof of concept
// to be used in conjunction with PhpCodeBuster.
// Include PhpCodeBuster class
require_once ('class/phpcodebuster.class.php');
// Create a new object
$buster = new PhpCodeBuster();
// Initial class settings
$buster->StripComments = true;
$buster->BustNames = true;
$buster->BustVars = true;
// Put the form on the page.
//
// 2 panes if there's a result present (top pane containing the busted code)
// 1 pane if there's no result present (to accept the code to be busted)
//
function bustform($result = false) {
global $buster;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Bust It !</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<form method="post" action="bustit.php">
<table>
<tr><th><u><?echo $buster->PhpBustVersion();?></u></th></tr>
<?if ($result) {?>
<tr><th>Busted code</th><tr>
<tr><td><textarea rows=8 cols=50><?echo $result;?></textarea></td></tr>
<tr><td><br /><hr /><br /></td></tr><?}?>
<tr><th>Code to be busted</th><tr>
<tr><td><textarea name="bustcode" rows=8 cols=50></textarea></td></tr>
<tr><td><br /><hr /><br /></td></tr>
<tr>
<th>
<input type="submit" name="submit" value="Big Bust">
<input type="submit" name="submit" value="Debugable Bust">
</th>
</tr>
</table>
</form>
</body>
</html>
<?php
}
// Form processing
if ($howtobust = $_REQUEST['submit']) {
// One of the buttons has been pressed
switch ($howtobust) {
case "Big Bust":
// Ensure best busting settings
$buster->StripEOL = true;
$buster->BustPlain = false;
break;
case "Debugable Bust":
// Bust code, but readability remains mostly intact
$buster->StripEOL = false;
$buster->BustPlain = true;
break;
default:
// Tried to hack me, or what ?
bustform("Sorry, something weird happened...");
exit;
}
// Call the obfuscator with complete content, not a filename
$result = $buster->PhpBustCode(stripslashes($_REQUEST['bustcode']), false);
// Back to the form, this time with some results
bustform(htmlentities($result));
}
else
// Display the form
bustform();
?>