The last time I integrated discuz's passport, I thought it was simple. I did not remember the location of today's mobile bbs. The previous integration was unavailable. how can I log on to the forum without using passport ?! It's too simple, but it takes a long time to remember. it's a waste of half an hour to find information. I have a deep understanding that good memory is not as bad as writing !! Paste the passport text block today to prevent future forgetting !! Remember, it takes time to find the information you need online !!!!!!
Passport pass integration
Article 1: Principles of integration
Please note: the possible consequences of failed integration ----- dz forum cannot be logged on, cannot be managed
Solution:
Step 1: Go to the dz database table cdb_settings and find the following rows and change them
Setting.gif(4.3 KB)
Step 2: delete the dz installation directory/forumdata/cache/cache_settings.php
Step 3: Access the forum again
Login and registration integration process The user submits the account password information from the login or registry ticket ==>
The main station program checks user login or registration. if the registration succeeds (a new user needs to be generated for registration), then ==>
Set the cookie or session of the main site itself ==>
Url transfer the returned address forward and encoded user information and other information to dz/api/passport. php
Before integration Please carefully read the official passport technical documentation: http://www.discuz.net/usersguide/advanced_passport.htm Copy content to clipboardCode:
// Save this document as login. php // First copy the encryption and decryption functions in the interface technical document // To prevent code from being too messy, I copied it to the end of the document. // Assume that the UserName field is UserName, the password field is Pwd, and the Email field is Email. // The registration page implementation method is similar. you can implement it on your own. add QQ to question: 2666556
$ Act = (isset ($ _ GET ['AC'])? $ _ GET ['AC']: "login "; If (function_exists ($ act) $ act (); else login ();
Function login () { $ ErrMsg = UserCheck (); If ($ ErrMsg! = "") Echo $ ErrMsg; // Add the code that shows your login form to the end, as shown in figure ?>
} // End function
Function logout () // logout { $ Passportkey = "1234567890"; // replace it with the passportkey set for your forum pass. $ Auth = $ _ COOKIE ['auth']; Setcookie ("auth", "", time ()-3600 ); $ Forward = $ _ GET ['Forward ']; If ($ forward = "") $ forward = ".../index. php"; // replace it with the absolute or relative address of your homepage. $ Verify = md5 ('logout'. $ auth. $ forward. $ passportkey ); $ Auth = rawurlencode ($ auth ); $ Forward = rawurlencode ($ forward ); Header ("Location: bbs/api/passport. php? Action = logout & auth = $ auth & forward = $ forward & verify = $ verify "); }
Function UserCheck () { $ Passportkey = "1234567890"; // replace it with the passportkey set for your forum pass.
// =============== Verification input ==================================== If (! Isset ($ _ POST ['submit ']) return; // the button of the login form needs to have the same name $ Usnm = $ _ POST ['username']; // replace username with the user name field in your login form $ Pwd = $ _ POST ['password']; // replace password with the password field in your login form If ($ usnm = "") return ", enter the user name! "; If ($ pwd = "") return ", enter the password! ";
// =========== Database processing ======================================== $ Db = mysql_connect ("localhost", "root ",""); Mysql_select_db ("your_db_name "); $ SQL = "Select * from 'user' where UserName = '". $ usnm. "'limit 1 "; $ Rs = mysql_query ($ SQL, $ db ); $ Row = mysql_fetch_array ($ rs ); If (! $ Row) return "this user does not exist "; If ($ row ["Pwd"]! = Md5 ($ pwd) return "incorrect password "; Mysql_free_result ($ rs );
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.