perhaps something like this
PHP Code:
<?php
$script = file_get_contents('path/to/script.php');
$encoded = base64_encode($script);
$encodedscript = '$decoded = base64_decode($encoded); eval($decoded);';
file_put_contents('path/to/base64script.php', $encodedscript);
?>
? Completely untested.
Honestly, though, this is how it goes: the client pays, then he gets the product. If he wants to see that it works beforehand, maybe you could host a demo for him.
It's not rude or a ripoff. It's practical. If you deliver a script, the client has it. You can't take it back. Even encoding it like this isn't all that helpful. If the client doesn't trust you enough to pay you, that is where the problem is.
Edit:
This works, with a few restrictions:
PHP Code:
<?php
$script = file_get_contents('weird.php');
$encoded = base64_encode($script);
$encodedscript = '<?php $decoded = base64_decode("'.$encoded.'"); eval($decoded); ?>';
file_put_contents('tooweird.php', $encodedscript);
?>
First, I had to fix a few syntax errors. Note, in particular, that $encoded (inside base64_decode()) is now "quoted" correctly.
Second, (assuming this is a php script), the $encodedscript needs to have <?php ?> tags.
Third (and therefore), the script being encoded can not have <?php ?> tags, as they would create a parse error. You might be able to solve that like this:
PHP Code:
$encodedscript = '<?php $decoded = '?>'.base64_decode("'.$encoded.'").'<?php'; eval($decoded); ?>';
But I think things are getting silly at this point.
Bookmarks