本文整理汇总了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"];
示例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"];