		<h2>Donate Computers</h2>
		<?php 
		function validEmail($email){
		$qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
		$dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
		$atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.
			'\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
		$quoted_pair = '\\x5c[\\x00-\\x7f]';
		$domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";
		$quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";
		$domain_ref = $atom;
		$sub_domain = "($domain_ref|$domain_literal)";
		$word = "($atom|$quoted_string)";
		$domain = "$sub_domain(\\x2e$sub_domain)*";
		$local_part = "$word(\\x2e$word)*";
		$addr_spec = "$local_part\\x40$domain";
		return preg_match("!^$addr_spec$!", $email) ? 1 : 0;
	}
		if ($_SERVER['REQUEST_METHOD'] == "POST") {
			$to = 'stoc@andrew.cmu.edu';
			$name = $_POST['name'];
			$email = $_POST['email'];
			$message = $_POST['donation'];
			$headers = "From: $name <$email>" . "\r\n" .
				   "Reply-To: $name <$email>" . "\r\n" .
				'X-Mailer: PHP/' . phpversion();
			if(validEmail($email)) {
				if(mail($to, "Computer Donation from $name", $message, $headers)){
					echo "<p>Thanks for your donation! Email sent to $to.  An STOC member will reply as soon as possible.</p>";
				}
			}
			else {
				echo "<p id=\"error\">The email address you entered was invalid.  Please hit the back button on your browser and try again.</p>";
			}
		}
		else {
		echo "<form method=\"post\" action=\"index.cgi?p=recycle\">
			<h3>About the STOC Computer Recycling Program</h3>
			<p>This project, which was started in the Spring of 2007, attempts to make use of the many computers which are being thrown out around campus. Departments, faculty, and students are continually updating their hardware and many times the old hardware is simply discarded, even though it is still working. We actively seek out working computers, or parts, which could then be redistributed to those who are in need of them.  We are currently working with <a href=\"http://www.wireless-neighborhoods.org/\">Wireless Neighborhoods</a> to redistribute recycled computers.</p>	
			<p><i>All hard drives received are sanitized by Department of Defense 5220.22-M standards before being used to prevent data from being recoverable.</i></p>
			<h3>What we are looking for:</h3>
			<h4>Computers</h4>
			<p>We are currently seeking working or broken computers containing Pentium II or newer processors.  This would typically be computers manufactured and purchased within the last decade.  Both laptops and desktops are acceptable.  If you are unsure if the computer is fit for donation, please do not hesitate to fill out the form.  Provide a description of the computer(s) if possible.</p>
			<h4>Computer Parts</h4>
			<p>We are looking for parts such as CPUs, RAM, power supplies, and motherboards of the Pentium II era or newer, in working condition.  In addition, clean keyboards and mice, networking gear like switches, routers, and cables, LCD monitors, and working printers are also desired.  This is not a comprehensive list, so if you have other parts that you feel would be useful, please mention them to us.</p>
			<h4>What we cannot currently accept</h4>
			<p>Due to storage concerns, we cannot currently accept CRT monitors.</p>
			<h3>Donate Computers and or Parts</h3>
		<p>Please fill out the following form or email <a href=\"mailto:stoc@andrew.cmu.edu\">stoc@andrew.cmu.edu</a>.  An STOC member will reply shortly.</p>
		<p>Your Name:</p><p><input type=\"text\" name=\"name\" size=\"40\" /></p>
		<p>Your Email:</p><p><input type=\"text\" name=\"email\" size=\"40\" /></p>
		<p>Description of what you are donating, where it is, appropriate times for an STOC member to pick up the donation, and any questions/comments:</p>
		<p><textarea name=\"donation\" rows=\"10\" cols=\"70\" /></textarea></p>
		<p><input type=\"submit\" value=\"submit\" />
		</form>";
		}
		?>
