Yes! The user pays to submit the photo. When they return from PayPal, some data is posted to the form.
index.php
case "create":
$id_num = mysql_real_escape_string($_POST['txn_id']);
$rs_duplicates = mysql_query("select id from photos where paypal_id='$id_num'");
$duplicates = mysql_num_rows($rs_duplicates);
if ($duplicates > 0)
{
header("Location: index.php");
exit();
}
if(is_jpeg($_FILES['photo']['type']['file'])
and is_valid_file_size($_FILES['photo']['size']['file'])
and is_uploaded_file($_FILES['photo']['tmp_name']['file'])
and is_minimum_width_height($_FILES['photo']['tmp_name']['file'])
and is_maximum_width_height($_FILES['photo']['tmp_name']['file'])
)
{
if(is_fields_filled_out($_POST['photo']))
{
$_POST['photo']['theme_id'] = $this_weeks_theme['id'];
$photo_id = create_photo($_POST['photo']);
copy($_FILES['photo']['tmp_name']['file'], './photos/'.$photo_id.'.jpg');
$notice = "Successfuly created photo.";
}
else
{
$warning = "Click back and fill in all fields.";
}
}
else
{
$warning = "Click back, error uploading file.
Please make sure your file is a jpeg or gif and less than 1MB in size.";
}
break;
}
form.php
<?php if(!empty($_POST)): ?>
<p>Hello, <b><?php echo $_POST['first_name']; ?> <?php echo $_POST['last_name']; ?></b>, thank you for your order. Please check your email <b><?php echo $_POST['payer_email']; ?></b> for your receipt.</p>
<h1>Submit Your Photo</h1>
<p>Fill in the form and your Photo will be added to the Album of this web site!</p>
<form action="index.php?view=create" method="post" enctype="multipart/form-data">
<fieldset>
<div>
<label><b>Web Address:</b></label>
<input name="photo[discuss_url]" size="40" type="text" value="http://" class="textfield" /> <br/>
<label>This is the link to your web site. Please prefix with: http://</label>
</div>
<div>
<label><b>Attach Photo</b></label>
<input name="photo[file]" type="file" class="textfield" /><br/>
</div>
<input name="photo[paypal_id]" size="40" type="hidden" value="<?php echo $_POST['txn_id']; ?>" />
<input type="submit" name="submit" value="Upload Photo" onSubmit='return clearForm(form_new)' />
</fieldset>
</form>
<?php endif; ?>
create.php
<?php header("Location: index.php"); ?>