All pastes #772255 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-13 17:52 UTC
rendered paste body
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hot Photo Shot</title>
<style>
body,td,a,p,.h { 
	font-family:arial,sans-serif
}
body {
	font-size: small;
	color: #333;
	margin: 0 20px 2em 20px;
	line-height: 140%;
}
a:link {
	color:#039;
}
a:visited {
	color:#666;
}
a:hover {
	color:#333;
}
a:active{
	color:#000;
}
img,table{
	border:0;
}
</style>
</head>
<body>
<center>
<img src="logo.jpg" />
<p>
<?php
$types = array(
	"image/jpeg",
	"image/png",
	"image/gif",
	"image/bmp",
	"image/tiff",
	"image/x-tga"
	);
	
function file_check($file) {
	global $types;
	foreach ($types as $type) {
		if ($file == $type) $match = 1;
	}
	return ($match) ? TRUE : FALSE;
}

if ($_FILES['image']) {
	$errors = array();
	if (!file_check($_FILES['image']['type'])) {
		$errors[] = "Invalid file type";
	}
	if ($_FILES['image']['size'] > 4194304) {
		$errors[] = "File exceeds 4 megabytes";
	}
	if (!$_POST['comment']) {
		$errors[] = "A comment is required";
	}
	if (!$_POST['email']) {
		$errors[] = "Your email is required";
	}
	if (!preg_match('/\b([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+[a-zA-Z]{2,4})\b/', $_POST['email'])) {
		$errors[] = "Incorrect email";
	}
	if (eregi("to:", $_POST['email']) || eregi("cc:", $_POST['email'])) {
		$errors[] = "Invalid comment";
	}
	if (count($errors) > 0) {
		echo "<div style=\"background-color: #FFD7D7; padding: 10px; border-width: 1px; border-style: solid; border-color: #FF6266; color: #636363; width: 600px;\">\n";
		echo "<h3>The following error(s) occured</h3><br>\n";
		foreach ($errors as $err) {
			echo "<li>$err</li><br>\n";
		}
		echo "</div>\n";
	} else {
		if (file_exists("images/".$_FILES['image']['name'])) {
			$s = 1;
			while (file_exists("images/".$s."-".$_FILES['image']['name'])) {
				$s++;
			}
			$path = "images/".$s."-".$_FILES['image']['name'];
		} else {
			$path = "images/".$_FILES['image']['name'];
		}
		move_uploaded_file($_FILES['image']['tmp_name'], $path);
		echo "Thank you for submitting your image. We will get back to you as soon as possible\n";
		$to      = 'graham.bull@gmail.com';
		$subject = 'Hot Photo Shot Submission';
		$message = wordwrap("IP: ".$_SERVER['REMOTE_ADDR']."\n Image link: <a href=\"http://hotphotoshot.com/".$path."\">Here</a>\n Comment: ".htmlentities($_POST['comment']), 70);
		$headers = "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= 'From: '.$_POST['email']."\r\n";
		
		mail($to, $subject, $message, $headers);
	}
} else {
	echo '<form method="post" enctype="multipart/form-data"><table width="200" border="0">
  <tr>
    <td>Image:</td>
    <td><input type="file" name="image" id="file" /></td>
  </tr>
  <tr>
    <td>Comment:</td>
    <td><textarea name="comment" id="textarea" cols="45" rows="5"></textarea></td>
  </tr>
  <tr>
    <td>Email:</td>
    <td><input type="textfeild" name="email" id="textfield" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="button" id="button" value="Submit" /></td>
  </tr>
</table></form>';
}
?>
</p>
</center>
</body>
</html>