Jump to content

bytesize

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by bytesize

  1. 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"); ?>
  2. This code is in form.php. The POST txn_id is added to the paypal_id column in the photos table when the form is submitted. <input name="photo[paypal_id]" size="40" type="hidden" value="<?php echo $_POST['txn_id']; ?> I use this code in index.php but there is no POST to this page. So it doesn't work! $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(); } I would like to check the column paypal_id for the insertion of txn_id that came from the form. If there's a match then exit. This would stop the user from clicking back and uploading the form and image again. Can someone help me with this?
  3. Thanks for the quick reply. I tried your code. It's not working. It's probably me! I will continue to work with your code and report back later. Thanks.
  4. This code is in form.php. The id_number is added to customer_id column in the photos table when the form is submitted. The id_number is automaticaly generated. <input name="photo[customer_id]" size="40" type="hidden" value="<?php echo $_POST['id_number']; ?>" /> Let's say 4P2792Q893421 was posted into the database. This code is in index.php and checks the database customer _id column for a match from id_number. If found, exit;, if not found, add the values to the database. As you can see, I manualy inserted the id_number into the code. It's checking the column customer_id and finds a match which in turn exits to index.php. $same_number= mysql_query("select id from photos where customer_id= '4P2792Q893421'"); $duplicate = mysql_num_rows($same_number); if ($duplicate > 0) { header("Location: index.php"); exit(); } I tried to POST the id_number in this example and it doesn't work. What's wrong? $same_number= mysql_query("select id from photos where customer_id= ''$_POST[id_number]'"); $duplicate = mysql_num_rows($same_number); if ($duplicate > 0) { header("Location: index.php"); exit(); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.