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:
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. ^_*
December 9th, 2006 at 10:19 am
what a nice idea . ..
Anda layak jadi ependiers sejati
December 12th, 2006 at 1:58 pm
this is crap!! what about people with reduced visibility who are using a screenreader to read the webpage? This is against all web standards!
September 19th, 2007 at 3:02 pm
Gua bisa grap pake PHP tinggal di str_replace semua di dalam terus di strip_tags…
Gampang khan???
September 20th, 2007 at 5:50 pm
@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.
March 11th, 2008 at 12:07 am
Good idea !, great job ! I was looking at a similar solution, thanks.