PHP Classes

File: test_pwd.php

Recommend this page to a friend!
  Classes of Giuseppe Ferrara   CreatePwd   test_pwd.php   Download  
File: test_pwd.php
Role: Example script
Content type: text/plain
Description: An example script
Class: CreatePwd
Generate passwords with random characters
Author: By
Last change:
Date: 16 years ago
Size: 1,246 bytes
 

Contents

Class file image Download
<?php

   
if(isset($_POST['pwd_length'])){
   
        require
"create_pwd.php";
       
       
$pwd = new CreatePwd();

       
$gen_pwd = "Password length: <b>" . $_POST['pwd_length'] . "</b>";
       
$gen_pwd .= "<br>Case type: <b>" . $_POST['pwd_type'] . "</b>";
       
$gen_pwd .= "<br><br>Password: <b>" . $pwd->Create($_POST['pwd_length'], $_POST['pwd_type']) . "</b>";
       
    }
    else{
   
       
$gen_pwd = "";
       
    }
   
?>
<html>
    <head>
        <title>CreatePwd - Password Generator</title>
    </head>
    <body>
    Please fill the form to create a new password:
    <br><br>
    <form action="test_pwd.php" method="post" name="frm1">
    Password length: <select name="pwd_length">
                                <option value="6" SELECTED>6</option>
                                <?php
                                   
for($x=7;$x<15;$x++){
                                    print
"<option value=\"" . $x . "\">" . $x . "</option>\n";
                                    }
                               
?>
</select>
                            &nbsp;
                            <select name="pwd_type">
                                <option value="lower" SELECTED>lower-case</option>
                                <option value="upper">upper-case</option>
                                <option value="mixed">mixed-case</option>
                            </select>
                            &nbsp;
                            <input type="submit" value=" Create ">
    </form>
    <br><br>
    <?php print $gen_pwd; ?>
</body>
</html>