Security assist help
Is it possible to prevent certain email address from registering on a website?
Example: I don't want anyone with an @yahoo.com or @gmail.com to be able to register as a user.
Thanks
Is it possible to prevent certain email address from registering on a website?
Example: I don't want anyone with an @yahoo.com or @gmail.com to be able to register as a user.
Thanks
you could hand code a check for the email address filed:
<?php
if(isset($_POST['email'])) {
$emailArray = explode("@", strtolower($_POST['email']));
if(is_array($emailArray)) {
if(in_array("yahoo.com", $emailArray) || in_array("gmail.com", $emailArray)) {
header("Location: pageName.php?badDomain=true");
}
}
}
?>
this will redirect to page called pageName.php with a badDomainURL variable
pageName.php?badDomain=true"
use an if statement to show an error message if the bad domain uRL = true:
<?php if(isset($_GET['badDomain']) && $_GET['badDomain'] == "true" ) { ?>nope<?php } ?>
you can of course edit the page name in the code.
This code goes on the register page?
The first part goes before the Head tag?
The second part is attached to the email field?
yes, the first part goes at line 1, the second snippet where you want the error to display.
Well I think I have it right but not getting the results. If you have a moment can you check it out: (see pm)
on your page the name of the email element is:
Registration_group_4_Email
did you edit the code to use the correct form element name?
you will need to change:
$_POST['email']
to:
$_POST['Registration_group_4_Email']
Still not working, do I need to also change this: $_POST['Registration_submit']
I'll need to troubleshoot directly, see the private message section.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.