Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- function strip_php_comments($str){
- $str = str_replace("<?php", '<?php ', $str);
- $str = str_replace("\r", '', $str);
- $str = ereg_replace("/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/", '', $str);
- $str = ereg_replace("//[\x20-\x7E]*\n",'', $str);
- $str = preg_replace('/^([^#"\']*?)#.*/','',$str);
- $str = ereg_replace("\t|\n", '', $str);
- return $str;
- }
- function buildFile($in,$out){
- if(is_file($in)){
- echo "Building: $in\n";
- $name = $in;
- $out = fopen($out, 'w');
- $in = strip_php_comments(parseInclude($in));
- fwrite($out,"#!/usr/bin/php\n".$in);
- echo "Build of {$name} Complete\n";
- }else{
- echo "File {$in} does not exist\n";
- }
- }
- function parseInclude($in){
- $in = fopen($in, "r");
- $out = '';
- if ($in) {
- while (($buff = fgets($in, 4096)) !== false) {
- if($i = strpos(strtolower($buff),'include(')){
- $i += 9;
- $d = substr($buff,$i-1,1);
- $t = $i;
- while(substr($buff,++$t,1)!=$d){}
- $f = substr($buff,$i,($t-$i));
- echo "Including: {$f}\n";
- $buff = substr_replace($buff,strip_php_comments(parseInclude($f)),$i-9,$t+2-$i);
- }
- if($i = strpos(strtolower($buff),'<?php')){
- $buff = substr_replace($buff,'',$i,5);
- }
- if($i = strpos(strtolower($buff),'?>')){
- $buff = substr_replace($buff,'',$i,2);
- }
- $out = $out.$buff;
- }
- if (!feof($in)) {
- echo "Error: unexpected fgets() fail\n";
- }
- fclose($in);
- return $out;
- }
- }
- buildFile('bot.php','EeeZorBot.php');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement