Télécharger la présentation
La présentation est en train de télécharger. S'il vous plaît, attendez
Publié parRodrigue Lhomme Modifié depuis plus de 10 années
1
Laurent Capelli Solution anti SPAM : Codage adresse mail Comment se protéger des robots chercheurs d'adresse mail éviter les chaînes du type « nom@domaine.pays » ou « mailto: » Solution technique proposée et mise en place au CC le cryptage javascript dans le source html, les mails sont cachés tout en les laissant disponibles pour les visiteurs. Une fonction crypte str_rot et lautre décrypte str_unrot et affiche le résultat avec document.write
2
Laurent Capelli Fonction de cryptage (ici en php) function str_rot($string) { $known_letters = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n", "o","p","q","r","s","t","u","v","w","x","y","z","A","B","C", "D","E","F","G","H","I","J","K","L","M","N","O","P","Q", "R","S","T","U","V","W","X","Y","Z","0","1","2","3","4", "5","6","7","8","9","@",".","-"); $key_known_letters = array_flip($known_letters); $count_known_letters = count($known_letters); $key = strlen($string)%$count_known_letters; $out = ""; for ( $i=0; $i<strlen($string); $i++ ) { if ( in_array($string[$i], $known_letters) ) { $out.= $known_letters[(($key_known_letters[$string[$i]]+$key)%$count_known_letters)]; } else { $out.= $string[$i]; } return($out); }
3
Laurent Capelli Décryptage en javascript function str_unrot(debut, chaine, fin) { var known_letters = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q", "r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I", "J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", "0","1","2","3","4","5","6","7","8","9","@",".","-"); var count_known_letters = known_letters.length; var key = (chaine.length)%count_known_letters; var out = ""; for ( var i=0; i<chaine.length; i++ ) { current = chaine.charAt(i); if ( isInArray(known_letters, current) ) { for ( var j=0; j<count_known_letters; j++ ) { if ( known_letters[j] == current ) { break; } currentIndiceLetter = j; newIndiceLetter = (currentIndiceLetter-key)%count_known_letters; if ( newIndiceLetter < 0 ) { newIndiceLetter += count_known_letters; } out += known_letters[newIndiceLetter]; } else { out += current; } document.write(debut+out+fin); }
4
Laurent Capelli Ça ressemble à quoi au final str_unrot(' '); str_unrot('', 'xqBnssItosDHIovH',''); Pour avoir le résultat capelli@in2p3.fr
Présentations similaires
© 2024 SlidePlayer.fr Inc.
All rights reserved.