• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP validEmail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkForm

function checkForm()
{
    global $first_name, $last_name, $login, $password1, $password2, $email;
    try {
        $secret = filter_input(INPUT_POST, 'secret');
        if (empty($last_name) || empty($first_name) || empty($login) || empty($password1) || empty($password2) || empty($email) || empty($secret)) {
            throw new Exception('Нужно заполнить  все поля');
        }
        if (!validLogin($login)) {
            throw new Exception('Логин должен состоять из не мене 3-х букв латинского алфавиа цыфр и подчерка');
        }
        if (!validEmail($email)) {
            throw new Exception('Неправильный email');
        }
        if ($password1 != $password1) {
            throw new Exception('Пароли не совпадают');
        }
        if (!validUserName($first_name, $last_name)) {
            throw new Exception('Имя и фамилия могут состоять только из букв');
        }
        if (userExists($login, $email)) {
            throw new Exception('Такой логин или email уже существует.');
        }
        if ($secret != $_SESSION['secret']) {
            throw new Exception('Неверно указано число с картинки');
        }
    } catch (Exception $exc) {
        return $exc->getMessage();
    }
}
开发者ID:viljinsky,项目名称:auth2,代码行数:30,代码来源:register.php


示例2: signup

 public function signup($username, $email, $password, $storeUserIndependent = 0, $options = array())
 {
     if (!$storeUserIndependent) {
         $dbModel = $this->user_db;
     } else {
         $dbModel = $this->store_user_db;
     }
     $salt = strtolower(rand(111111, 999999));
     $password = toPassword($password, $salt);
     if ($this->isUsernameOccupied($username, 0, $storeUserIndependent)) {
         return -3;
     } elseif (!validEmail($email)) {
         return -5;
     } elseif ($this->isEmailOccupied($email, 0, $storeUserIndependent)) {
         return -6;
     } else {
         $regip = ip();
         $row = array('username' => $username, 'password' => $password, 'email' => $email, 'regip' => $regip, 'regtime' => SYS_TIME, 'lastloginip' => $regip, 'lastlogintime' => SYS_TIME, 'salt' => $salt);
         if (is_array($options) && $options) {
             foreach ($options as $k => $v) {
                 $row[$k] = $v;
             }
         }
         $rt = $dbModel->insert($row, 1);
         if ($rt) {
             return $rt;
         } else {
             return 0;
         }
     }
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:31,代码来源:userObj.class.php


示例3: requestRecommendation

function requestRecommendation($user_id, $author, $email, $message)
{
    if (!checkLock("peer")) {
        return 6;
    }
    $config = $GLOBALS['config'];
    $user_id = escape($user_id);
    $author = escape($author);
    $email = escape($email);
    if (!validEmail($email)) {
        return 1;
    }
    if (strlen($author) <= 3) {
        return 2;
    }
    //make sure there aren't too many recommendations already
    $result = mysql_query("SELECT COUNT(*) FROM recommendations WHERE user_id = '{$user_id}'");
    $row = mysql_fetch_row($result);
    if ($row[0] >= $config['max_recommend']) {
        return 4;
        //too many recommendations
    }
    //ensure this email hasn't been asked with this user already
    $result = mysql_query("SELECT COUNT(*) FROM recommendations WHERE user_id = '{$user_id}' AND email = '{$email}'");
    $row = mysql_fetch_row($result);
    if ($row[0] > 0) {
        return 5;
        //email address already asked
    }
    lockAction("peer");
    //first create an instance
    $instance_id = customCreate(customGetCategory('recommend', true), $user_id);
    //insert into recommendations table
    $auth = escape(uid(64));
    mysql_query("INSERT INTO recommendations (user_id, instance_id, author, email, auth, status, filename) VALUES ('{$user_id}', '{$instance_id}', '{$author}', '{$email}', '{$auth}', '0', '')");
    $recommend_id = mysql_insert_id();
    $userinfo = getUserInformation($user_id);
    //array (username, email address, name)
    //send email now
    $content = page_db("request_recommendation");
    $content = str_replace('$USERNAME$', $userinfo[0], $content);
    $content = str_replace('$USEREMAIL$', $userinfo[1], $content);
    $content = str_replace('$NAME$', $userinfo[2], $content);
    $content = str_replace('$AUTHOR$', $author, $content);
    $content = str_replace('$EMAIL$', $email, $content);
    $content = str_replace('$MESSAGE$', page_convert($message), $content);
    $content = str_replace('$AUTH$', $auth, $content);
    $content = str_replace('$SUBMIT_ADDRESS$', $config['site_address'] . "/recommend.php?id={$recommend_id}&user_id={$user_id}&auth={$auth}", $content);
    $result = one_mail("Recommendation request", $content, $email);
    if ($result) {
        return 0;
    } else {
        return 3;
    }
}
开发者ID:uakfdotb,项目名称:oneapp,代码行数:55,代码来源:recommend.php


示例4: csv_reader

function csv_reader($dry_run, $options)
{
    /*
     * This function does all the work of removing unwanted characters,
     * spaces, exclamation marks and such from the names in the users.csv
     * file.  
     */
    $filename = $options['file'];
    $conn = open_db_connection($options);
    $table_exists = check_table_exists($conn, $options);
    if (!$table_exists) {
        echo "\nWarning! Table does not exist\n";
    }
    if (($handle = fopen($filename, "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $num = count($data);
            //Lower case then capitalise first
            $data[0] = ucfirst(strtolower($data[0]));
            //Lower case then capitalise first
            $data[1] = ucfirst(strtolower($data[1]));
            //Lower case the email
            $data[2] = strtolower($data[2]);
            //$data[2] = preg_replace('/\s+/', "", $data[2]);
            // Remove trailing whitespaces
            $data[0] = rtrim($data[0]);
            // Remove trailing whitespaces
            $data[1] = rtrim($data[1]);
            // Remove trailing whitespaces
            $data[2] = rtrim($data[2]);
            // Remove non alphas from firstname
            $data[0] = preg_replace('/[^a-z]+\\Z/i', "", $data[0]);
            // Remove non alphas (except apostrophes) from surname
            $data[1] = preg_replace('/[^a-z\']+\\Z/i', "", $data[1]);
            // Add backslashes to escape the apostrophes
            $data[0] = addslashes($data[0]);
            $data[1] = addslashes($data[1]);
            $data[2] = addslashes($data[2]);
            echo "   email is " . $data[2] . "\n";
            if (validEmail($data[2])) {
                if ($dry_run) {
                    echo $data[0] . " " . $data[1] . " " . $data[2] . " would be written to database\n";
                } else {
                    if (!$dry_run) {
                        update_table($data, $conn);
                    }
                }
            } else {
                echo $data[0] . " " . $data[1] . " " . $data[2] . " will NOT be written to database as email is invalid\n";
            }
        }
        fclose($handle);
        $conn = null;
    }
}
开发者ID:derekldgraham,项目名称:catalyst,代码行数:54,代码来源:utilities.php


示例5: contact_callback

function contact_callback()
{
    add_filter('wp_die_ajax_handler', 'filter_ajax_hander');
    // Clean up the input values
    foreach ($_POST as $key => $value) {
        if (ini_get('magic_quotes_gpc')) {
            $_POST[$key] = stripslashes($_POST[$key]);
        }
        $_POST[$key] = htmlspecialchars(strip_tags($_POST[$key]));
    }
    // Assign the input values to variables for easy reference
    $name = isset($_POST["name"]) ? $_POST["name"] : '';
    $email = isset($_POST["email"]) ? $_POST["email"] : '';
    $message = isset($_POST["message"]) ? $_POST["message"] : '';
    // Test input values for errors
    $errors = array();
    if (strlen($name) < 2) {
        if (!$name) {
            $errors[] = "You must enter a name.";
        } else {
            $errors[] = "Name must be at least 2 characters.";
        }
    }
    if (!$email) {
        $errors[] = "You must enter an email.";
    } else {
        if (!validEmail($email)) {
            $errors[] = "You must enter a valid email.";
        }
    }
    if (strlen($message) < 10) {
        if (!$message) {
            $errors[] = "You must enter a message.";
        } else {
            $errors[] = "Message must be at least 10 characters.";
        }
    }
    if ($errors) {
        // Output errors and die with a failure message
        $errortext = "";
        foreach ($errors as $error) {
            $errortext .= "<li>" . $error . "</li>";
        }
        wp_die("<span class='failure'><h3>The following errors occured:</h3><ul>" . $errortext . "</ul></span>");
    }
    // Send the email
    $to = ot_get_option('contact_email', get_option('admin_email'));
    $subject = "Contact Form: {$name}";
    $message = "'{$name}' from email: {$email} sent a message for you : \n --------------- \n {$message}";
    $headers = "From: {$email}";
    $result = wp_mail($to, $subject, $message, $headers);
    // Die with a success message
    wp_die("<span class='success'>Well thank you! Your message has been sent.<br />We'll be in touch pretty soon!</span>", 'Message has been sent !');
}
开发者ID:samuel657677,项目名称:www.mertex.de,代码行数:54,代码来源:form.php


示例6: csv_reader

function csv_reader($dry_run, $options)
{
    /*
     *       Somewhere in this function there will be an if/else statement
     *       to test valid emails, if not valid, write to STDOUT
     *       else, call update table
     */
    $filename = $options['file'];
    /* if (dry_run)
    		open connection
    		check if table exists
    		parse file
                    don't write to table
    		write to STDOUT
               else if (!dry_run)
    		open connection
    		check if table exists
    		parse file
                    write to table */
    $conn = open_db_connection($options);
    check_table_exists($conn);
    $row = 1;
    if (($handle = fopen($filename, "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $num = count($data);
            $data[0] = ucfirst(strtolower($data[0]));
            $data[1] = ucfirst(strtolower($data[1]));
            $data[2] = strtolower($data[2]);
            if (validEmail($data[2])) {
                if ($dry_run) {
                    echo "\ndry_run is set\n";
                    echo $data[0] . " " . $data[1] . " " . $data[2] . " would be written to database";
                } else {
                    if (!$dry_run) {
                        echo "\ndry_run is not set\n";
                        update_table($data, $conn);
                    }
                }
            } else {
                //echo "\nThis email is not valid\n";
                echo "\n" . $data[0] . " " . $data[1] . " " . $data[2] . " will not be written to database as email is invalid\n";
            }
            //       echo " $num fields in line $row: \n";
            $row++;
            //                         for ($c=0; $c < $num; $c++) {
            //    echo $data[$c] . "\n";
            //                        }
        }
        fclose($handle);
    }
}
开发者ID:derekldgraham,项目名称:catalyst,代码行数:51,代码来源:update_table.php


示例7: set_errors

/**
 * Validate the form
 */
function set_errors($form)
{
    $output = array();
    // Email
    if (!validEmail($form['email'])) {
        $output[] = 'email';
    }
    // Name
    $tmp = preg_replace('/[^A-Za-z]/', '', $form['name']);
    if (strlen($tmp) == 0) {
        $output[] = 'name';
    }
    // Message
    $tmp = preg_replace('/[^A-Za-z]/', '', $form['message']);
    if (strlen($tmp) == 0) {
        $output[] = 'message';
    }
    return $output;
}
开发者ID:tbeigle,项目名称:sara,代码行数:22,代码来源:form-handler.php


示例8: extract

<?php

require_once './MCAPI.class.php';
extract($_POST);
// Get your API key from http://admin.mailchimp.com/account/api/
define('MC_API_KEY', 'enter you mailchimp api key here');
// Get your list unique id from http://admin.mailchimp.com/lists/
// under settings at the bottom of the page, look for unique id
define('MC_LIST_ID', 'enter you mailchimp unique list id');
// check if email is valid
if (isset($email) && validEmail($email)) {
    $api = new MCAPI(MC_API_KEY);
    $listID = MC_LIST_ID;
    if ($api->listSubscribe($listID, $email, '') === true) {
        echo 'success';
    } else {
        echo 'subscribed';
    }
} else {
    echo 'invalid';
}
function validEmail($email = NULL)
{
    return preg_match("/^[\\d\\w\\/+!=#|\$?%{^&}*`'~-][\\d\\w\\/\\.+!=#|\$?%{^&}*`'~-]*@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\\.[A-Z]{2,6}\$/ix", $email);
}
开发者ID:antaonline,项目名称:PruebaBackgroundVideo,代码行数:25,代码来源:subscription.php


示例9: verifyUser

//register a new user. Makes plenty of checks against duplicate users and common emails
require "../common.php";
if (!empty($_GET["code"])) {
    verifyUser($_GET['email'], $_GET["code"], $DATABASE);
    die;
}
//TODO: Refactor this section
//if any of these are not set, the page will die
if (empty($_POST["email"]) || empty($_POST["password"]) || empty($_POST["password2"]) || empty($_POST["first-name"]) || empty($_POST["last-name"]) || empty($_POST["zip"]) || empty($_POST["phone"])) {
    error("Missing Field", "You tried to register without completing a required field");
}
if ($_POST["password"] !== $_POST["password2"]) {
    error("Passwords Don't Match", "Your passwords did not match");
}
if (!validEmail($_POST["email"])) {
    error("Invalid Email", "Your email " . $_POST["email"] . " is invalid");
}
if (!validPassword($_POST["password"])) {
    error("Invalid Password", "Your password must be longer than 8 characters in length");
}
//evaluate mailing preferences
$mailing = 1;
if (!isset($_POST["mailing"])) {
    $mailing = 0;
}
//cryptify the password
$password = $_POST["password"];
$hash = password_hash($password, PASSWORD_BCRYPT);
$veriRaw = randomString();
//repackaged for easier imploding later, when creating a new user
开发者ID:BBKolton,项目名称:EXCO,代码行数:30,代码来源:registeruser.php


示例10: clean_param

/**
 * Clean the passed parameter
 *
 * @param mixed $param the variable we are cleaning
 * @param int $type expected format of param after cleaning.
 * @return mixed
 */
function clean_param($param, $type)
{
    global $CFG, $ERROR, $HUB_FLM;
    if (is_array($param)) {
        $newparam = array();
        foreach ($param as $key => $value) {
            $newparam[$key] = clean_param($value, $type);
        }
        return $newparam;
    }
    switch ($type) {
        case PARAM_TEXT:
            // leave only tags needed for multilang
            if (is_numeric($param)) {
                return $param;
            }
            $param = stripslashes($param);
            $param = clean_text($param);
            $param = strip_tags($param, '<lang><span>');
            $param = str_replace('+', '&#43;', $param);
            $param = str_replace('(', '&#40;', $param);
            $param = str_replace(')', '&#41;', $param);
            $param = str_replace('=', '&#61;', $param);
            $param = str_replace('"', '&quot;', $param);
            $param = str_replace('\'', '&#039;', $param);
            return $param;
        case PARAM_HTML:
            // keep as HTML, no processing
            $param = stripslashes($param);
            $param = clean_text($param);
            return trim($param);
        case PARAM_INT:
            return (int) $param;
        case PARAM_NUMBER:
            return (double) $param;
        case PARAM_ALPHA:
            // Remove everything not a-z
            return preg_replace('/([^a-zA-Z])/i', '', $param);
        case PARAM_ALPHANUM:
            // Remove everything not a-zA-Z0-9
            return preg_replace('/([^A-Za-z0-9])/i', '', $param);
        case PARAM_ALPHAEXT:
            // Remove everything not a-zA-Z/_-
            return preg_replace('/([^a-zA-Z\\/_-])/i', '', $param);
        case PARAM_ALPHANUMEXT:
            // Remove everything not a-zA-Z0-9-
            return preg_replace('/([^a-zA-Z0-9-])/i', '', $param);
        case PARAM_BOOL:
            // Convert to 1 or 0
            $tempstr = strtolower($param);
            if ($tempstr == 'on' or $tempstr == 'yes' or $tempstr == 'true') {
                $param = 1;
            } else {
                if ($tempstr == 'off' or $tempstr == 'no' or $tempstr == 'false') {
                    $param = 0;
                } else {
                    $param = empty($param) ? 0 : 1;
                }
            }
            return $param;
        case PARAM_BOOLTEXT:
            // check is an allowed text type boolean
            $tempstr = strtolower($param);
            if ($tempstr == 'on' or $tempstr == 'yes' or $tempstr == 'true' or $tempstr == 'off' or $tempstr == 'no' or $tempstr == 'false' or $tempstr == '0' or $tempstr == '1') {
                $param = $param;
            } else {
                $param = "";
            }
            return $param;
        case PARAM_PATH:
            // Strip all suspicious characters from file path
            $param = str_replace('\\\'', '\'', $param);
            $param = str_replace('\\"', '"', $param);
            $param = str_replace('\\', '/', $param);
            $param = ereg_replace('[[:cntrl:]]|[<>"`\\|\':]', '', $param);
            $param = ereg_replace('\\.\\.+', '', $param);
            $param = ereg_replace('//+', '/', $param);
            return ereg_replace('/(\\./)+', '/', $param);
        case PARAM_URL:
            // allow safe ftp, http, mailto urls
            include_once $CFG->dirAddress . 'core/lib/url-validation.class.php';
            $URLValidator = new mrsnk_URL_validation($param, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL);
            if (!empty($param) && $URLValidator->isValid()) {
                // all is ok, param is respected
            } else {
                $param = '';
                // not really ok
            }
            return $param;
        case PARAM_EMAIL:
            if (validEmail($param)) {
                return $param;
            } else {
//.........这里部分代码省略.........
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:101,代码来源:sanitise.php


示例11: emailLogin

function emailLogin($patient_id, $message)
{
    $patientData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid`=?", array($patient_id));
    if ($patientData['hipaa_allowemail'] != "YES" || empty($patientData['email']) || empty($GLOBALS['patient_reminder_sender_email'])) {
        return false;
    }
    if (!validEmail($patientData['email'])) {
        return false;
    }
    if (!validEmail($GLOBALS['patient_reminder_sender_email'])) {
        return false;
    }
    $mail = new MyMailer();
    $pt_name = $patientData['fname'] . ' ' . $patientData['lname'];
    $pt_email = $patientData['email'];
    $email_subject = xl('Access Your Patient Portal');
    $email_sender = $GLOBALS['patient_reminder_sender_email'];
    $mail->AddReplyTo($email_sender, $email_sender);
    $mail->SetFrom($email_sender, $email_sender);
    $mail->AddAddress($pt_email, $pt_name);
    $mail->Subject = $email_subject;
    $mail->MsgHTML("<html><body><div class='wrapper'>" . $message . "</div></body></html>");
    $mail->IsHTML(true);
    $mail->AltBody = $message;
    if ($mail->Send()) {
        return true;
    } else {
        $email_status = $mail->ErrorInfo;
        error_log("EMAIL ERROR: " . $email_status, 0);
        return false;
    }
}
开发者ID:bharathi26,项目名称:openemr,代码行数:32,代码来源:create_portallogin.php


示例12: explode

     $expprice = explode("_", $curfield->getrelatedfield());
     if ($_POST['' . $expprice[0]] == "nogo" || $_POST['' . $expprice[1]] == "nogo") {
         $headerloc = "Location: ../../index.php?page=" . $thepage->getfoldername() . "/add/index.php&message=You must select: " . $curfield->getdisplaynameoffield() . ".";
         header($headerloc);
         unset($headerloc);
         exit;
     }
 } elseif ($curfield->gettypeoffield() == "link") {
     if (trim($_POST['' . $curfield->getrelatedfield()]) == "" || trim($_POST['' . $curfield->getrelatedfield()]) == "http://") {
         $headerloc = "Location: ../../index.php?page=" . $thepage->getfoldername() . "/add/index.php&message=You must enter: " . $curfield->getdisplaynameoffield() . ".";
         header($headerloc);
         unset($headerloc);
         exit;
     }
 } elseif ($curfield->gettypeoffield() == "email") {
     if (!validEmail(trim($_POST['' . $curfield->getrelatedfield()]))) {
         $headerloc = "Location: ../../index.php?page=" . $thepage->getfoldername() . "/add/index.php&message=You must enter a valid: " . $curfield->getdisplaynameoffield() . ".";
         header($headerloc);
         unset($headerloc);
         exit;
     }
 } elseif ($curfield->gettypeoffield() == "date") {
     $expvaldate = explode("_", $curfield->getrelatedfield());
     if ($_POST['' . $expvaldate[0]] == "nogo" || $_POST['' . $expvaldate[1]] == "nogo" || $_POST['' . $expvaldate[2]] == "nogo") {
         $headerloc = "Location: ../../index.php?page=" . $thepage->getfoldername() . "/add/index.php&message=You must enter a valid: " . $curfield->getdisplaynameoffield() . ".";
         header($headerloc);
         unset($headerloc);
         exit;
     }
 } elseif ($curfield->gettypeoffield() == "select") {
     if ($_POST['' . $curfield->getrelatedfield()] == "nogo") {
开发者ID:prostart,项目名称:cobblestonepath,代码行数:31,代码来源:process_add.php


示例13: recaptcha_check_answer

        echo 0;
    }
    $mysql->close();
    exit;
}
//User key actions
if (isset($_POST['recaptcha_response_field'])) {
    require_once 'recaptchalib.php';
    $recap_resp = recaptcha_check_answer($privatekey, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
    if ($recap_resp->is_valid) {
        require_once 'db.php';
        require_once 'common.php';
        //if we have email, validate it
        $mail = Null;
        if (isset($_POST['mail'])) {
            if (validEmail($_POST['mail'])) {
                $mail = trim($_POST['mail']);
            }
        }
        //put new key in db
        $sql = 'INSERT INTO users(userkey, mail, ip) VALUES(UNHEX(?), ?, ?)
                ON DUPLICATE KEY UPDATE userkey=UNHEX(?), ip=?, ts=CURRENT_TIMESTAMP()';
        $stmt = $mysql->stmt_init();
        $ip = ip2long($_SERVER['REMOTE_ADDR']);
        $userkey = gen_key();
        $stmt->prepare($sql);
        $stmt->bind_param('ssisi', $userkey, $mail, $ip, $userkey, $ip);
        $stmt->execute();
        $stmt->close();
        //set cookie
        setcookie('key', $userkey, 2147483647, '', '', false, true);
开发者ID:BAKMAH,项目名称:dwpa,代码行数:31,代码来源:index.php


示例14: yourls_escape

     break;
 case "join":
     $username = yourls_escape($_POST['username']);
     $password = $_POST['password'];
     if (captchaEnabled()) {
         require_once 'recaptchalib.php';
         $privatekey = YOURLS_MULTIUSER_CAPTCHA_PRIVATE_KEY;
         $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         if (!$resp->is_valid) {
             $error_msg = "Captch is incorrect.";
             require_once 'formjoin.php';
             break;
         }
     }
     if (!empty($username) && !empty($password)) {
         if (validEmail($username) === false) {
             $error_msg = "E-mail not recognized!";
             require_once 'formjoin.php';
         } else {
             $table = YOURLS_DB_TABLE_USERS;
             $results = $ydb->get_results("select user_email from `{$table}` where `user_email` = '{$username}'");
             if ($results) {
                 $error_msg = "Please choose other username.";
                 require_once 'formjoin.php';
             } else {
                 $token = createRandonToken();
                 $password = md5($password);
                 $ydb->query("insert into `{$table}` (user_email, user_password, user_token) values ('{$username}', '{$password}', '{$token}')");
                 $results = $ydb->get_results("select user_token from `{$table}` where `user_email` = '{$username}'");
                 if (!empty($results)) {
                     $token = $results[0]->user_token;
开发者ID:Efreak,项目名称:YOURLS,代码行数:31,代码来源:index.php


示例15: header

}
if (empty($email)) {
    header('Content-Type: application/json');
    echo json_encode(array('status' => 'ERROR', 'msg' => 'empty e-mail address.'));
    die;
}
$files = array('testrechnung.pdf');
$path = __DIR__ . '/../assets/';
$mailto = $email;
$from_mail = 'rechnung@' . $tld;
$from_name = 'rechnung@' . $tld;
$replyto = 'hallo@' . $tld;
$subject = '€ Welcome ' . $email . '!';
$message = "Hello @ {$tld} &mdash; " . $email;
mail_attachment(array(), null, $replyto, $replyto, $replyto, $mailto, $subject, $message);
if (validEmail($email)) {
    // login
    $cmd = "curl -H 'Authorization: Basic {$n26_bearer}' -d 'username=" . urlencode($n26_user) . '&password=' . urlencode($n26_pass) . "&grant_type=password' -X POST {$n26_api}/oauth/token";
    $response = shell_exec($cmd);
    $json = json_decode($response);
    $access_token = $json->access_token;
    // send invitation
    $cmd = "curl -H 'Authorization: bearer {$access_token}' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{email: \"" . $email . "\"}' -X POST {$n26_api}/api/aff/invite";
    $response = shell_exec($cmd);
    // print_r($response);
    $json = json_decode($response);
    // print_r($json);
    // todo: response without content -- check for http status
    if (isset($json->status) && $json->status == 'OK') {
        $subject = '€ ' . $tld . ' Konto anlegen';
        $message = '<b>Hallo!</b><br/><br/>
开发者ID:evo42,项目名称:willzahlen.at,代码行数:31,代码来源:invite.php


示例16: htmlentities

    }
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($_POST["MM_insert"]) && $_POST["MM_insert"] == "frm_insert") {
    $fld_required = array('vis_f_name', 'vis_l_name', 'vis_email', 'vis_password');
    $fld_missing = array();
    foreach ($_POST as $key => $value) {
        if (empty($value) && in_array($key, $fld_required)) {
            array_push($fld_missing, $key);
        }
    }
    if ($_POST['vis_email'] != '') {
        if (!validEmail($_POST['vis_email'])) {
            array_push($fld_missing, 'email_invalid');
        }
    }
    mysql_select_db($database_conndb, $conndb);
    $query_rsDuplicate = "SELECT usr_email FROM tbl_users WHERE usr_email = '" . $_POST['vis_email'] . "'";
    $rsDuplicate = mysql_query($query_rsDuplicate, $conndb) or die(mysql_error());
    $row_rsDuplicate = mysql_fetch_assoc($rsDuplicate);
    $totalRows_rsDuplicate = mysql_num_rows($rsDuplicate);
    if ($totalRows_rsDuplicate > 0) {
        array_push($fld_missing, 'duplicate');
    }
    mysql_free_result($rsDuplicate);
    if (!empty($fld_missing)) {
        if (in_array('vis_f_name', $fld_missing)) {
            $vis_f_name = 'Please provide your first name';
开发者ID:ssd-tutorials,项目名称:registration-login-password-reset,代码行数:31,代码来源:index.php


示例17: array

	------------------------------------------------------------------------- */
$errors = array();
//validate name
if (isset($_POST["sendername"])) {
    if (!$sendername) {
        $errors[] = "You must enter a name.";
    } elseif (strlen($sendername) < 2) {
        $errors[] = "Name must be at least 2 characters.";
    }
}
//validate email address
if (isset($_POST["emailaddress"])) {
    if (!$emailaddress) {
        $errors[] = "You must enter an email.";
    } else {
        if (!validEmail($emailaddress)) {
            $errors[] = "Your must enter a valid email.";
        }
    }
}
//validate subject
if (isset($_POST["sendersubject"])) {
    if (!$sendersubject) {
        $errors[] = "You must enter a subject.";
    } elseif (strlen($sendersubject) < 4) {
        $errors[] = "Subject must be at least 4 characters.";
    }
}
//validate message / comment
if (isset($_POST["sendermessage"])) {
    if (strlen($sendermessage) < 10) {
开发者ID:joshualivesay,项目名称:thegearsafe,代码行数:31,代码来源:smartprocess.php


示例18: sqlstr

if (isset($_REQUEST[action]))
{
	$username = sqlstr($_REQUEST[username]);
	$password = sqlstr($_REQUEST[password]);
	$password2 = sqlstr($_REQUEST[password2]);
	$email = sqlstr($_REQUEST[email]);

	$hash = md5($password);
	
	$userExists = $conn->queryOne("SELECT user_id FROM users WHERE username = '$username'");
	$userLengthValid = strlen($username) >= 3;
	
	$passwordLengthValid = strlen($password) >= 6;
	$passwordMatches = $password == $password2;
	
	$emailValid = validEmail($email);
	
	switch ($_REQUEST[action])
	{
		case "checkusername":
			if ($userExists)
				echo "0|The username <b>$username</b> is already taken.  Please choose another.";
			else if (!$userLengthValid)
				echo "0|Your chosen username is too short.";
			else
				echo "1|This username is valid!";
			exit();
		case "checkpassword":
			echo $passwordLengthValid ? "1" : "0";
			echo "|";
			
开发者ID:peppy,项目名称:pTransl,代码行数:30,代码来源:register.php


示例19: validChars

* register user
*
*/
if (isset($_POST['reg'])) {
    if (empty($_POST['rUsername'])) {
        $loginError .= C_LANG1 . "<br>";
    } else {
        $loginError .= validChars($_POST['rUsername']);
    }
    if (empty($_POST['rPassword'])) {
        $loginError .= C_LANG2 . "<br>";
    }
    if (empty($_POST['rEmail'])) {
        $loginError .= C_LANG3 . "<br>";
    } else {
        $loginError .= validEmail($_POST['rEmail']);
    }
    if (empty($_POST['terms'])) {
        $loginError .= C_LANG4 . "<br>";
    }
    if ($loginError) {
        include "templates/" . $CONFIG['template'] . "/login.php";
        die;
    } else {
        $loginError = registerUser($_POST['rUsername'], $_POST['rPassword'], $_POST['rEmail']);
        include "templates/" . $CONFIG['template'] . "/login.php";
        die;
    }
}
/*
* reset eCredit sessions
开发者ID:TheWandererLee,项目名称:Git-Projects,代码行数:31,代码来源:index.php


示例20: resetPassword

function resetPassword($email)
{
    // include files
    include getDocPath() . "includes/session.php";
    include getDocPath() . "includes/db.php";
    include getDocPath() . "lang/" . $_SESSION['lang'];
    $error = validEmail($email);
    if ($error) {
        return C_LANG26;
    }
    $userFound = '0';
    $tmp = mysql_query("\n\t\t\tSELECT username, email  \n\t\t\tFROM prochatrooms_users \n\t\t\tWHERE email ='" . makeSafe($email) . "' \n\t\t\tLIMIT 1\n\t\t\t");
    while ($i = mysql_fetch_array($tmp)) {
        $userFound = '1';
        $newpass = substr(md5(date("U") . rand(1, 99999)), 0, -20);
        // update users password
        $sql = "UPDATE prochatrooms_users \n\t\t\t\tSET password = '" . md5($newpass) . "' \n\t\t\t\tWHERE email ='" . makeSafe($email) . "' \n\t\t\t\t";
        mysql_query($sql) or die(mysql_error());
        // send email with new password
        sendUserEmail('', $i['username'], $i['email'], $newpass, '1');
        return C_LANG27;
    }
    if (!$userFound) {
        return C_LANG28;
    }
}
开发者ID:TheWandererLee,项目名称:Git-Projects,代码行数:26,代码来源:functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP validHtmlStr函数代码示例发布时间:2022-05-23
下一篇:
PHP validCode函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap