Step 2: Delete the dz installation directory/forumdata/cache/cache_settings.php Step 3: Re-visit the forum
Log in and register Integration process The user submits the account and password information from the login or registration form ==> Set the cookie or session of the main website itself ==> url passes the return address forward and encoded user information and other information to dz/api/passport.php
integration Please read the official passport technical documentation carefully beforehand: http://www.discuz.net/usersguide/advanced_passport.htm
Copy content to clipboard
Code://Save this document as login.php//First copy the encryption and decryption function in the interface technical document / /In order not to make the code too messy, I copied it to the end of the document //Assume that the user name field in my user database table is UserName, the password field is Pwd, and the Email field is Email //Registration page implementation The method is similar and you can implement it yourself. If you have any questions, please send me QQ:2666556
function logout()//Logout { $passportkey="1234567890";//Replace your forum pass here Set passportkey $auth=$_COOKIE['auth']; setcookie("auth", "",time() - 3600); $forward=$_GET['forward']; If($forward=="")$forward="../../index.php";//Replace here with the absolute address or relative address of your homepage '.$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() { ====Verify input====================== if(!isset($_POST['submit'])) return; // login form The button needs to have the same name $usnm=$_POST['username'];//username is replaced with the username field in your login form Change to the password domain you log in to the form if ($ usnm == "") Return, please enter the user name! "; if ($ pwd ==" ") Return.
//==========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 "The user does not exist"; if($row["Pwd"]!=md5($pwd))return "Wrong password"; mysql_free_result($rs);
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn