Last successful upgrade of the most dirt Business Edition, Next is the integration of the company's community site, first of all, I now work is a local community site, using the basic program is phpwind, my task is to let Phpwind and the most Earth login synchronization, leadership also know that my technical ability is limited, not high requirements, So let me do it first and then consider the other. Spot, it's started.
In my immature process thinking ability, first of all, I negate the method of rewriting the program, again denying the method of introducing the Phpwind verification method to the most Earth, and finally came up with a compromise to make the unique ID of two tables the same: The Phpwind user table is the main table, the most soil user table is an external table, Allow the Earth User ID and the Phpwind user table UID One by one to correspond, through the user ID to complete the next synchronization work.
Many words do not say, on the steps.
First step: User synchronization New Phpwind user, the most soil synchronization corresponding user, the most earth ID corresponding Phpwind user ID.
register.php
Copy CodeThe code is as follows:
$db->update (INSERT into Tg_user (id,email,username,password,city_id,create_time,enable,realname) VALUES ('. $ Winduid. "', '". Addslashes ($regemail). "', '". Addslashes ($regname). "', '", $windpwd. "', ' 1 ', '". Time (). "', ' Y ', '". Addslashes ($regname) ("')");
Step Two: Modify the most earth login mode using cookie method Remove the password and change the authentication user name to the user ID.
ZUser.class.php
Copy CodeThe code is as follows:
$field = Strpos ($email, ' @ ')? ' Email ': ' id ';//username
$zuituuser = Db::gettablerow (' Tg_user ', Array (
$field => $email,
' Password ' => $password,
Step Three: Login Phpwind writes the user ID to the cookie value, exits Phpwind clears the user ID from the cookie value login.php/register.php
Write Cookie
Setcookie ("Cookieid", $Winduid);
Clear cookies
Setcookie ("Cookieid", "" ", Time ()-3600);
Fourth Step: Modify the most soil page connection Header.html
Copy CodeThe code is as follows:
<ul class= "Links" >
<li class= "username" > Welcome, {$login _user[' username ']}! </li>
<li class= "Account" ><a href= "/order/index.php" id= "MyAccount" class= "account" > My {$INI [' system '] [' Abbreviation ']}</a></li>
<li class= "Logout" ><a href= "http://www.cnblogs.com/". /login.php?action=quit&verify={$_cookie[' setout '} ' > Exit </a></li>
</ul>
<!--{else}-->
<ul class= "Links" >
<li class= "Login" ><a href= "/... /login.php "> Login </a></li>
<li class= "Signup" ><a href= "/. /register.php "> Registration </a></li>
</ul>
The sync login is successful, all logins and exits are done within the phpwind, and the most Earth is only responsible for accepting whether the pass is null to confirm login.
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.