当前位置: 首页>>代码示例>>PHP>>正文


PHP isEmail函数代码示例

本文整理汇总了PHP中isEmail函数的典型用法代码示例。如果您正苦于以下问题:PHP isEmail函数的具体用法?PHP isEmail怎么用?PHP isEmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了isEmail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: proccess

 public function proccess($data = NULL, $validations = FALSE)
 {
     if (is_array($validations)) {
         foreach ($validations as $field => $validation) {
             if ($validation === "required") {
                 if (!POST($field)) {
                     $field = $this->rename($field);
                     return array("error" => getAlert("{$field} is required"));
                 }
             } elseif ($validation === "email?") {
                 if (!isEmail(POST($field))) {
                     return array("error" => getAlert("{$field} is not a valid email"));
                 }
             } elseif ($validation === "injection?") {
                 if (isInjection(POST($field))) {
                     return array("error" => getAlert("SQL/HTML injection attempt blocked"));
                 }
             } elseif ($validation === "spam?") {
                 if (isSPAM(POST($field))) {
                     return array("error" => getAlert("SPAM prohibited"));
                 }
             } elseif ($validation === "vulgar?") {
                 if (isVulgar(POST($field))) {
                     return array("error" => getAlert("Your {$field} is very vulgar"));
                 }
             } elseif ($validation === "ping") {
                 if (!ping(POST($field))) {
                     return array("error" => getAlert("Invalid URL"));
                 }
             } elseif (is_string($validation) and substr($validation, 0, 6) === "length") {
                 $count = (int) substr($validation, 7, 8);
                 $count = $count > 0 ? $count : 6;
                 if (strlen(POST($field)) < $count) {
                     return array("error" => getAlert("{$field} must have at least {$count} characters"));
                 }
             } elseif (isset($field["exists"]) and isset($this->table) and POST("save")) {
                 if (is_array($validation)) {
                     $exists = $this->Db->findBy($validation);
                     if ($exists) {
                         return array("error" => getAlert("The record already exists"));
                     }
                 }
             }
         }
     }
     if (is_null($data)) {
         $data = array();
     }
     $POST = POST(TRUE);
     foreach ($POST as $field => $value) {
         if (!in_array($field, $this->ignore)) {
             if (!isset($data[$this->rename($field)])) {
                 $data[$this->rename($field)] = decode(filter($value, "escape"));
             }
         }
     }
     return $data;
 }
开发者ID:no2key,项目名称:MuuCMS,代码行数:58,代码来源:data.php

示例2: main

function main()
{
    // Login Form
    if (isset($_POST['login'])) {
        // handle login
        $email = $_POST['email'];
        $password = sha1($_POST['password']);
        $sql = "SELECT * FROM `customers` WHERE `customer_email`='{$email}' AND `customer_password`='{$password}';";
        $result = dbQuery($sql);
        if (mysql_num_rows($result) != 1) {
            $url = BASE_URL . '/signup';
            //@todo create error message
            addMessage('نام کاربری یا رمز عبور اشتباه وارد شده است.', FAILURE);
        } else {
            $user = mysql_fetch_assoc($result);
            //@todo save user id in session
            //@todo create welcome message
            $url = BASE_URL . '/customer';
            $spKey = getSpKey();
            $_SESSION[$spKey]['customer'] = $user['id'];
            $userName = $user['customer_name'];
            addMessage($userName . ' عزیز خوش آمدید.', SUCSESS);
        }
        mysql_free_result($result);
        return array('redirect' => $url);
    }
    // SignUp Form
    if (isset($_POST['signup'])) {
        $firstName = safeQuery($_POST['firstName']);
        $lastName = safeQuery($_POST['lastName']);
        $mobile = safeQuery($_POST['mobile']);
        $email = safeQuery($_POST['email']);
        $password = sha1($_POST['password']);
        $gender = $_POST['gender'];
        if (isPhone($mobile) && isEmail($email) && !empty(trim($firstName)) && !empty(trim($lastName)) && !empty(trim($mobile)) && !empty(trim($email)) && !empty(trim($password))) {
            $sql = "SELECT * FROM `customers` WHERE  `customer_email`='{$email}'";
            $result = dbQuery($sql);
            if (mysql_num_rows($result) == 0) {
                $sql = "INSERT INTO `customers`(`customer_name`,`customer_family`,`customer_email`,`customer_password`,`customer_gender`,`customer_mobile`)\n                                        VALUES('{$firstName}','{$lastName}','{$email}','{$password}','{$gender}','{$mobile}')";
                $result = dbQuery($sql);
                addMessage('ثبت نام شما با موفقیت انجام شد. با آدرس ایمیل و رمز عور انتخابی وارد شوید', SUCSESS);
                $url = BASE_URL . '/customer';
            } else {
                $url = BASE_URL . '/signup';
                //@todo create error message
                addMessage('آدرس ایمیل واد شده تکراری میباشد، برای بازیابی رمز عبور کلیک کنید.', FAILURE);
            }
            mysql_free_result($result);
        } else {
            $url = BASE_URL . '/signup';
            //@todo create error message
            addMessage('اطلاعات فرم ثبت نام به درستی وارد نشده است.', FAILURE);
        }
        return array('redirect' => $url);
    }
}
开发者ID:mshahmalaki,项目名称:tahlildadeh-shop,代码行数:56,代码来源:index.php

