PHP Web system multi-domain login failure workaround, phpweb_php tutorial

Source: Internet
Author: User
Tags setcookie

PHP Web system multi-domain login failure resolution, Phpweb


The following is a simple logical structure, for the formal system needs to do specific processing.


It should be noted here: encryption and decryption must be done to verify the security. But this method is not perfect, two sites must have the same domain name, and this completely cookie-based approach, security is not high enough

function Login ()
{
$info = Callloginserver (); Accessing the logon server
if (!empty ($info))//Login succeeded
}
User is not logged in, log in to the system and invoke the login server interface

function login ()//Normal Login
{
...//Verify the legality of the user
$_session[' uid '] = $user _id;
Setcookie (' sign ', encrypt ($pass 9), ', '/', ' the.com ');
}
Check that the user is logged on to the system first
Funtion sign ()
{
$sign = $_cookie[' sign '];
if (!empty ($sign))
{
$sign = Decrypt ($sign) (www.111cn.net);
....///Login Successful
}
}
User is not logged in, log in to the system and invoke the login server interface

function loging ()//login of the system
{
...//Login Successful
Callseverlogin ();//notify User of Login

}

All sites share a login system; When a user logs on successfully in one of the sites, the system calls the login interface of the other site, completes the user's login at another site, and sets the appropriate login information, or when the user logs on, the user login information is saved only on the system, and when the user logs on to another site, The system interface must be requested to obtain information about whether the user is logged on. The disadvantage of the previous approach is that, regardless of whether users use other sites, those sites need to save the user state, the latter way, all the pressure is transferred to the login system. If you want to implement the user exit of the unified operation, you need to call the site to log on the system's exit interface, and then log on to the system interface to call the other site exit interface, or set a tag, if the tag does not exist, indicating that the user exits, at this point, just empty the mark, Other sites find that the flag does not exist knowing that the user has exited the system.

This approach requires a login interface between the login system and the site, and the logout interface. Through these interfaces, a site can easily handle user login or exit:
From:http://www.111cn.net/phper/php-gj/37194.htm


High-score Help a domain name a server running ASP PHP two Web site problem

How are you doing
1. When you install Apache do not know what port, to and IIS with a different port, so as not to conflict, the other IP can not be the same, so as to run at the same time, your ASP site and PHP site can also run simultaneously. That means you need to use different IP access
2. In fact, Php+apache suitable for Linux system, in order to play an advantage, on Windows its performance is not as good as IIS, because you need to run both ASP and PHP, it is recommended that you abandon Apache, IIS configuration support PHP. Advantage, only one Web server, can use the same IP to access multiple sites, just need to put asp,php and so on different directories.
3. If your registered domain name supports pan-resolution, you can set the two-level domain name to point to, but now most of the domain name developers have closed the personal registration of the pan domain name and the domain name steering function, the company registered can.
4. Definitely affect the site of the absolute link, suggested that the site's internal links, in addition to the necessary to replace all the relative path link, is not affected by the domain name changes.
5.APACHE is not support ASP, you must install some plug-ins, so you directly put the ASP Web site to php file is not, the same JSP running environment and PHP is different, put the JSP file under PHP is not able to run
Suggestions:
1. Since Apache only supports PHP and is configured to be more troublesome than IIS, it is recommended that you give up
2. Configure IIS so that it supports php,jsp
So the problem you're talking about will be solved. (except for the domain name)
Specific configuration methods There are many tutorials on the Internet, you can refer to, now know that the URL is not available.

PHP How to implement User level two domain name simultaneous login problem

You should look carefully at the PHP handbook and say it clearly.
BOOL Setcookie (String $name [, String $value [, int $expire [, String $path [, String $domain [, bool $secure [, BOOL $h Ttponly]] []

With the Setcookie function, an optional argument is a string $domain this is the role domain name, for example, you want to set www.aa.com and bbs.aa.com also valid for this parameter is ". AA.com" Remember the previous one.

http://www.bkjia.com/PHPjc/887099.html www.bkjia.com true http://www.bkjia.com/PHPjc/887099.html techarticle PHP Web system multi-domain Login failure resolution method, Phpweb below is just a simple logical structure, for the formal system needs to do specific processing. It is important to note that: Plus decryption must ...

  • Related Article

    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.