Our Scripts Vault contains many game scripts that you can use to create your own game!
I'm trying to make a simple PHP encoder for no reason at all (Could come in useful some day though...)Here's what I got so far:<?php$compressed = stripslashes($_POST['code']);for ($i = 1; $i <= 10; $i++) { $compressed = gzdeflate($compressed, 9); $compressed = chunk_split(base64_encode($compressed)); $compressed = "eval(gzinflate(base64_decode('" . $compressed . "')));";}?><form method="post" action="encode.php"><textarea style="width: 900px; height: 600px;" name="code"><?=$compressed?></textarea><br /><input type="submit" value="Encode!" /></form>It doesn't really do much, just uses base64 and gzdeflate to 'encode' chunks of code.I'm wondering, what else could I do to improve the encoding process? I've seen some other encoders (http://www.rightscripts.com/phpencode/index.php), and they seem to generate some extra code to confuse you.
<?php$compressed = stripslashes($_POST['code']);$newline = array("\r\n", "\n", "\r");$replace = ' ';$compressed = str_replace($newline, $replace, $compressed);$code = token_get_all($compressed);$new_code = "";foreach($code as $token){ if ($token == ";") { $new_code .= $token; } else { $name = token_name(intval($token[0])); if ($name != "T_COMMENT" && $name != "T_ML_COMMENT" && $name != "T_OPEN_TAG" && $name != "T_CLOSE_TAG") { $new_code .= $token[1]; } else { //echo $name . " thrown away.<br />"; } }}for ($i = 1; $i <= 10; $i++) { $compressed = gzdeflate($new_code, 9); $compressed = chunk_split(base64_encode($compressed)); $compressed = "eval(gzinflate(base64_decode('" . $compressed . "')));";}?><form method="post" action="encode.php"><textarea style="width: 900px; height: 600px;" name="code"><?=$compressed?></textarea><br /><input type="submit" value="Encode!" /></form>