PHP

Invisible text using PHP

This time, let’s try to insert single character with same color as the background inbetween words. This method will avoid visitor to copy paste text from your homepage because they will get a buch of un-understood words.

This is cool (in my own opinion), I insert/replace any white space with single character, and set the color property of ghost class into the same color as the background.

So, visitor will not see the invisible text (yeah, it’s invisible). But when they try to block the text and do a copy-paste operation, all text will be all within.

First, set ghost class color in your css file or simply put inside STYLE tag as follow:

And here’s the function:< ?php function ghostText($txt){ // set the ASCII characters from 65-122 $ascii_min = 65; $ascii_max = 122; // let's do the job! $txts = explode(" ",$txt); foreach($txts as $teks){ $hasil .= $teks."".chr(mt_rand($ascii_min,$ascii_max))."";
}
return ($hasil);
}
?>

You can see the sample here: Sample invisible text using PHP.

It only avoid copy paste. By grabbing the HTML and using strip_tags() function, your text will be easily stolen.

 

Update #1

I got some complains saying that this function is out of web standard and not good for people with disability and use screen reader. And I said yes, this function is not suit on web standard. This only for normal users and to avoid your text being copy-paste’ed by lamers.

So if you’re concern on web standard, please do not use this script/function.

Update #2

I’ve changed the code so it will be faster than this one. Please read faster inserting random invisible character inbetween words. ^_*

 

5 Comments

  1. what a nice idea . ..
    Anda layak jadi ependiers sejati 😀

    and salute to master of ependiers 😀

  2. maarten

    this is crap!! what about people with reduced visibility who are using a screenreader to read the webpage? This is against all web standards!

    Yep, I agree if this is crap. This is not intended for web standard. It only used to avoid your text being copy-paste’ed by lamers.

  3. sutello

    Gua bisa grap pake PHP tinggal di str_replace semua di dalam terus di strip_tags…
    Gampang khan???

  4. @sutello
    as I said before: “This only for normal users and to avoid your text being copy-paste’ed by lamers.“.

    as long as the reader isn’t a lamer, they’ll still can figure it out.

  5. Good idea !, great job ! I was looking at a similar solution, thanks.

Leave a Reply