Login   Register  
PHP Classes
elePHPant
Icontem

File: generator.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Luke  >  Honey Pot  >  generator.php  >  Download  
File: generator.php
Role: Example script
Content type: text/plain
Description: More detailed demonstration, automatically generate addresses
Class: Honey Pot
Creates valid random e-mail addresses
Author: By
Last change:
Date: 2003-12-02 18:38
Size: 2,595 bytes
 

Contents

Class file image Download
<?php
require_once("honeyPot.class.php");
echo 
"<html><head><title>Address Generator</title></head><body>\n";

?>
<form name="honeyPot" method="post" action="?">
  <p>Email Generation Options<br>
    &lt;username@domain.type.country&gt;</p>
  <p>Minimum Username length: 
    <input name="umin" type="text" id="umin" size="10" maxlength="2" value="<?php if(isset($_POST['umin'])){ echo $_POST['umin']; } ?>">
    Maximum Username length: 
    <input name="umax" type="text" id="umax" size="10" maxlength="3" value="<?php if(isset($_POST['umax'])){ echo $_POST['umax']; } ?>">
    <br>
    Use username as domain name: Yes 
    <input type="radio" name="userasdomain" value="true" <?php if($_POST['userasdomain'] == "true"){ echo "checked"; } ?>>
    No 
    <input type="radio" name="userasdomain" value="false" <?php if($_POST['userasdomain'] == "false"){ echo "checked"; } ?>>
    <br>
    (if not)<br>
    Minimum Username length: 
    <input name="dmin" type="text" id="dmin" size="10" maxlength="2" value="<?php if(isset($_POST['dmin'])){ echo $_POST['dmin']; } ?>">
    Maximum Username length: 
    <input name="dmax" type="text" id="dmax" size="10" maxlength="3" value="<?php if(isset($_POST['dmax'])){ echo $_POST['dmax']; } ?>">
  </p>
  <p>How many addresses to generate: 
    <input name="gen" type="text" id="gen" size="10" maxlength="5" value="<?php if(isset($_POST['gen'])){ echo $_POST['gen']; }?>">
    <br>
    <br>
    Show time taken Yes 
    <input type="radio" name="showtime" value="true" <?php if($_POST['showtime'] == "true"){ echo "checked"; } ?>>
    No 
    <input type="radio" name="showtime" value="false" <?php if($_POST['showtime'] == "false"){ echo "checked"; } ?>>
  </p>
  <p> 
    <input name="submit" type="submit" id="submit" value="Submit">
    <input name="reset" type="reset" id="reset" value="Reset">
  </p>
</form>
<?php

if(isset($_POST['submit'])){
$emails = new honeyPot();

if(isset(
$_POST['umax']) && isset($_POST['umin'])){
    
$emails->umax $_POST['umax'];
    
$emails->umin $_POST['umin'];
}
if(isset(
$_POST['dmax']) && isset($_POST['dmin'])){
    
$emails->dmax $_POST['dmax'];
    
$emails->dmin $_POST['dmin'];
}
if(isset(
$_POST['gen'])){
    
$emails->addresses $_POST['gen'];
}
if(
$_POST['userasdomain'] == "true"){
    
$emails->userfordomain true;
}

//echo "<pre>";
//print_r($emails->createAddressArray());
//echo "</pre>";

echo "<br><br>\n\n";

$emails->displayAddresses();
if(
$_POST['showtime'] == "true"){
    
$emails->displayTimeTaken();
}


}

echo 
"</body></html>";
?>