Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php include("config.php"); $dataId = new Urlcrypt; echo $dataId->decode("ffdhdfhdf")..
Decoded Output download
<?php include("config.php");
$dataId = new Urlcrypt;
echo $dataId->decode("ffdhdfhdf");die;
?>
<!DOCTYPE html>
<html>
<body>
<p>Click the button to trigger a function that will output "Hello World" in a p element with id="demo".</p>
<button onclick="processAjaxData('Click the button','khetesh')">Click me</button>
<button onclick="processAjaxData('Click the button','fghfg')">Click me</button>
<p id="demo"></p>
<script type="text/javascript">
function processAjaxData(response, urlPath){
document.title = response;
window.history.pushState(urlPath);
}
</script>
<script type="text/javascript">
function ChangeUrl(title, url) {
if (typeof (history.pushState) != "undefined") {
var obj = { Title: title, Url: url };
history.pushState(obj, obj.Title, obj.Url);
} else {
alert("Browser does not support HTML5.");
}
}
</script>
<!--input type="button" value="Page1" onclick="ChangeUrl('Page1', 'Page1.htm');" />
<input type="button" value="Page2" onclick="ChangeUrl('Page2', 'Page2.htm');" />
<input type="button" value="Page3" onclick="ChangeUrl('Page3', 'Page3.htm');" /-->
</body>
</html>
<?php
define('SALT', 'h');
function encrypt($text)
{
// return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
return trim(base64_encode($text));
}
function decrypt($text)
{
// return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
return trim( base64_decode($text));
}
$encryptedmessage = encrypt(45);
echo decrypt($encryptedmessage);
echo "<br />";
//echo $encryptedmessage;
$input = 45;
$encrypted = encryptIt( $input );
$decrypted = decryptIt( $encrypted );
echo $encrypted . '<br />' . $decrypted;
function encryptIt( $q ) {
$cryptKey = 'd2';
$qEncoded = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $q, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) );
return( $qEncoded );
}
function decryptIt( $q ) {
$cryptKey = 'd2';
$qDecoded = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $q ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "");
return( $qDecoded );
}
function thumbCreation($file = 'image.png', $maxwidth = 1366){
$info = getimagesize($file);
$image_width = $info[0];
$image_height = $info[1];
$ratio = $image_width / $maxwidth;
$ext = pathinfo(basename($file),PATHINFO_EXTENSION);
$fileOname = "../thumb/".basename($file,".$ext");
$file_name = $fileOname."_$maxwidth.$ext";
if ($image_width > $maxwidth) {
$newwidth = $maxwidth;
$newheight = (int)($image_height / $ratio);
if ($info['mime'] == 'image/jpeg') {
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($file);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
echo imagejpeg($thumb,$file_name,100);
}
if ($info['mime'] == 'image/jpg') {
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($file);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
echo imagejpeg($thumb,$file_name,100);
}
if ($info['mime'] == 'image/png') {
$im = imagecreatefrompng($file);
$im_dest = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($im_dest, false);
imagecopyresampled($im_dest, $im, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
imagesavealpha($im_dest, true);
echo imagepng($im_dest, $file_name, 9);
}
if ($info['mime'] == 'image/gif') {
$im = imagecreatefromgif($file);
$im_dest = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($im_dest, false);
imagecopyresampled($im_dest, $im, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
imagesavealpha($im_dest, true);
echo imagegif($im_dest, $file_name);
}
}
}
?>
Did this file decode correctly?
Original Code
<?php include("config.php");
$dataId = new Urlcrypt;
echo $dataId->decode("ffdhdfhdf");die;
?>
<!DOCTYPE html>
<html>
<body>
<p>Click the button to trigger a function that will output "Hello World" in a p element with id="demo".</p>
<button onclick="processAjaxData('Click the button','khetesh')">Click me</button>
<button onclick="processAjaxData('Click the button','fghfg')">Click me</button>
<p id="demo"></p>
<script type="text/javascript">
function processAjaxData(response, urlPath){
document.title = response;
window.history.pushState(urlPath);
}
</script>
<script type="text/javascript">
function ChangeUrl(title, url) {
if (typeof (history.pushState) != "undefined") {
var obj = { Title: title, Url: url };
history.pushState(obj, obj.Title, obj.Url);
} else {
alert("Browser does not support HTML5.");
}
}
</script>
<!--input type="button" value="Page1" onclick="ChangeUrl('Page1', 'Page1.htm');" />
<input type="button" value="Page2" onclick="ChangeUrl('Page2', 'Page2.htm');" />
<input type="button" value="Page3" onclick="ChangeUrl('Page3', 'Page3.htm');" /-->
</body>
</html>
<?php
define('SALT', 'h');
function encrypt($text)
{
// return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
return trim(base64_encode($text));
}
function decrypt($text)
{
// return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
return trim( base64_decode($text));
}
$encryptedmessage = encrypt(45);
echo decrypt($encryptedmessage);
echo "<br />";
//echo $encryptedmessage;
$input = 45;
$encrypted = encryptIt( $input );
$decrypted = decryptIt( $encrypted );
echo $encrypted . '<br />' . $decrypted;
function encryptIt( $q ) {
$cryptKey = 'd2';
$qEncoded = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $q, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) );
return( $qEncoded );
}
function decryptIt( $q ) {
$cryptKey = 'd2';
$qDecoded = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $q ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0");
return( $qDecoded );
}
function thumbCreation($file = 'image.png', $maxwidth = 1366){
$info = getimagesize($file);
$image_width = $info[0];
$image_height = $info[1];
$ratio = $image_width / $maxwidth;
$ext = pathinfo(basename($file),PATHINFO_EXTENSION);
$fileOname = "../thumb/".basename($file,".$ext");
$file_name = $fileOname."_$maxwidth.$ext";
if ($image_width > $maxwidth) {
$newwidth = $maxwidth;
$newheight = (int)($image_height / $ratio);
if ($info['mime'] == 'image/jpeg') {
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($file);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
echo imagejpeg($thumb,$file_name,100);
}
if ($info['mime'] == 'image/jpg') {
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($file);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
echo imagejpeg($thumb,$file_name,100);
}
if ($info['mime'] == 'image/png') {
$im = imagecreatefrompng($file);
$im_dest = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($im_dest, false);
imagecopyresampled($im_dest, $im, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
imagesavealpha($im_dest, true);
echo imagepng($im_dest, $file_name, 9);
}
if ($info['mime'] == 'image/gif') {
$im = imagecreatefromgif($file);
$im_dest = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($im_dest, false);
imagecopyresampled($im_dest, $im, 0, 0, 0, 0, $newwidth, $newheight, $image_width, $image_height);
imagesavealpha($im_dest, true);
echo imagegif($im_dest, $file_name);
}
}
}
Function Calls
| None |
Stats
| MD5 | 5974efdf8fa6a73298cd86ff1d95b10d |
| Eval Count | 0 |
| Decode Time | 95 ms |