Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well this is quite nice solution, a working one. I've seen much worst around.<br> Only a few notes. </p> <ul> <li>it has some unnecessary validations, say <code>contains_bad_str(body);</code> is useless. And whole "bad words" approach at all. Newline test is enough</li> <li>just a rule: <code>DO NOT TALK TO STRANGERS</code>. Never talk to possible attacker, providing them with any feedback. All these "Suspected injection attempt" are childish and more of it - it supply an attacker with information they can use. Always send just 500 HTTP error in all these cases and nothing else.</li> <li>you're using pretty unusual way of error handling. I can't understand the difference between these code snippets</li> </ul> <p>why the first one just sets a variable </p> <pre><code>if(trim($_POST['emailTo']) == '') { $hasError = true; </code></pre> <p>and second one prints an error and exits?</p> <pre><code>if (!is_valid_email($email)) { echo 'Invalid email submitted - mail not being sent.'; exit; } </code></pre> <p>Will you provide a fair user with any feedback on error occurred? Something like "Please fill all required fields"?</p> <ul> <li><p>I wouldn't make user supplied e-mail subject but rather some hardcoded sentence, like <code>Feedback from ".$_SERVER['HTTP_HOST']</code>. I'd like to distinguish feedback messages in my mailbox from the regular ones. (I wouldn't make that fancy reply-to feature either, but it's my own preference)</p></li> <li><p>stripslashes thing. Why only message? Aren't other fields behave the same? And at least you have check get_magic_quotes_gpc() before applying. I'd make it automated, at hte top of the script, both stripslashes and trim, just in the loop over $_POST array.</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload