Advertisement
P22DX

encode.php

Apr 28th, 2020
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Copyright (c) 2020 Ramdhan Firmansyah
  4.  * File              : encode.php
  5.  * @author           : Cvar1984 <gedzsarjuncomuniti@gmail.com>
  6.  * Date              : 28.04.2020
  7.  * Last Modified Date: 28.04.2020
  8.  * Last Modified By  : Cvar1984 <gedzsarjuncomuniti@gmail.com>
  9.  */
  10.  
  11. while (!file_exists($fileName)) {
  12.     $fileName = readline('File Name : ');
  13.     $fileName = trim($fileName);
  14. }
  15.  
  16. $outputName = readline('Output Name : ');
  17. $outputName = trim($outputName);
  18. $fileContents = file_get_contents($fileName);
  19. $fileContents = base64_encode(gzdeflate($fileContents));
  20. $fileContents = '<?php eval(\'?>\' . gzinflate(base64_decode(\'' . $fileContents . '\')));';
  21.  
  22. if (file_put_contents($outputName, $fileContents)) {
  23.     echo 'Original Size : ' . filesize($fileName) . ' Bytes' . PHP_EOL;
  24.     echo 'Encoded Size  : ' . filesize($outputName) . ' Bytes' . PHP_EOL;
  25. } else {
  26.     echo 'Can\'t write output permission denied' . PHP_EOL;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement