function to obfuscate web text into random design


/ Published in: PHP
Save to your folder(s)

Function for obfuscate Text in html pages. good for making screenshot and mind data protection if needed. changes Text into many small divs with different bgcolor.


Copy this code and paste it in your HTML
  1. function makeTextUnreadable($word,$width=1,$height=3) {
  2. $arr=['#ddd','#453','#aaa','#111'];
  3. $back = "";
  4. for($i=0; $i < strlen($word); $i++) {
  5. $back .= '<div style="height: '.($height*4).'px;width: '.($width*4).'px;float: left;">';
  6. for($j=0;$j<=$height;$j++) {
  7. $back .= '<div style="margin: 0;height: 4px;width: '.($width*4).'px;background-color: '.$arr[rand(0,3)].';"></div>';
  8. }
  9. $back .= '</div>';
  10. }
  11. return $back;
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.