Visualizzazione dei risultati da 1 a 2 su 2

Discussione: generatore di password

  1. #1

    generatore di password

    salve

    questo e uno script x generare password:

    <?php

    function randomPassword () {
    $length ="6"; // the length of the password required
    $possible = '23456789' .
    'abcdefghijkmnpqrstuvwxyz' ;

    $str ="";
    while (strlen($str) < $length) {
    $str.=substr($possible, (rand() % strlen($possible)),1);
    }
    return($str);
    }
    echo("<table border=0 Cellspacing=3 cellpadding=5>");
    echo("<tr><td align=right bgcolor=#EDEDED>Your Random Password is: ");
    echo("</td><td align=left bgcolor=#EDEDED>".randomPassword()."");

    exit();
    ?>

    come si fa a far comparire la password in una textbox al posto della cella e a far attivare l'evento alla pressione di un tasto al posto del tasto refresh?

    vi ringrazio anticipatamente

  2. #2
    Io ho fatto così:

    Codice PHP:
    <?php

    function randomPassword () {
    $length ="8"// the length of the password required
    $possible '0123456789' .
    'abcdefghijkmnpqrstuvwxyz' ;

    $str ="";
    while (
    strlen($str) < $length) {
    $str.=substr($possible, (rand() % strlen($possible)),1);
    }
    return(
    $str);
    }
    ?>

          <form id="form1" name="form1" method="post" action="">

            <input type="submit" name="Submit" value="Genera password" />
          
        <input name="textfield" type="text" value="<?php echo randomPassword(); ?>" />
        </form>
    anche se la password si vede subito...
    vabbè almeno mi funziona

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.