當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DB_Functions::validEmail方法代碼示例

本文整理匯總了PHP中DB_Functions::validEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Functions::validEmail方法的具體用法?PHP DB_Functions::validEmail怎麽用?PHP DB_Functions::validEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DB_Functions的用法示例。


在下文中一共展示了DB_Functions::validEmail方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

 $lname = $_POST['lname'];
 $email = $_POST['email'];
 $uname = $_POST['uname'];
 $password = $_POST['password'];
 $subject = "Registration";
 $message = "Hello {$fname},\n\nYou have sucessfully registered to the Piggy Rewards Loyalty program. You may begin using all of our services. \n\nRegards,\nAdmin, Loyalty Rewards Team.";
 $from = "svetvaz@gmail.com";
 $headers = "From:" . $from;
 // check if user is already existed
 if ($db->isUserExisted($email)) {
     // user is already existed - error response
     $response["error"] = 2;
     $response["error_msg"] = "User already exists.Click on 'Forgot Password to retrieve your password'";
     echo json_encode($response);
 } else {
     if (!$db->validEmail($email)) {
         $response["error"] = 3;
         $response["error_msg"] = "Invalid Email Id";
         echo json_encode($response);
     } else {
         // store user
         $user = $db->storeUser($fname, $lname, $email, $uname, $password);
         if ($user) {
             // user stored successfully
             $response["success"] = 1;
             $response["user"]["fname"] = $user["firstname"];
             $response["user"]["lname"] = $user["lastname"];
             $response["user"]["email"] = $user["email"];
             $response["user"]["uname"] = $user["username"];
             $response["user"]["uid"] = $user["unique_id"];
             $response["user"]["created_at"] = $user["created_at"];
開發者ID:yangmc423,項目名稱:AndroidLoginExample,代碼行數:31,代碼來源:index.php

示例2:

 $date_of_birth = $_POST['date_of_birth'];
 $security_question = $_POST['security_question'];
 $security_answer = $_POST['security_answer'];
 $user_password = $_POST['user_password'];
 $subject = "Registration";
 $message = "Hello {$first_name},\n\nYou have sucessfully registered to our service.\n\nRegards,\nStampsHub.";
 $from = "harsh@stampshubdemo.site50.net";
 $headers = "From:" . $from;
 // check if user is already existed
 if ($db->isUserExisted($email_id)) {
     // user is already existed - error response
     $response["error"] = 2;
     $response["error_msg"] = "User already existed";
     echo json_encode($response);
 } else {
     if (!$db->validEmail($email_id)) {
         $response["error"] = 3;
         $response["error_msg"] = "Invalid Email Id";
         echo json_encode($response);
     } else {
         // store user
         $user = $db->storeUser($utype, $first_name, $last_name, $email_id, $user_gender, $phone_number, $date_of_birth, $security_question, $security_answer, $user_password);
         if ($user) {
             // user stored successfully
             $response["success"] = 1;
             $response["user"]["utype"] = $user["utype"];
             $response["user"]["first_name"] = $user["first_name"];
             $response["user"]["last_name"] = $user["last_name"];
             $response["user"]["email_id"] = $user["email_id"];
             $response["user"]["user_gender"] = $user["user_gender"];
             $response["user"]["phone_number"] = $user["phone_number"];
開發者ID:harshj94,項目名稱:StampsHub,代碼行數:31,代碼來源:index.php


注:本文中的DB_Functions::validEmail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。