Chrisj Posted April 29, 2020 Share Posted April 29, 2020 I am using this a modal window(jBox) - with a web Form in it, that requires the Form (just Name & Email) to be completed and Submitted in order to close the modal window - allowing access to the main page. The Form uses this corresponding ../submit.php which this: if (empty($_POST['name'])|| empty($_POST['email'])){ $response['success'] = false; } else { $response['success'] = true; } echo json_encode($response); where, upon Form > submit, successfully shows 'error' if the Form fields are not populated, and 'success' when the Form fields are populated/submitted. I'd like the Form to require a proper/valid email address and avoid spam and header injection (maybe honeypot protection and implement a form of rate limiting (a single ip may not send more than x messages per day)). Any assistance/guidance is appreciated Quote Link to comment https://forums.phpfreaks.com/topic/310663-help-with-improving-web-form-email-validation-etc/ Share on other sites More sharing options...
gw1500se Posted April 29, 2020 Share Posted April 29, 2020 (edited) Do you mean a properly formatted email address (user@domain.com) or an email address that exists? The former is trivial with filter_var but the latter will require sending a confirmation and getting a reply. Edited April 29, 2020 by gw1500se Quote Link to comment https://forums.phpfreaks.com/topic/310663-help-with-improving-web-form-email-validation-etc/#findComment-1577329 Share on other sites More sharing options...
Chrisj Posted April 29, 2020 Author Share Posted April 29, 2020 Thanks for your reply. I mean "a properly formatted email address (user@domain.com)" Quote Link to comment https://forums.phpfreaks.com/topic/310663-help-with-improving-web-form-email-validation-etc/#findComment-1577330 Share on other sites More sharing options...
gw1500se Posted April 29, 2020 Share Posted April 29, 2020 Use filter_var. Quote Link to comment https://forums.phpfreaks.com/topic/310663-help-with-improving-web-form-email-validation-etc/#findComment-1577333 Share on other sites More sharing options...
Chrisj Posted April 29, 2020 Author Share Posted April 29, 2020 Use it how/where, please Quote Link to comment https://forums.phpfreaks.com/topic/310663-help-with-improving-web-form-email-validation-etc/#findComment-1577338 Share on other sites More sharing options...
gw1500se Posted April 29, 2020 Share Posted April 29, 2020 That is a link. Quote Link to comment https://forums.phpfreaks.com/topic/310663-help-with-improving-web-form-email-validation-etc/#findComment-1577339 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.