Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


ianhg last won the day on January 30 2013

ianhg had the most liked content!

Community Reputation

1 Neutral

About ianhg

  • Rank
  1. Thanks for your reply. I see what you mean about being too restrictive as an example the UK use post code letters and numbers while Zip Codes in the States are intergers. Currently using javascript to validate but of course does not work if browser has turned off javascript. Just hate stupid emails from web forms selling SEO or trying to link to a domain to sell you some rubbish. Thanks again.
  2. Hi back again Folks, The script works well but I am getting some web forms like below: My question is how do I write some php to stop input being entered the same and posible reject the form? 'removed domain' is the regex working :-) Name: canada goose outlet Company:parksaleonline@126.com Address: removed domain Address: canada goose outlet City/Town:canada goose outlet County: canada goose outlet Post Code: canadagoos email: canada goose outlet Repeat email:canada goose outlet Comments: Business Lying About Lake O to Win Hearts and Minds: Th
  3. Just thought I would share this, I struggled to get this working but have now succeeded. <?php // Settings @ini_set('max_execution_time', "30"); // 30 seconds // print ini_get('max_execution_time'); @ini_set('memory_limit', "64M"); // 8MB - Set any from 8M, 16M, 24M, 32M, 40M, 48M, 56M, 64M, 128M // print ini_get('memory_limit'); // these two below are best to adjust via .htaccess - see documentation @ini_set('post_max_size', "2M"); // 10MB @ini_set('upload_max_filesize', "2M"); // 10MB // Max File Size Allowed - Soft Restriction - Not always fool proof but its better to use $Max_File_Si
  4. Thanks for the link HartleySan. I am saving the images to the server but would like the image to be sent as an attachment with email using hopefully the above code. But concerned about the link as I thought that headers were a risky for header injection and automated submission? Thanks
  5. Hi Thanks for the speedy reply margaux and the link, but I was hoping to find a way of adding to the existing script rather than start afresh. But then again maybe I need to, thanks.
  6. Hi Guys I have a contact form with the ability to upload an image and all is working ok. The contact form sends an email and currently uploads the image to the server. What I want to do is attach the image to the email as well. Code below any guidance would be appreciated, thanks <?php include('includes/config3.php'); // Check if the form has been submitted: if (isset($_POST['submitted'])) { // Check for an uploaded file: if (isset($_FILES['photoTemp'])) { // Validate the type. Should be JPEG or PNG. $allowed = array ('image/pjpeg', 'image/jpeg', 'image/
  7. Thanks HartleySan 'use the preg_replace function once' helped me. For what itis worth this the code, I know it's not perfect but it appears to working. //url removal $pattern ='/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i'; $replacement = 'removed url' ; foreach ($_POST as $key => $value){ $_POST[$key] = is_array($key) ? $_POST[$key]: preg_replace($pattern,$replacement,$_POST[$key] ); } Appreciate the guidance from both Larry and yourself
  8. Thanks sorry for rambling. Trying to teach myself slow progress at 65 but will take the advice and appreciate yours and Larry's guidance. Found his books very helpful.
  9. Outside... spam_scrubber working fine don't want to cock it up :-) The idea being it would remove anything before spam_scrubber
  10. Larry , thanks so appreciate the advice. I am trying the regular expression using preg_match which is returning either 0 or 1 This is what I have now clearly it not working properly. foreach ($_POST as $key => $value){ $_POST[$key] = is_array($key) ? $_POST[$key]: (preg_match_all('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', $_POST[$key], $matches)); return (isset($matches[1])) ? str_replace($matches[1], "", $key) : $key; }
  11. Hi, I have added this code //strip_tags foreach ($_POST as $key => $value) { $_POST[$key] = is_array($key) ? $_POST[$key]: strip_tags($_POST[$key]); } //htmlentities foreach ($_POST as $key => $value) { $_POST[$key] = is_array($key) ? $_POST[$key]: htmlentities($_POST[$key]); } which appears to be working fine. Can i use something similar to check if any url's have been entered into text fields. So it would check $_POST and remove any url's posted before being passed onto spam_scrubber? Sorry if the terminology is not correct. Thanks for the replies so far.
  12. Hi Larry Sorry but I don't think I explained myself very well. The code above does not attempt to remove URL I am still working on that aspect. I posted the code because I noticed that spam_scrubber was removing bad stuff when I used echo but it's not removing bad stuff from emals sent. I was wondering if I have something in the wrong place. Sorry to be a pain. Thanks for the replies.
  13. Ah maybe this is in the wrong place // Clear $_POST (so that the form's not sticky): $_POST = array();
  14. Thanks Larry.Basically I have been trying to stop spammers entering Url's into the input fields on a web form. Which is still on going at the moment (so any pointers would be appreciated) but while looking into this I found that the contact form although removes some bad stuff when I use echo results to a thank you page the email body contains html tags that had been removed. So I must be missing something. I am using HTML5 on the site. This is the full php code //check for form submission check if (isset($_POST['submitted'])) { function spam_scrubber($value) { //list of b
  • Create New...