Home > Article > Backend Development > Common function implementation processes in PHP development
1. PC website login
1. Obtain and filter the username, password and verification code submitted by the user
2. Verify whether the verification code submitted by the user is consistent with the verification code in the session
3. Verify whether the user name exists
4. Obtain the password based on the user name and verify whether the password is Consistent
5. If the password is consistent, the login is successful and jumps to the corresponding home page
Image:
##2. PC website registration
1. Ajax obtains the user name and mobile phone number to be registered, and verifies whether it is occupied , if it has been occupied, give the corresponding prompt2. Connect to the SMS platform and send the verification code according to the generated random number combination3. Delete the verification code cache under this number4. Add the verification code cache under this number5. Ajax obtains two passwords and compares them. If they are inconsistent, a corresponding prompt is given6. Verify whether the verification codes are consistent7. If the passwords are consistent, execute registration, jump to the home page, and delete the current mobile phone number verification code cache Image:
3. Third-party login (qq, WeChat, Weibo, coding.net, Baidu, github, etc.)
The process of each third-party login platform is similar. Here is the introduction of qq third-party login1. Obtain the app_id, app_key, and callback address from the qq developer platform2. Splice request url3. The request carries the state value to prevent CSRF attacks. The callback page will be returned as is 4. Process the callback and verify whether the returned state value is consistent with the local state value5. If the state values are consistent, then obtain accsess_token based on the returned code value 6. Get openid and user information based on accsess_token (on third-party platforms, each QQ number corresponds to a unique openid) 7. Perform local login registration operation based on openid For example (determine whether the user is a new user of the website based on openid. If it is a new user, execute the registration process within the website and generate a corresponding uid, and then write the uid into the session or cookie to maintain the session. If the openid already exists, perform the login operation and directly write the uid corresponding to the openid into the session or cookie to maintain the session). For more PHP related knowledge, please visitPHP Tutorial!
The above is the detailed content of Common function implementation processes in PHP development. For more information, please follow other related articles on the PHP Chinese website!