@: These results make sense to me, this is what they should be.
@: I did a var_dump() in two locations and this is what I have:
Here is my previous code plus my validate_email() function:
//check for problems with the email
$res = $db->query( "SELECT email FROM account WHERE email=" . "'" . $_POST['email'] . "'" );
$is_valid = validate_email( $_POST['email'] );
var_dump( $is_valid ); //prints out "bool(true)"
if ( $db->num_rows( $res ) != 0 )
$errors['email_err'] = 1;
else if ( $is_valid == 0 )
$errors['email_err'] = 2;
else if ( $is_valid == -1 )
{
var_dump( $is_valid ); //prints out "bool(true)"
$errors['email_err'] = 3;
}
//return values: 1 if correct, 0 if not valid, -1 if valid but not stevens email
function validate_email( $email )
{
if ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) )
{
$email_pieces = explode( '@', $email );
if ( $email_pieces[1] == "stevens.edu" )
return TRUE;
else
return -1;
}
else
return FALSE;
}
Does this help at all?