Passport was used for single-point logon before discuz6.0. Single Sign-On is easy to implement. However, discuz7.0 joins the ucenter. Therefore, single sign-on is different from the previous passport. It still cannot be implemented using several methods. You cannot always use 6.0. Therefore, we are determined to deal with 7.0 single-point logon. Add application with ucenterProgramA message indicating communication failure is displayed. So I had to go to the documents and some online solutions. It cannot be implemented in several ways.
Finally, the following method was tested in the non-endurance test. If you don't report Hope, you can. I'm glad to tell myself that I want to understand discuz.Source code. Do not view the sourceCodeNo! Put the code. You can refer to the following method if you have a blog or want to use it.
/*
* Single sign-on
*/
Public Function synloginaction (){
$ Time = Time ();
$ Username = "test_1 ";
$ Password = "123456 ";
$ Uid = 3;
If (array_key_exists ("shop_memberid", $ _ cookie )){
$ Mrow = $ this-> memberdetail ($ _ cookie ["shop_memberid"]);
If ($ mrow! = NULL ){
$ Username = $ mrow ["loginid"];
$ Password = $ mrow ["loginpwd"];
List ($ uid, $ username, $ password, $ email) = uc_user_login ($ username, $ password );
}
}
$ Authcode = uc_authcode ('Action = synlogin & username = '. $ username. '& uid = '. $ uid. '& Password = '. $ password. '& time = "'. $ time, 'encoding', 'authorization ');
$ Url = 'HTTP: // localhost: 8000/discuz/API/UC. php? Time = '. $ time.' & code = '. urlencode ($ authcode );
$ Synstr = '<SCRIPT type = "text/JavaScript" src = "'. $ URL. '" reload = "1"> </SCRIPT> ';
Echo $ synstr;
$ This-> jsgoto ("http: // localhost: 8000/discuz /");
}
You can leave a message if you have any questions!