Ecshop Login Support Mobile phone number login, email login

Source: Internet
Author: User

Change users.php

Add on top

if ($user->login ($username, $password, Isset ($_post[' Remember ')))
{
Update_user_info ();
Recalculate_price ();

$ucdata = Isset ($user->ucdata)? $user->ucdata: ";
Show_message ($_lang[' login_success '). $ucdata, Array ($_lang[' back_up_page '], $_lang[' Profile_lnk ']), Array ($back _ Act, ' user.php '), ' info ');
}

Add phone, email login
if (Is_email ($username))
{
$sql = "Select user_name from". $ecs->table (' users '). "Where email= '". $username. "'";
$username _e = $db->getone ($sql);
if ($username _e) $username = $username _e;
}



if (Is_telephone ($username))
{
$sql = "Select user_name from". $ecs->table (' users '). "Where mobile_phone= '". $username. "'";
$username _e = $db->getone ($sql);
if ($username _e) $username = $username _e;
}

Mobile phone Regular

Mobile phone number Verification 1/3/4/7/8
function Is_telephone ($phone) {
$chars = "/^13[0-9]{1}[0-9]{8}$|14[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|17[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$/ ";
if (Preg_match ($chars, $phone)) {
return true;
}
}

Ecshop Login Support Mobile phone number login, email login

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.