Advertisement
cahyadsn

encoder.lite.php

Jul 19th, 2015
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.27 KB | None | 0 0
  1. <?php
  2. /********************************************************
  3. // function untuk memecah suatu strings dalam beberapa bagian
  4. // dalam bentuk array (dalam php5, sama dengan function 'str_split()'
  5. // the_string : string inputan yang akan dipecah
  6. // the_number : jumlah karakter dalam satu baris
  7. */
  8. function stringsplit($the_string, $the_length){
  9.   $startoff_nr = 0;
  10.   $the_output_array = array();
  11.   for($z = 1; $z < ceil(strlen($the_string)/$the_length)+1 ; $z++){
  12.     $startoff_nr = ($the_length*$z)-$the_length;
  13.     $the_output_array[] = substr($the_string, $startoff_nr, $the_length);
  14.   }
  15.   return($the_output_array);
  16. }
  17. /********************************************************
  18. // function untuk mengencode suatu strings
  19. */
  20. function encode($strEncode){
  21.   $c=rand(1,15);
  22.   $strEncode=stripslashes($strEncode);
  23.   if($strEncode){
  24.     if(substr($strEncode,0,1)=="<"){
  25.       $strEncode='?>'.$strEncode.'<?php';
  26.     }  
  27.     for($j=0;$j<$c-1;$j++){
  28.       if($j==$c-1){
  29.         $strEncode=$strEncode."//".($c<10?"0".$c:$c);
  30.       }
  31.       $strEncode1=base64_encode(gzdeflate($strEncode));
  32.       $strEncode="eval(gzinflate(base64_decode('".$strEncode1."')));";
  33.     }
  34.   }
  35.   $strEncode="<?php \n".$strEncode."\n ?>";
  36.   $arr=stringsplit($strEncode,70);
  37.   $strEncode=$arr[0];
  38.   for($i=1;$i<count($arr);$i++){
  39.     $strEncode.="\n".$arr[$i];
  40.   }
  41.   $strEncode=str_replace("\n\n","\n",$strEncode);
  42.   return $strEncode;
  43. }
  44. ?>
  45. <!doctype html>
  46. <html>
  47.   <head>
  48.     <title>phpEncoder</title>
  49.     <style>
  50.       * {font-family:calibri,tahoma,arial,sans-serif;font-size:1em;}
  51.       .farea {width:40.5em;height:14em;}
  52.       .tarea {width:40em;height:10em;}
  53.     </style>
  54.   </head>
  55.   <body>
  56.     <fieldset class='farea'>
  57.       <legend>Source</legend>
  58.       <form method='post'>
  59.         <textarea name='source' class='tarea'></textarea><br/>
  60.         <input type='submit' name='submit' value='process'>
  61.       </form>
  62.     </fieldset>
  63.     <fieldset class='farea'<?php if(!isset($_POST['source'])) echo " style='display:none'";?>>
  64.       <legend>Result</legend>
  65.       <textarea class='tarea'><?php echo (isset($_POST['source']) && !empty($_POST['source']))?encode(addslashes($_POST['source'])):'';?></textarea>
  66.     </fieldset>
  67.     <div>copyright &copy; 2015 by cahyadsn</div>
  68.   </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement