Php web system multi-domain login failure solution, phpweb

Source: Internet
Author: User

Php web system multi-domain login failure solution, phpweb

The following is a simple logical structure that requires specific processing for formal systems.


Note that security verification is required for encryption and decryption. However, this method is not perfect, and the two sites must have the same level 1 domain name. In addition, this method is completely cookie-based, and the security is not high enough.

 

Function login ()
{
$ Info = callloginserver (); // access the logon server
If (! Empty ($ info) // login successful
}
// If the user does not log on, log on to the system and call the logon server interface.

Function login () // normal Logon
{
...... // Verify the validity of the user
$ _ Session ['uid'] = $ user_id;
Setcookie ('sign', encrypt ($ pass9), '', '/', 'the. com ');
}
First, check whether the user is logged on to the system.
Funtion sign ()
{
$ Sign = $ _ cookie ['sign'];
If (! Empty ($ sign ))
{
$ Sign = decrypt ($ sign) (www.111cn.net );
... // Login successful
}
}
If the user does not log on, log on to the system and call the logon server interface.

Function loging () // log on to the system
{
... // Login successful
Callseverlogin (); // notify the user to log on

}

All sites share a logon system. When a user successfully logs on to one of the sites, the system calls the logon interfaces of other sites to log on to other sites, at the same time, set the corresponding login information; or when a user logs on, only the user login information is saved in the system. When the user logs on to another site, the user must request this system interface, obtains the logon information of a user. The disadvantage of the previous 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 logon system. To achieve a unified user exit operation, the site needs to call the exit interface for logging on to the system, and then log on to the system interface to call the exit interface for other sites; or set a flag, if this tag does not exist, it indicates that the user exits. In this case, you only need to clear the tag. If other sites find that the tag does not exist, they will know that the user has exited the system.

This method requires specifying the logon interface and logout interface between the login System and the site. Through these interfaces, sites can easily process user logon or exit:
From: http://www.111cn.net/phper/php-gj/37194.htm


High scores help one domain name and one server run ASP php websites

Hi!
1. when installing APACHE, you do not know what port is used. You must use different ports with IIS to avoid conflict. In addition, the IP address cannot be the same so that you can run the command at the same time, your ASP site and PHP site can also run simultaneously. In other words, different IP addresses are required for access.
2. in fact, PHP + APACHE is suitable for the LINUX system to take advantage of its advantages. Its performance on WINDOWS is inferior to that on IIS, because you need to run ASP and PHP at the same time. We recommend that you give up APACHE, configure IIS to support PHP. Advantage: Only one WEB server can access multiple websites with the same IP address. You only need to put ASP and PHP in different directories.
3. If your registered domain name supports wildcard resolution, you can set the second-level domain name to point to, but now most domain name providers disable the wildcard domain name and Domain Name Redirection function for personal registration, the company can register.
4. The absolute link in the website will definitely be affected. We recommend that you replace all the links in the website with the relative path link, which will not be affected by domain name changes.
5. APACHE does not support ASP, and some plug-ins must be installed. Therefore, you cannot directly put the ASP Website under the PHP file. Similarly, the JSP runtime environment is different from that of PHP, you cannot run JSP files in PHP.
Suggestion:
1. Because APACHE only supports PHP and configuration is more troublesome than IIS, we recommend 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 and can't post the website.

How can php achieve simultaneous login of user second-level domain names?

You should carefully read the instructions in the PHP manual.
Bool setcookie (string $ name [, string $ value [, int $ expire [, string $ path [, string $ domain [, bool $ secure [, bool $ httponly]

You can use the SETCOOKIE function. An optional parameter is string $ domain, which is the domain name. For example, if you want to set www.aa.com and bbs.aa.com to be equally valid, this parameter is ".aa.com". Remember that there is a previous one.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.