Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Peeyush Budhia  >  PHP Password Generator  >  index.php  >  Download  
File: index.php
Role: Auxiliary script
Content type: text/plain
Description: Entery Point
Class: PHP Password Generator
Generate a random password from sets of characters
Author: By
Last change:
Date: 1 year ago
Size: 3,626 bytes
 

Contents

Class file image Download
<html>
    <head>
        <title>Random Password Generator</title>
    </head>
    <body font-color="red">
    <center>
        <h3>Random Password Generator</h3>
        <?php
        
if (isset($_GET['error'])) {
            echo 
"<font color=red>$_GET[error]</font>";            
        }
        
?>
        <br><br>
        <table cellspacing="20" bordercolor="blue" width="35%">
            <form action="" method="post">
                <tr>
                    <td align="left">Generating Password For</td>
                    <td align="right"><input type="text" name="reason" size="30"></td>            
                </tr>
                
                <tr>
                    <td align="left">Password Length</td>
                    <td align="right">
                        <select name="passLength">
                                <option value="5">5</option>
                                <option value="7">7</option>
                                <option value="10">10</option>
                                <option value="12">12</option>
                                <option value="15">15</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td align="left">Number Of Passwords</td>
                    <td align="right">
                        <select name="totalPass">
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                                <option value="10">10</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td align="right"><input type="submit" value="Generate" name="getPass"></td>
                </tr>
            </form>

        </table>
        <br>
        <font 
            color="red">Random Password Generator Created By Peeyush Budhia<br>
        Version 1.0
        </font>
        <br><br>
        <?php
        
if (isset($_POST['getPass'])) {
            if (empty(
$_POST['reason'])) {
                
$_error "Please Enter The Reason";
                
header("location: image.php?error=$_error");
                exit;
            } else {
                require_once 
'class.GeneratePassword.php';
                
$_fileOpen fopen("password.log""a");
                
$_reason "Generating Password For: " strtoupper($_POST['reason']) . "\n";
                
fwrite($_fileOpen$_reason);
                echo 
"<b>You have requsted " $_POST['totalPass'] . " password(s) of " $_POST['passLength'] . " chracters long</b><br><br>";
                for (
$_totalPass 1$_totalPass <= $_POST['totalPass']; $_totalPass++) {
                    
$_gp = new GeneratePassword();
                    
$_password $_gp->getPassword($_POST['passLength']) . "\n";
                    
fwrite($_fileOpen$_password);
                    echo 
nl2br($_password);
                }
                
fclose($_fileOpen);
            }
        }
        
?>
    </center>
</body>
</html>