Location: PHPKode > scripts > PANDA Mailer > pandamailer/index.php
<?php
//#######################################################################\\
//# Author: Christopher Schiffner - hide@address.com                 #\\
//# Filename: index.php                                                 #\\
//# Copyright: Creative Commons Attribution-Noncommercial 3.0 Unported  #\\
//#                                                                     #\\
//# License: This software is free to use for personal applications.    #\\
//#          There is a small registration fee for commercial           #\\
//#          applications.  Please contact hide@address.com if       #\\
//#          you wish to use this program on a commercial website.      #\\
//#######################################################################\\
?>

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html>
<head>
<title>Simple Mailer v2.1.1 - Get this software at: http://www.schiffner.com/</title>
<script language="JavaScript" type="text/javascript">
<!--

// These functions will check for blank fields in the form.

function trimAll(sString)
{
  while (sString.substring(0,1) == " ")
  {
    sString = sString.substring(1, sString.length);
  }
  while (sString.substring(sString.length-1, sString.length) == " ")
  {
    sString = sString.substring(0,sString.length-1);
  }
  return sString;
}

function checkform (form)
{

  // ** FROM **
  tmpCompare=trimAll(form.from.value);
  form.from.value=tmpCompare;
  if (tmpCompare == "") {
    alert( "Please complete the field 'From:'");
    form.from.focus();
    return false ;
  }
  //check if email looks like an email address
  if (!(form.from.value.indexOf("@") > 0 && form.from.value.indexOf(".") > 0 )){
    alert( "The email address does not appear to be valid.");
    form.from.focus();
    return false 
  }

  // ** SUBJECT **
    tmpCompare=trimAll(form.subject.value);
    form.subject.value=tmpCompare;
    if (tmpCompare == "") {
      alert( "Please enter a subject.");
      form.subject.focus();
      return false ;
    }

  // ** MESSAGE **
    tmpCompare=trimAll(form.message.value);
    form.message.value=tmpCompare;
    if (tmpCompare == "") {
      alert( "Please enter a message.");
      form.message.focus();
      return false ;
    }

  // ** VERIFICATION CODE **
    tmpCompare=trimAll(form.response.value);   
    form.response.value=tmpCompare;   
    if (tmpCompare == "") {
      alert( "Please enter the human verification code.");   
      form.response.focus();   
      return false ;
    }

  return true ;
}
//-->
</script>

</head>
<body>

<?php
$error="";
$from="";
$message="";

if(isset($_GET['error'])){
    $error=urldecode($_GET['error']);
    $from=urldecode($_GET['from']);
    $message=urldecode($_GET['message']);
    
    switch($error){
        case 'fieldBlank':
    	    echo "<center><span style='color: red;'>You left a field blank. All fields must be completed.</span></center><br/>";
	    break;
	case 'codeMismatch':
	    echo "<center><span style='color: red;'>The human verification code you entered was not correct.</span></center><br/>";
	    break;
	case 'sent':
	    echo "<center><span style='color: green;'>Your message has been delivered.</span></center><br/>";
	    echo "<center><form action='http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/index.php'>
		  <input type=submit value='Send Another Mssage' /></form></center>";
	    die();
	    break;
    }
}
?>

<form method="post" action="pandamailer.php" onsubmit="return checkform(this);">
  <div align="center">
    <center>
    <table border="0" cellspacing="0">
      <tr>
        <td width=165 align="right">
	    From:
	</td>
        <td>
	    <?php echo '<input type="text" name="from" style="width: 296px;" value="'.$from.'" />'; ?>
	    (email address)
	</td>
      </tr>
      <tr>
        <td align="right">
	    Reason for Contact:
	</td>
        <td align='left'>
	    <!-- Uncomment the code below if you wish to use a manually entered subject line.
		 the default mode is via option box with preefined subjects. You may add or change option
		 blocks as necessary. -->
	    <!--
	    <?php echo '<input type="text" name="from" style="width: 296px;" value="'.$subject.'" />'; ?>
	    -->

	    <select name="subject" style="width: 300px;">
		<option>General Question/Comment</option>
		<option>Question about my software</option>
		<option>Report an inaccuracy/typo or other correction</option>
		<option>Other (please explain below)</option>
	    </select>
	</td>
      </tr>
      <tr>
        <td align="right" valign="top">
            <br/>Message:
	</td>
        <td align='left'>
            <br/><textarea rows="10" name="message" cols="44"><?php echo $message; ?></textarea>
	</td>
      </tr>
      <tr>
	<td align='right'><br/>Human Verification Code:<br/></td>
	<td valign="top" align='left'>
	<br/><img src="captcha.php" />
	<br/><input type='text' name='response' />
	<br/>(please copy the above code in the box to its left)
	</td>
      </tr>
      <tr>
        <td align="center" colspan="2">
	    <br/><input type="submit" value= "Send Message" />
	</td>
      </tr>
    </table>
    </center>
  </div>
  <p>&nbsp;</p>
</form>

</body>
</html>
Return current item: PANDA Mailer