Anglais Francais Prosygma 

Italie
-
    hebergement 

asp
prosygma_logo



 Divers (1)  Chaînes (31)  Dates (18)  Nombres (8)  Structures (5) 
 Tableaux (6) 
asc/ord - chr - crunch - cstr/(string) - dosql/addslashes - ereg_replace - htmlspecialchars - instr/strpos - instrrev/strrpos - lcase/strtolower - left - len/strlen - ltrim - mid/substr - nl2br - notag - parcelstr - password - replace/str_replace - right - rtrim - space - string/str_repeat - tarea/htmlentities - trim - ucase/strtoupper - ucfirst - undosql/stripslashes - urldecode - urlencode - wrapstr
PASSWORD 
Retourne un mot de passe de taille donnée
ASP
<%
function password(taille)
   mot = ""
   Randomize
   while len(mot)<taille
      x=Int((122 - 48 + 1) * Rnd + 48)
      if x<58 or x>96 or (x>64 and x<91) _
      then mot = mot & chr(x)
   wend
   password = mot
end function

response.write password(6)
%>

PHP
<?
function password($taille) {
   $mot = "";
   srand((double)microtime()*1000000);
   while(strlen($mot)<$taille) {
      $x=rand(48,122);
      if($x<58 || $x>96 || ($x>64 && $x<91))
         $mot.=chr($x);
   }
   return $mot;
}

echo password(6);
?>

JavaScript
<script>
function password(taille) {
   mot = ""
   while(mot.length<taille) {
      x=Math.floor((122 - 48 + 1) * Math.random() + 48)
      if(x<58 || x>96 || (x>64 && x<91))
         mot+=String.fromCharCode(x)
   }
   return mot
}

document.write(password(6))
</script>

© ASP-PHP.net 11/01/2003