Code:
<?php
define('VERSION', 'PHP Basic Encoder v.0.2 by xam');
// Bu Encoder ornek olmasi amaciyla xam tarafindan hazirlanmistir. unutmayin kirilmasi cok kolay bir yontemdir ama 10 kisiden 3'unu kodlari degistirmekten alikoyar, 2'sini ugrastirir, kalanlari guldurur :) Kolay gelsin
$hata = $kod = '';
$action = isset($_POST['action']) ? $_POST['action'] : '';
$hatalar = array(
1 => 'Lutfen sifrelenmesini istediginiz kod blogunu giriniz.',
2 => 'Islem yapilamiyor.. Bu kod zaten gizlenmis..'
);
function rastgele($length = 10)
{
$set = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9");
$str = '';
for($i = 1; $i <= $length; $i++)
{
$ch = rand(0, count($set)-1);
$str .= $set[$ch];
}
return $str;
}
function gizle($kod)
{
$r = base64_encode(gzdeflate($kod));
$r1 = rastgele();
$r2 = rastgele();
$r3 = rastgele();
return '<?php $'.$r1.'=strrev("etalfnizg");$'.$r2.'="'.$r.'";$'.$r3.'=strrev("edoced_46esab");eval($'.$r1.'($'.$r3.'($'.$r2.'))); ?>';
}
if ($action == 'gizle')
{
$kod = isset($_POST['kod']) ? trim($_POST['kod']) : '';
if (empty($kod))
{
$hata = $hatalar[1];
}
elseif (strstr($kod, 'strrev("etalfnizg")') || strstr($kod, 'strrev("edoced_46esab")'))
{
$hata = $hatalar[2];
}
elseif (strstr($kod, '<?php') || strstr($kod, '<?'))
{
$regex = '#<\?php(.*?)\?>#si';
preg_match_all($regex, $kod, $results, PREG_SET_ORDER);
foreach ($results as $left => $right)
{
$tmp .= gizle($right[1]);
}
$kod = $tmp;
}
else
{
$kod = gizle($kod);
}
}
if (!empty($hata))
{
echo '<script type="text/javascript">alert("'.$hata.'")</script>';
}
$title = (!empty($hata) || empty($action) ? '<span class="style1">Gizlenecek Kod blogu:</span>' : '<span class="style2">Gizlenen Kod Blogu:</span>');
$taclass = (!empty($hata) || empty($action) ? 'style2' : 'style1');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo VERSION; ?></title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style1 {
color: #990000;
font-weight: bold;
}
.style2 {color: #009900}
-->
</style>
</head>
<body>
<form method="POST" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<input type="hidden" name="action" value="gizle">
<?php echo $title; ?>
<textarea name="kod" cols="100" rows="30" wrap="off" class="<?php echo $taclass; ?>"><?php echo $kod; ?></textarea>
<input type="submit" value="Sifrele">
</form>
</body>
</html>