Home  >  Article  >  Backend Development  >  Solution to multi-domain login failure in php web system, phpweb_PHP tutorial

Solution to multi-domain login failure in php web system, phpweb_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:17:59702browse

Solution to multi-domain login failure in php web system, phpweb

The following is just a simple logical structure, and specific processing is required for the formal system.


What needs to be noted here is: encryption and decryption must require security verification. However, this method is not perfect. The two sites must have the same first-level domain name; in addition, this completely cookie-based method is not secure enough

function login()
{
$info = callloginserver(); //Access the login server
if (!empty($info)) //Login successful
}
//If the user is not logged in, log in to this system and call the login server interface

function login() //Normal login
{
.......//Verify the legitimacy of the user
$_session['uid'] = $user_id;
setcookie('sign', encrypt($pass9), '', '/', 'the.com');
}
First check whether the user is logged in in the login system
funtion sign()
{
$sign = $_cookie['sign'];
if(!empty($sign))
{
$sign = decrypt($sign)(www.111cn.net ;
function logging() //Login to this system
{
.....//Login successful
callseverlogin();//Notify user to log in

}

All sites share a login system; when a user successfully logs in on one of the sites, the system calls the login interface of other sites to complete the user's login on other sites and sets the corresponding login information; or when the user logs in When the user logs in, only the user login information is saved in this system. When the user logs in at other sites, the system interface must be requested to obtain information about whether the user is logged in. The disadvantage of the former method is that no matter whether the user uses other sites, those sites need to save the user status; the latter method transfers all the pressure to the login system. If you want to realize the unified operation of user exit, you need the site to call the exit interface of the login system, and then the login system interface calls the exit interface of other sites; or set a mark to indicate the user to exit if the mark does not exist. At this time, just put Just clear the mark. If other sites find that the mark does not exist, they will know that the user has exited the system.

This processing method requires stipulating the login interface and logout interface between the login system and the individual site. Through these interfaces, a site can easily handle user login or logout:

from:http://www.111cn.net/phper/php-gj/37194.htm


High score helps with the problem of two websites running ASP php on one domain name and one server

Hello
1. You don’t know what port you used when installing APACHE. You need to use a different port with IIS to avoid conflicts. In addition, the IP cannot be the same so that your ASP site and PHP can run at the same time. Sites can also run simultaneously. In other words, you need to use different IPs to access
2. In fact, PHP+APACHE is suitable for LINUX systems to take advantage of it. Its performance on WINDOWS is not as good as IIS because you need to run ASP and PHP at the same time. It is recommended that you give up. APACHE, just configure IIS to support PHP. The advantage is that there is only one WEB server and you can use the same IP to access multiple websites. You only need to put ASP, PHP, etc. in different directories.
3. If the domain name you registered supports pan-resolution, you can set up a second-level domain name to point to it. However, most domain name providers have now turned off the pan-domain name and domain name redirection functions for personal registration, but company registration is OK.
4. It will definitely affect the absolute links in the website. It is recommended that all links within the website, except the necessary links, be replaced with relative path links, so that they will not be affected by domain name changes.

5.APACHE does not support ASP. You must install some plug-ins, so you cannot directly put the ASP website under the PHP file. Similarly, the running environment of JSP is different from that of PHP. Put the JSP file under It cannot run under PHP
Suggestions:
1. Since APACHE only supports PHP, and the configuration is more troublesome than IIS, it is recommended that you give up
2. Configure IIS to support PHP and JSP
In this way, all the problems you mentioned will be solved. (Except for the domain name)
There are many tutorials on the Internet for specific configuration methods. You can refer to them. Now I know that the URL cannot be posted.




How to achieve simultaneous login of users’ secondary domain names in php

You should read it carefully in the PHP manual as it is very clear
bool setcookie ( string $name [, string $value [, int $expire [, string $path [, string $domain [, bool $secure [, bool $httponly]]]]]]

Just use the SETCOOKIE function. There is an optional parameter: string $domain. This is the domain name. For example, you want to set www.aa.com and bbs.aa.com It is also valid if this parameter is ".aa.com". Remember there is a .
in front of it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/887099.htmlTechArticlephp web system multi-domain login failure solution, phpweb The following is just a simple logical structure, which needs to be done for the formal system specific processing. What needs to be noted here is: encryption and decryption must...
Statement:
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