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.