Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,
I was just studying some WP code so i found one code as below:
XML
<?php $xml='PGRpdiBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB0b3A6IDBweDsgbGVmdDogLTcwMDBweDsiPlRlbXBsYXRlcyBieSA8YSB0YXJnZXQ9Il9ibGFuayIgaHJlZj0iaHR0cDovL2JpZ3RoZW1lLm5ldC8iPkJJR3RoZW1lIE5FVDwvYT48L2Rpdj4=';
 echo base64_decode($xml);?>

At the time of echoing this code i found this like
HTML
<div style="removed: absolute; removed 0px; removed -7000px;">Templates by <a href="http://bigtheme.net/" target="_blank">BIGtheme NET</a></div>

And HTML OUT PUT
IS>> Templates by BIGtheme.NET

SO MY QUESTION IS HOW CAN I CODE LIKE THIS TOO?

Thank in advance. :)
Posted

1) Anything like this is useless. Base64 encoding is no encryption. It makes any 8-bit data transmittable over legacy 7-bit channel (making the string only from printable ascii characters).
2) There is nowhere any "conversion" to xml.
3) If you want base64 encoded string, you can use Notepad++ built in plugin, or you can use online tools, like this: https://www.base64decode.org/[^]
 
Share this answer
 
v2
Comments
Vasid Qureshi 11-Oct-15 9:44am    
Thank you very much for your Reply..!!! :)
After googling i just tried and the below code and come to know about the issue :)
CODE PROJECT';
echo base64_encode($str)."<br/>";
$xml=base64_encode($str);
echo base64_decode($xml);

?>
Patrice T 11-Oct-15 10:12am    
base 64 is 6 bits
Zoltán Zörgő 11-Oct-15 12:50pm    
Right, it is using only the printable subset of ASCII, but the goal with it was to make the message fit into the 7-bit ASCII.
Rather simple:
First, you have to create the code from what will be the result later.
PHP
<?php $xml='<div style="removed: absolute; removed 0px; removed -7000px;">Templates by <a href="http://bigtheme.net/" target="_blank">BIGtheme NET</a></div>';<br mode="hold" /?> echo base64_encode($xml);?>

which gives you
PGRpdiBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB0b3A6IDBweDsgbGVmdDogLTcwMDBweDsiPlRlbXBsYXRlcyBieSA8YSB0YXJnZXQ9Il9ibGFuayIgaHJlZj0iaHR0cDovL2JpZ3RoZW1lLm5ldC8iPkJJR3RoZW1lIE5FVDwvYT48L2Rpdj4=


Then you copy/paste the result in
PHP
<?php $xml='Paste here';<br mode="hold" /?> echo base64_decode($xml);?>
 
Share this answer
 
Comments
Vasid Qureshi 11-Oct-15 9:46am    
Thank you for your quick answer!! :)
After googling i just tried this code
CODE PROJECT';
echo base64_encode($str)."<br/>";
$xml=base64_encode($str);
echo base64_decode($xml);

?>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900