I’ve run into a little snag with a project. I’m doing a signup script right now and I thought I had a way to keep people from signing up with like addresses using LIKE in the query
[php]$email = mysql_real_escape_string($_POST[‘email’]);
$ck_email = mysql_query(“SELECT email FROM users WHERE email LIKE ‘%$email%’”);
if(mysql_num_rows($ck_email) != 0) {
//$json = array(“login”=>true);
$json = array(“inuse” => 1);
} else {
$json = array(“inuse” => 0);
}
echo json_encode($json);[/php]
but I think it works a little to well. I’m testing with my email and it does work, I can’t use compfnatic80 or compfnatic90 or other variations, but its also possible for those to be legit addresses. I’m asking because I’ve a lot of issues on another site with this same scenario. I had the same guy register 3 times using variations on his email addresses. I’m looking of for a way to prevent it if possible.
This is what its returning to:
$("#email").focusout(function() {
$.post("inc/ck_details.php", $("#email").val(), function(data) {
if(data.inuse == 1) {
$("#email").attr("value", "Email In Use!");
$("#email").css("border-color", "#F00");
} else {
$("#email").attr("value", $("#email").val());
$("#email").css("border-color", "");
}
}, "json");
});