How to implement regional login using php

Source: Internet
Author: User
How to implement regional login using php and how to implement regional login using php

I used ecmall to develop a ordering website. I want to add a region selector on the top and display the products in different regions based on the selected region. could you tell me this function?
My practice is to save a cookie value in the entrance file when you select a region, and then modify all the items on the website to the cookie value with the region id, this can be done during the test, but there is a problem. when I quickly click on the region, the test finds that the product display is messy, and I can switch to the region one time later, is there any better way?


Reply to discussion (solution)

What does chaos mean?

I don't understand what it means .....
Every time B prints out the cookie to see if there is any problem.

// Import region login

$ Region = m ('region ');
$ Get_region = $ region-> get_list ($ parent_id = '2013 ');
$ This-> assign ('Get _ region ', $ get_region );
// Print_r ($ get_region );

Empty ($ _ COOKIE ['City _ id'])? $ Region_id = '000000': $ region_id = $ _ COOKIE ['City _ id'];

If ($ _ SERVER ['request _ method'] = 'get '){
If (! Empty ($ _ REQUEST ['regionid']) {
Setcookie ('City _ id', '', time ()-3600 );
$ Region_id = intval ($ _ REQUEST ['regionid']);
}
}

Setcookie ('City _ id', $ region_id, time () + 3600*24*30*12 );
Echo $ _ COOKIE ['City _ id'];
I'm sorry to print the cookie found value.

The problem is solved, whether the cookie value is clicked or the previous value, just perform a header jump.

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.