Ecshop mobile phone number or email user name can login method
Ecshop Tutorial/Ecshop Tutorial Net (www.ecshop119.com) 2013-06-30
A lot of people are looking for support ecshop user name, mailbox or hand number login plug-in, the following about how to implement user name, mailbox or mobile phone number login Ecshop.
Locate the following code for user.php:
if (Empty ($_post[' captcha ')) {show_message ($_lang[' Invalid_captcha '], $_lang[' Relogin_lnk '), ' user.php ', ' Error ');}
Add back:
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;}
Then add at the bottom of the user.php:
function Is_telephone ($phone) {$chars = "/^13[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$/"; if (preg_ Match ($chars, $phone)) {return true;}}
Ecshop mobile phone number or email user name can login method