Exemple #1
0
function mem_form_email($atts)
{
    global $mem_form_error, $mem_form_submit, $mem_form_from, $mem_form_default;
    extract(mem_form_lAtts(array('default' => '', 'isError' => '', 'label' => mem_form_gTxt('email'), 'max' => 100, 'min' => 0, 'name' => '', 'required' => 1, 'break' => br, 'size' => '', 'class' => 'memEmail'), $atts));
    if (empty($name)) {
        $name = mem_form_label2name($label);
    }
    if ($mem_form_submit) {
        $email = trim(ps($name));
        if (strlen($email)) {
            if (!is_valid_email($email)) {
                $mem_form_error[] = mem_form_gTxt('invalid_email', array('{email}' => htmlspecialchars($email)));
                $isError = "errorElement";
            } else {
                preg_match("/@(.+)\$/", $email, $match);
                $domain = $match[1];
                if (is_callable('checkdnsrr') and checkdnsrr('textpattern.com.', 'A') and !checkdnsrr($domain . '.', 'MX') and !checkdnsrr($domain . '.', 'A')) {
                    $mem_form_error[] = mem_form_gTxt('invalid_host', array('{domain}' => htmlspecialchars($domain)));
                    $isError = "errorElement";
                } else {
                    $mem_form_from = $email;
                }
            }
        }
    } else {
        if (isset($mem_form_default[$name])) {
            $email = $mem_form_default[$name];
        } else {
            $email = $default;
        }
    }
    return mem_form_text(array('default' => $email, 'isError' => $isError, 'label' => $label, 'max' => $max, 'min' => $min, 'name' => $name, 'required' => $required, 'break' => $break, 'size' => $size, 'class' => $class));
}
function mem_phone_input($atts)
{
    global $mem_profile;
    return mem_form_text(mem_self_map_tag($atts, 'phone', $mem_profile['phone']));
}