#!/usr/bin/perl
use strict;
use warnings;
use Authen::Captcha;

# You MUST create the following directories yourself. FormMail will not work
# without them, unless you are not using Captcha support.

# Set this to a directory that is not accessible via the web.
# Often something like /home/yourname/.captcha_data
my $captcha_datadir = "/home/sites/aldinger.co.uk/.captcha_data";

# Set this to a directory that will store the captcha images. This should
# be accessible via the web because it will be included on the page.
# Often something like /home/yourname/public_html/fm/captcha_img
my $captcha_outputdir = "/home/sites/aldinger.co.uk/public_html/prospectphysio.co.uk/webforms/img";

# This should be the same as the directory above, but using the web accessible
# URL path. If you have /home/yourname/public_html/fm/captcha_img above then
# you will need /fm/captcha_img here.
my $image_dir = "/webforms/img";


# Use the following few settings to configure the form values.

# This should be the location of the FormMail.cgi script.
my $formmail = "/webforms/FormMail.cgi";

# This is where you want the email to go.
my $recipient = 'info@prospectphysio.co.uk';

# This is where the user should be taken to after submitting the form.
my $redirect = "http://www.prospectphysio.co.uk/thankyou.html";


my $captcha = Authen::Captcha->new(
  data_folder => $captcha_datadir,
  output_folder => $captcha_outputdir,
  );

my ($md5sum, $chars) = $captcha->generate_code(4);

# Modify the HTML below to make your form how you like it.
# Ensure that you read the instructions carefully.
# Only edit outside the comment sections, unless you are sure
# you know what you're doing.
print <<"END";
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact Prospect Physio</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="COSU" />
<meta name="description" content="" />
<meta name="generator" content="Coda" />
<meta name="keywords" content="" />
<link rel="stylesheet" href="/css/layout.css" type="text/css" />
</head>
<body id="website">
<div id="accessibility">
<p><a href="#contentMain" accesskey="0" title="Skip to content - Accesskey= 0">Skip to content</a></p>
</div>
<div id="branding">
<h1 id="top">Prospect Physio</h1> 
<img src="/images/logo.gif" alt="Prospect Physio logo" />
<blockquote>
<p>Neurological Physiotherapy &amp; Rehabilitation</p>
</blockquote>
</div>
<div id="teaser">
</div>
<div id="navMain">
<ul>
<li><p><a href="/" accesskey="1" title="Home - Accesskey = 1">Home</a></p></li>
<li><p><a href="/info.html" accesskey="2" title="Information - Accesskey = 2">What we do</a></p></li>
<li><p><a href="/about.html" accesskey="3" title="About Us - Accesskey = 3">About us</a></p></li>
<li class="active"><p><a href="/webforms/contact.cgi" accesskey="4" title="Contact Us - Accesskey = 4">Contact us</a></p></li>
<li><p><a href="/location.html" accesskey="5" title="Location - Accesskey = 5">Location</a></p></li>
</ul>
</div>
<div id="content">
<div id="contentMain">
<h2>Contact Us</h2>
<p style="float: left; display: inline; padding-bottom: 5em; padding-right: 1em;"><strong>Mail:</strong></p><p>Prospect Physio,<br />St. Johns Road,<br />Stourport-on-Severn,<br />Worcestershire,<br />DY13 9DS.</p>
<p><strong>Work:</strong> 01299 826328</p>
<p><strong>Mobile:</strong> 07930 305540</p>

<p>To make an appointment or if you require any additional information please call or use the contact form below:</p>

<form action="$formmail" method="post">
	<fieldset id="details">
            <input type="hidden" name="subject" value="Contact Form" />
        <!-- This section must remain the same for Captcha support. -->
            <input type="hidden" name="recipient" value="$recipient" />
            <input type="hidden" name="redirect" value="$redirect" />
            <input type="hidden" name="captcha-md5sum" value="$md5sum" />
            <input type="hidden" name="sort" value="order:message,env_report,captcha-text,captcha-md5sum" />
            <input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT" />
            <input type="hidden" name="required" value="email,message" />
            <input type="hidden" name="missing_fields_redirect" value="http://www.prospectpyhsio.co.uk/missing_fields.html" />
<p>The <em>'Email Address'</em> and <em>'Message'</em> fields are required. Please enter the image verification code to stop spammers. Thankyou.</p>
	<ol>
            <li>
            <label for="email">Email Address:</label>
            <input id="email" name="email" class="text" type="text" />
            </li>
            <li>
            <label for="realname">Name:</label>
            <input id="realname" name="realname" class="text" type="text" />
            </li>
        <!-- End section -->

        <!-- You can add extra form items here -->
        	<li>
            <label for="message">Message:</label>
            <textarea id="message" name="message" class="textarea" rows="10" cols="40"></textarea>
			</li>
        <!-- The following section must stay here for Captcha support. -->
        
          
          <li>
          <img src="$image_dir/$md5sum.png" alt="captcha image" />
          <label for="captcha-text">Please enter the image verification code below:</label>
          <input id="captcha-text" name="captcha-text" class="text" type="text" />
          </li>
    </ol>
        <!-- End section -->
	</fieldset>
	<fieldset id="submit">
	<ol>
            <li><input value="Send form" class="submit" type="submit" /></li>
            <li><input value="Start again" class="reset" type="reset" /></li>
    </ol>
    </fieldset>
</form>
</div> 
</div>
<div id="siteInfo">
<p><a href="http://www.prospectphysio.co.uk/" title="back to top">Prospect Physio</a> | &copy;2009 All rights reserved. | Made with <a href="http://www.websitestandards.org.uk/">Web Standards</a> | We use <a href="http://www.microformats.org/">Microformats</a> <a href="http://www.microformats.org/"><img  src="/images/microformat_hcard.png" alt="Microformats hcard" /></a></p>
<p id="author">Website created by <a href="http://www.cosu.co.uk/">COSU</a></p>
</div>
</body>
</html>
END