示例3: send

 public function send()
 {
     if (!POST("name")) {
         return getAlert("You need to write your name");
     } elseif (!isEmail(POST("email"))) {
         return getAlert("Invalid E-Mail");
     } elseif (!POST("message")) {
         return getAlert("You need to write a message");
     }
     $values = array("Name" => POST("name"), "Email" => POST("email"), "Company" => "", "Phone" => "", "Subject" => "", "Message" => POST("message", "decode", FALSE), "Start_Date" => now(4), "Text_Date" => now(2));
     $insert = $this->Db->insert($this->table, $values);
     if (!$insert) {
         return getAlert("Insert error");
     }
     $this->sendMail();
     $this->sendResponse();
     return getAlert("Your message has been sent successfully, we will contact you as soon as possible, thank you very much!", "success");
 }
开发者ID:no2key,项目名称:MuuCMS,代码行数:18,代码来源:feedback.php

示例4: safeEmailsHelper

 /**
  * Replaces the emails with a flash text with the email
  * @param $match preg_replace match
  * @return string Flash html-code
  */
 function safeEmailsHelper($match)
 {
     JS::lib('flashurl', false, false);
     JS::loadjQuery(false, false);
     static $i = 0;
     $i++;
     if (count($match) == 2) {
         $url = $match[0];
         $label = false;
     } else {
         $url = $match[1];
         $label = $match[2];
         if (isEmail($label)) {
             $label = false;
         }
     }
     $url = base64_encode($url);
     return '<span class="flashurl"><object id="flashurl' . $i . '" type="application/x-shockwave-flash" data="lib/swf/flashurl.swf"><param name="FlashVars" value="divID=flashurl' . $i . '&amp;encURL=' . urlencode($url) . ($label ? '&amp;urlLabel=' . $label : '') . '" /><param name="movie" value="/lib/swf/flashurl.swf" /><param name="wmode" value="transparent" /></object></span>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:24,代码来源:SafeEmails.php

示例5: validation

 function validation($addmemberclass, $user_id)
 {
     global $db;
     $error = array();
     $postvar = $addmemberclass->getPostVar();
     $user_id = $_SESSION['USER_ID'];
     $first_name = trim($postvar['first_name']);
     $last_name = trim($postvar['last_name']);
     $email = trim($postvar['email']);
     $error = array();
     if ($first_name == '') {
         $error[1] = "Please Enter First Name ";
     } else {
         if (strlen($first_name) < 3) {
             $error[1] = "Please Enter at least 3 characters";
         }
     }
     if ($last_name == '') {
         $error[2] = "Please Enter Last Name ";
     } else {
         if (strlen($last_name) < 3) {
             $error[2] = "Please Enter at least 3 characters";
         }
     }
     if ($email == "") {
         $error[3] = "Please Enter Email";
     } else {
         if (isEmail($email) == 0) {
             $error[3] = "Please Enter Valid Email";
         } else {
             if ($email != "" && $user_id == "") {
                 $sql_select_email = "SELECT `email` FROM `crm_users` WHERE `email` = '{$email}'";
                 $res_select_email = $db->select_data($sql_select_email);
                 if (count($res_select_email) > 0) {
                     $error[3] = "Email Id already exists";
                 }
             }
         }
     }
     return $error;
 }
开发者ID:Entellus,项目名称:System,代码行数:41,代码来源:profile_manager.php

示例6: customValidate

 public function customValidate()
 {
     if (count($this->errors) == 0) {
         if (!isEmail($_POST['email'])) {
             $this->errors['email'] = "not_validate";
         }
         if (isset($_POST['tel'])) {
             if (!isTel($_POST['tel'])) {
                 $this->errors['tel'] = "not_validate";
             }
         }
         if (!$this->checkAvailableUsername($_POST['username'])) {
             $this->errors['username'] = "not_available";
         }
     }
     if (count($this->errors) > 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:pooya-alen1990,项目名称:sampleTalent,代码行数:21,代码来源:formValidator.php

示例7: isValid

 protected function isValid()
 {
     // making sure TA information is valid
     $valid = true;
     print '<br> validating TA information ....<br>';
     if (isEmail($this->email)) {
         print " -- Email valid.<br>\n";
     } else {
         return false;
     }
     if ($this->fullTime >= 0 and $this->fullTime <= 1) {
         print "Fulltime fraction: {$this->fullTime} -- valid.<br>\n";
     } else {
         print "Fulltime fraction: {$this->fullTime} -- invalid.<br>\n";
         return false;
     }
     if ($this->partTime >= 0 and $this->partTime <= 1) {
         print "Parttime fraction: {$this->partTime} -- valid.<br>\n";
     } else {
         print "Parttime fraction: {$this->partTime} -- invalid.<br>\n";
         return false;
     }
     return $valid;
 }
开发者ID:cpausmit,项目名称:Tapas,代码行数:24,代码来源:Ta.php

示例8: elseif

// You may add or edit lines in here.
//
// To make a field not required, simply delete the entire if statement for that field.
//
///////////////////////////////////////////////////////////////////////////
////////////////////////
// Name field is required
if (empty($name)) {
    $error .= 'Your name is required.';
}
////////////////////////
////////////////////////
// Email field is required
if (empty($email)) {
    $error .= 'Your e-mail address is required.';
} elseif (!isEmail($email)) {
    $error .= 'You have entered an invalid e-mail address.';
}
////////////////////////
////////////////////////
// Comments field is required
if (empty($message)) {
    $error .= 'You must enter a message to send.';
}
////////////////////////
////////////////////////
// Verification code is required
if ($session_verify != $posted_verify) {
    $error .= 'The verification code you entered is incorrect.';
}
////////////////////////
开发者ID:CarlosG94,项目名称:hackthehotel,代码行数:31,代码来源:contact.php

示例9: define

}
if (!defined("PHP_EOL")) {
    define("PHP_EOL", "\r\n");
}
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
if (trim($name) == '') {
    echo '<div class="error_message">You must enter your name.</div>';
    exit;
} else {
    if (trim($email) == '') {
        echo '<div class="error_message">Please enter a valid email address.</div>';
        exit;
    } else {
        if (!isEmail($email)) {
            echo '<div class="error_message">You have entered an invalid e-mail address. Please try again.</div>';
            exit;
        }
    }
}
if (trim($comments) == '') {
    echo '<div class="error_message">Please enter your message.</div>';
    exit;
}
if (get_magic_quotes_gpc()) {
    $comments = stripslashes($comments);
}
// Configuration option.
// Enter the email address that you want to emails to be sent to.
// Example $address = "joe.doe@yourdomain.com";
开发者ID:jomogolfer,项目名称:jonathanmorgan.io,代码行数:31,代码来源:contact.php

示例10: isEmail

function isEmail($email)
{
    return filter_var($email, FILTER_VALIDATE_EMAIL);
}
if ($_POST) {
    // Enter the email where you want to receive the message
    $emailTo = 'contact.azmind@gmail.com';
    $clientEmail = addslashes(trim($_POST['email']));
    $subject = addslashes(trim($_POST['subject']));
    $message = addslashes(trim($_POST['message']));
    $antispam = addslashes(trim($_POST['antispam']));
    $array = array('emailMessage' => '', 'subjectMessage' => '', 'messageMessage' => '', 'antispamMessage' => '');
    if (!isEmail($clientEmail)) {
        $array['emailMessage'] = 'Invalid email!';
    }
    if ($subject == '') {
        $array['subjectMessage'] = 'Empty subject!';
    }
    if ($message == '') {
        $array['messageMessage'] = 'Empty message!';
    }
    if ($antispam != '12') {
        $array['antispamMessage'] = 'Wrong antispam answer!';
    }
    if (isEmail($clientEmail) && $subject != '' && $message != '' && $antispam == '12') {
        // Send email
        $headers = "From: " . $clientEmail . " <" . $clientEmail . ">" . "\r\n" . "Reply-To: " . $clientEmail;
        mail($emailTo, $subject . " (bootstrap contact form tutorial)", $message, $headers);
    }
    echo json_encode($array);
}
开发者ID:2daysweb,项目名称:livesports,代码行数:31,代码来源:contact.php

示例11: sizeof

 $Capped_IP = sizeof($matches[0]) - 1;
 $MailCaptured_IPaddy = $matches[0][$Capped_IP];
 $IPaddy = "{$MailCaptured_IPaddy} (Email guess)";
 if ($DB_DeleteYN == 1) {
     imap_delete($conn, $i);
 }
 $spam_filtered = 0;
 if (!isEmpty($DB_SpamHeader)) {
     $pos = strpos($subject, $DB_SpamHeader);
     if ($pos === false) {
         $spam_filtered = 0;
     } else {
         $spam_filtered = 1;
     }
 }
 if (!UserIsSubscribed($Responder_ID, $Email_Address) && !isInBlacklist($Email_Address) && $spam_filtered == 0 && isEmail($Email_Address)) {
     if ($DB_HTML_YN == 1) {
         $Set_HTML = 1;
     } else {
         $Set_HTML = 0;
     }
     # Get responder info
     # MOD for updated GetResponder function
     if (!ResponderExists($Responder_ID)) {
         admin_redirect();
     }
     $ResponderInfo = GetResponderInfo($Responder_ID);
     // $DB_OptMethod = $ResponderInfo['OptinMethod'];
     // if ($DB_OptMethod == "Double") {$DB_Confirm_Join = '1'}
     // else {$DB_Confirm_Join = '0';}
     # Setup the data
开发者ID:majick777,项目名称:wp-infinity-responder,代码行数:31,代码来源:mailchecker.php

示例12: register

 public function register($data = array(), $autoLogin = false, $activationReturnLink = '')
 {
     if (!is_array($data)) {
         return Error::set(lang('Error', 'arrayParameter', 'data'));
     }
     if (!is_string($activationReturnLink)) {
         $activationReturnLink = '';
     }
     // ------------------------------------------------------------------------------
     // CONFIG/USER.PHP AYARLARI
     // Config/User.php dosyasında belirtilmiş ayarlar alınıyor.
     // ------------------------------------------------------------------------------
     $userConfig = $this->config;
     $joinTables = $userConfig['joinTables'];
     $joinColumn = $userConfig['joinColumn'];
     $usernameColumn = $userConfig['usernameColumn'];
     $passwordColumn = $userConfig['passwordColumn'];
     $emailColumn = $userConfig['emailColumn'];
     $tableName = $userConfig['tableName'];
     $activeColumn = $userConfig['activeColumn'];
     $activationColumn = $userConfig['activationColumn'];
     // ------------------------------------------------------------------------------
     // Kullanıcı adı veya şifre sütunu belirtilmemişse
     // İşlemleri sonlandır.
     if (!empty($joinTables)) {
         $joinData = $data;
         $data = isset($data[$tableName]) ? $data[$tableName] : array($tableName);
     }
     if (!isset($data[$usernameColumn]) || !isset($data[$passwordColumn])) {
         $this->error = lang('User', 'registerUsernameError');
         return Error::set($this->error);
     }
     $loginUsername = $data[$usernameColumn];
     $loginPassword = $data[$passwordColumn];
     $encodePassword = Encode::super($loginPassword);
     $db = uselib('DB');
     $usernameControl = $db->where($usernameColumn . ' =', $loginUsername)->get($tableName)->totalRows();
     // Daha önce böyle bir kullanıcı
     // yoksa kullanıcı kaydetme işlemini başlat.
     if (empty($usernameControl)) {
         $data[$passwordColumn] = $encodePassword;
         if (!$db->insert($tableName, $data)) {
             $this->error = lang('User', 'registerUnknownError');
             return Error::set($this->error);
         }
         if (!empty($joinTables)) {
             $joinCol = $db->where($usernameColumn . ' =', $loginUsername)->get($tableName)->row()->{$joinColumn};
             foreach ($joinTables as $table => $joinColumn) {
                 $joinData[$table][$joinTables[$table]] = $joinCol;
                 $db->insert($table, $joinData[$table]);
             }
         }
         $this->error = false;
         $this->success = lang('User', 'registerSuccess');
         if (!empty($activationColumn)) {
             if (!isEmail($loginUsername)) {
                 $email = $data[$emailColumn];
             } else {
                 $email = '';
             }
             $this->_activation($loginUsername, $encodePassword, $activationReturnLink, $email);
         } else {
             if ($autoLogin === true) {
                 $this->login($loginUsername, $loginPassword);
             } elseif (is_string($autoLogin)) {
                 redirect($autoLogin);
             }
         }
         return true;
     } else {
         $this->error = lang('User', 'registerError');
         return Error::set($this->error);
     }
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:74,代码来源:User.php

示例13: returns

        returns(error('Error sending mail'));
        return false;
    }
    return true;
};
// Validates data
$validates = function ($json) {
    if ($json === NULL) {
        returns(error('Body request not found'));
        return false;
    }
    if (!isString($json->{'name'})) {
        returns(error('Name field is empty'));
        return false;
    }
    if (!isEmail($json->{'email'})) {
        returns(error('E-mail field is empty'));
        return false;
    }
    if (!isString($json->{'password'})) {
        returns(error('Password field is empty'));
        return false;
    }
    return true;
};
// Now, read it as a human and execute our orders :)
$theData = $jsonFrom($input());
if ($validates($theData)) {
    $token = $saves($theData);
    if ($sendmail($token, $theData->{'email'})) {
        returns(success());
开发者ID:EpykOS,项目名称:mds,代码行数:31,代码来源:register.php

示例14: recaptcha_check_answer

 require_once 'recaptchalib.php';
 $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
 if (!$resp->is_valid) {
     die("<h2>Image Verification failed!. Go back and try again.</h2> (reCAPTCHA said: " . $resp->error . ")");
 }
 /************************ SERVER SIDE VALIDATION **************************************/
 /********** This validation is useful if javascript is disabled in the browswer ***/
 if (empty($data['full_name']) || strlen($data['full_name']) < 4) {
     $err[] = "ERROR - Invalid name. Please enter at least 3 or more characters for your name";
 }
 // Validate User Name
 if (!isUserID($data['user_name'])) {
     $err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
 }
 // Validate Email
 if (!isEmail($data['usr_email'])) {
     $err[] = "ERROR - Invalid email address.";
 }
 // Check User Passwords
 if (!checkPwd($data['pwd'], $data['pwd2'])) {
     $err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
 }
 $user_ip = $_SERVER['REMOTE_ADDR'];
 // stores sha1 of password
 $sha1pass = PwdHash($data['pwd']);
 // Automatically collects the hostname or domain like example.com)
 $host = $_SERVER['HTTP_HOST'];
 $host_upper = strtoupper($host);
 $path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
 // Generates activation code simple 4 digit number
 $activ_code = rand(1000, 9999);
开发者ID:heathervreeland,项目名称:Occasions-Online-WP-Theme,代码行数:31,代码来源:register.php

示例15: requireParams

 protected function requireParams($required)
 {
     $params = $this->getParams();
     foreach ($required as $param => $type) {
         // Ensure required parameters are given
         if (endsWith($type, '*')) {
             if (isset($params[$param])) {
                 $type = rtrim($type, "*");
             } else {
                 continue;
             }
             // Continue to next iteration if optional param is not given
         } else {
             if (!isset($params[$param])) {
                 $this->sendResponse(400, ['details' => 'Parameter(s) missing']);
                 return FALSE;
             }
         }
         // Ensure parameters are valid
         $paramsValid = TRUE;
         switch ($type) {
             case 'int':
                 $tmp = $params[$param];
                 if (startsWith($tmp, '-')) {
                     $tmp = substr($tmp, 1);
                 }
                 if (!ctype_digit($tmp)) {
                     $paramsValid = FALSE;
                 }
                 break;
             case 'num':
                 if (!is_numeric($params[$param])) {
                     $paramsValid = FALSE;
                 }
                 break;
             case 'str':
                 if (!is_string($params[$param])) {
                     $paramsValid = FALSE;
                 }
                 break;
             case 'arr':
                 if (!is_array($params[$param])) {
                     $paramsValid = FALSE;
                 }
                 break;
             case 'email':
                 if (!isEmail($params[$param])) {
                     $paramsValid = FALSE;
                 }
                 break;
             case 'bool':
                 if (!in_array($params[$param], ['true', 'false'])) {
                     $paramsValid = FALSE;
                 }
                 break;
             default:
                 die('Invalid parameter type specified');
                 // *DEV PURPOSES*
         }
         if (!$paramsValid) {
             $this->sendResponse(400, array('details' => 'Invalid parameter(s)'));
             return FALSE;
         }
     }
     return TRUE;
 }
开发者ID:colindignazio,项目名称:comp4350,代码行数:66,代码来源:MY_Controller.php


注:本文中的isEmail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。