begin process at 2012 02 15 19:23:49
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Maths & Algorithmes

 > GÉNÉRATEUR DE MOTS DE PASSES ALÉATORES

GÉNÉRATEUR DE MOTS DE PASSES ALÉATORES


 Information sur la source

Note :
10 / 10 - par 1 personne
10,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Maths & Algorithmes Niveau :Débutant Date de création :11/06/2003 Date de mise à jour :11/06/2003 21:02:29 Vu / téléchargé :4 368 / 238

Auteur : Totofweb

Ecrire un message privé
Commentaire sur cette source (5)
Ajouter un commentaire et/ou une note

 Description

Je crois que j'ai dérivé ce script d'un autre, mais voilà, je l'ai améliorer pour vous présenter aujourd'hui un générateur de mots de passes aléatoires !

Vous pouvez spécifier le nombre de caractères voulus (de 4 à 16) et les caractères à inclure (majuscules on/off, miniscules on/off, chiffres on/off, caractères spéciaux on/off). Il vous retourne une valeur aléatoire et le nombre de valeurs différentes possibles.

Source

  • <center>
  • <H3>Générateur de mot de passe aléatoires</H3>
  • </center>
  • <br>
  • <?
  • if (!$length){ $length = '8'; }
  • if (!$withchar){ $withchar = 'no'; }
  • if (!$lowers){ $lowers = 'yes'; }
  • if (!$uppers){ $uppers = 'yes'; }
  • if (!$nums){ $nums = 'yes'; }
  • if ($withchar == 'no' AND $lowers == 'no' AND $uppers == 'no' AND $nums == 'no'){ print("<b><font color=red>Erreur:</font> Vous devez faire un choix<BR><HR>Nous vous suggérons de choisir ce que vous ferez de ce mot de passe avant de faire une sélection<HR></b>"); exit; }
  • if ($lowers == 'yes'){$char[] = 'a'; $char[] = 'b'; $char[] = 'c'; $char[] = 'd';$char[] = 'e';$char[] = 'f';$char[] = 'g';$char[] = 'h';$char[] = 'i';$char[] = 'j';$char[] = 'k';
  • $char[] = 'l';$char[] = 'm';$char[] = 'n';$char[] = 'o';$char[] = 'p';$char[] = 'q';$char[] = 'r';$char[] = 's';$char[] = 't';$char[] = 'u';$char[] = 'v';
  • $char[] = 'w';$char[] = 'x';$char[] = 'y';$char[] = 'z';}
  • if ($uppers == 'yes'){$char[] = 'A';$char[] = 'B';$char[] = 'C';$char[] = 'D';$char[] = 'E';$char[] = 'F';
  • $char[] = 'G';$char[] = 'H';$char[] = 'I';$char[] = 'J';$char[] = 'K';$char[] = 'L';$char[] = 'M';$char[] = 'N';$char[] = 'O';$char[] = 'P';
  • $char[] = 'Q';$char[] = 'R';$char[] = 'S';$char[] = 'T';$char[] = 'U';$char[] = 'V';$char[] = 'W';$char[] = 'X';$char[] = 'Y';$char[] = 'Z';}
  • if ($nums == 'yes'){$char[] = '0';$char[] = '1';$char[] = '2';$char[] = '3';$char[] = '4';$char[] = '5';$char[] = '6';$char[] = '7';$char[] = '8';$char[] = '9';}
  • if ($withchar == 'yes'){$char[] = '!';$char[] = '@';$char[] = '$';$char[] = '^';$char[] = '+';$char[] = '|';$char[] = '>';$char[] = '<';}
  • $num = count($char);$num -= 1;
  • for ($i = 0; $i < 9; $i++){
  • srand((double)microtime()*1000000);
  • $randnum = rand(0,$num);
  • $password .= "$char[$randnum]";
  • $randnum = rand(0,$num);
  • $password .= "$char[$randnum]";}
  • ?>
  • <script language="Javascript">
  • <!--
  • var copytoclip=1
  • function SelectAndCopy(theField) {
  • var val=eval("document."+theField)
  • val.focus()
  • val.select()
  • if (document.all&toclip==1){
  • textrange=val.createTextRange()
  • textrange.execCommand("Copy")
  • window.status="Password highlighted and copied to clipboard!"
  • setTimeout("window.status=''",1800)
  • }
  • }
  • //-->
  • </script>
  • <CENTER>
  • <BR><BR>
  • [<a href="<? print($PHP_SELF); ?>?length=4&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">4 char</a>] [<a href="<? print($PHP_SELF); ?>?length=6&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">6 char</a>] [<a href="<? print($PHP_SELF); ?>?length=8&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">8 char</a>] [<a href="<? print($PHP_SELF); ?>?length=10&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">10 char</a>] [<a href="<? print($PHP_SELF); ?>?length=12&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">12 char</a>] [<a href="<? print($PHP_SELF); ?>?length=14&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">14 char</a>] [<a href="<? print($PHP_SELF); ?>?length=16&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">16 char</a>]
  • <BR><BR><BR>
  • <FORM name="form1">
  • <noscript>
  • <a href="<? print("$PHP_SELF?$QUERY_STRING"); ?>">Generer un Nouveau Password</a>
  • </noscript>
  • <BR><input type="text" value="<?
  • $password = substr("$password",0,$length);
  • print($password);
  • ?>" name="select" size="40" maxlength="<? print($length); ?>">
  • </FORM>
  • <BR><BR>
  • <center>nombre de possibilités = <?php echo $length; ?><sup><?php echo count($char); ?></sup> = <?php echo pow ($length, count($char)); ?></center>
  • <BR><BR><BR><center>
  • <BR>
  • Caractères Speciaux : |<? if ($withchar == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=yes&lowers=$lowers&uppers=$uppers&nums=$nums><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($withchar == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=no&lowers=$lowers&uppers=$uppers&nums=$nums><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> |
  • Caractères Majuscules : |<? if ($uppers == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=yes&nums=$nums><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($uppers == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=no&nums=$nums><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> |
  • Caractères Minuscules : |<? if ($lowers == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=yes&uppers=$uppers&nums=$nums><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($lowers == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=no&uppers=$uppers&nums=$nums><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> |
  • Chiffres : |<? if ($nums == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=$uppers&nums=yes><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($nums == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=$uppers&nums=no><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> |
  • <BR>
  • </center>
								<center>
									<H3>Générateur de mot de passe aléatoires</H3>
								</center>
								<br>
<? 
if (!$length){ $length = '8'; } 
if (!$withchar){ $withchar = 'no'; } 
if (!$lowers){ $lowers = 'yes'; } 
if (!$uppers){ $uppers = 'yes'; } 
if (!$nums){ $nums = 'yes'; } 
if ($withchar == 'no' AND $lowers == 'no' AND $uppers == 'no' AND $nums == 'no'){ print("<b><font color=red>Erreur:</font> Vous devez faire un choix<BR><HR>Nous vous suggérons de choisir ce que vous ferez de ce mot de passe avant de faire une sélection<HR></b>"); exit; } 
if ($lowers == 'yes'){$char[] = 'a'; $char[] = 'b'; $char[] = 'c'; $char[] = 'd';$char[] = 'e';$char[] = 'f';$char[] = 'g';$char[] = 'h';$char[] = 'i';$char[] = 'j';$char[] = 'k'; 
$char[] = 'l';$char[] = 'm';$char[] = 'n';$char[] = 'o';$char[] = 'p';$char[] = 'q';$char[] = 'r';$char[] = 's';$char[] = 't';$char[] = 'u';$char[] = 'v'; 
$char[] = 'w';$char[] = 'x';$char[] = 'y';$char[] = 'z';} 
if ($uppers == 'yes'){$char[] = 'A';$char[] = 'B';$char[] = 'C';$char[] = 'D';$char[] = 'E';$char[] = 'F'; 
$char[] = 'G';$char[] = 'H';$char[] = 'I';$char[] = 'J';$char[] = 'K';$char[] = 'L';$char[] = 'M';$char[] = 'N';$char[] = 'O';$char[] = 'P'; 
$char[] = 'Q';$char[] = 'R';$char[] = 'S';$char[] = 'T';$char[] = 'U';$char[] = 'V';$char[] = 'W';$char[] = 'X';$char[] = 'Y';$char[] = 'Z';} 
if ($nums == 'yes'){$char[] = '0';$char[] = '1';$char[] = '2';$char[] = '3';$char[] = '4';$char[] = '5';$char[] = '6';$char[] = '7';$char[] = '8';$char[] = '9';} 
if ($withchar == 'yes'){$char[] = '!';$char[] = '@';$char[] = '$';$char[] = '^';$char[] = '+';$char[] = '|';$char[] = '>';$char[] = '<';} 
$num = count($char);$num -= 1; 
for ($i = 0; $i < 9; $i++){ 
srand((double)microtime()*1000000); 
$randnum = rand(0,$num); 
$password .= "$char[$randnum]"; 
$randnum = rand(0,$num); 
$password .= "$char[$randnum]";} 
?>
<script language="Javascript"> 
<!-- 
var copytoclip=1 
function SelectAndCopy(theField) { 
var val=eval("document."+theField) 
val.focus() 
val.select() 
if (document.all&toclip==1){ 
textrange=val.createTextRange() 
textrange.execCommand("Copy") 
window.status="Password highlighted and copied to clipboard!" 
setTimeout("window.status=''",1800) 
} 
} 
//--> 
</script>
<CENTER>
<BR><BR>
[<a href="<? print($PHP_SELF); ?>?length=4&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">4 char</a>] [<a href="<? print($PHP_SELF); ?>?length=6&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">6 char</a>] [<a href="<? print($PHP_SELF); ?>?length=8&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">8 char</a>] [<a href="<? print($PHP_SELF); ?>?length=10&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">10 char</a>] [<a href="<? print($PHP_SELF); ?>?length=12&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">12 char</a>] [<a href="<? print($PHP_SELF); ?>?length=14&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">14 char</a>] [<a href="<? print($PHP_SELF); ?>?length=16&withchar=<? print($withchar); ?>&lowers=<? print($lowers); ?>&uppers=<? print($uppers); ?>&nums=<? print($nums); ?>">16 char</a>] 
<BR><BR><BR> 
<FORM name="form1"> 

<noscript> 
<a href="<? print("$PHP_SELF?$QUERY_STRING"); ?>">Generer un Nouveau Password</a> 
</noscript> 
<BR><input type="text" value="<? 
$password = substr("$password",0,$length); 
print($password); 

?>" name="select" size="40" maxlength="<? print($length); ?>"> 
</FORM> 
<BR><BR>
<center>nombre de possibilités = <?php echo $length; ?><sup><?php echo count($char); ?></sup>  = <?php echo pow ($length, count($char)); ?></center>
<BR><BR><BR><center> 
<BR> 
Caractères Speciaux : |<? if ($withchar == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=yes&lowers=$lowers&uppers=$uppers&nums=$nums><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($withchar == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=no&lowers=$lowers&uppers=$uppers&nums=$nums><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> | 
Caractères Majuscules : |<? if ($uppers == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=yes&nums=$nums><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($uppers == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=no&nums=$nums><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> | 
Caractères Minuscules : |<? if ($lowers == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=yes&uppers=$uppers&nums=$nums><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($lowers == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=no&uppers=$uppers&nums=$nums><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> | 
Chiffres : |<? if ($nums == 'no'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=$uppers&nums=yes><u>On</u></a>"); } else { print("<b>On</b>"); } ?> | <? if ($nums == 'yes'){ print("<a href=$PHP_SELF?length=$length&withchar=$withchar&lowers=$lowers&uppers=$uppers&nums=no><u>Off</u></a>"); } else { print("<b>Off</b>"); } ?> | 
<BR> 
</center>  


 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

UTILISER UN MODÈLE DE PAGE EN PHP
Source avec Zip ENVOYER DES MAILS AVEC PIÈCES JOINTES
UN SITE MULTILINGUE ?
TOUT VOTRE SITE EN UNE SEULE PAGE : INDEX.PHP?MODULE=TRUCBID...

 Sources de la même categorie

EXEMPLE D'APPLICATION DE L'ALGORITHME DE DIJKSTRA EN PHP par philtr8
CLEF POUR EAN 13 ET 14 par RaftY
FONCTION DE CALCUL DU NOMBRE DE DUEL UNIQUE POUR UN NOMBRE N... par mtrix000
Source avec Zip Source avec une capture TRIANGLE DE PASCAL ET SON ÉQUATION par vendeeHdLR89
Source avec Zip CONVERTISSEUR LAMBERT2 ÉTENDU EN COORDONNÉE GÉOGRAPHIQUE (LO... par varfendell

Commentaires et avis

Commentaire de matrey le 12/06/2003 10:28:59

autre solution : md5(time), et tu prends le nbre de caractères que tu veux...

Commentaire de Totofweb le 12/06/2003 12:01:06

oui, mais là on ne choisis pas les caractères. Dans mon script il y a plus de convivialité et de possibilités. Mais bon, chaque programmeur à ses trucs, et on n'aime pas qu'on lui impose ceux des autres, ça je le comprends

Commentaire de Totofweb le 12/06/2003 19:35:14

Commentaire de mehdibou le 18/06/2003 22:48:40

Commentaire de ludovicanceaux le 29/01/2006 15:31:51

ca mank grav de commentaire!!!!!!

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,406 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales