由于session导致的用户状态频繁丢失

福尔摩斯对我笑 2018-09-19 6401 次 2145条

今天收到用户的反馈,说登录后,经常会丢失登录的状态,导致下单时需要频繁登录。

收到反馈后,开始了测试,进行了数十次,并没有发现客户所反应的问题。后来我无意间切换了下网络,然后就发现问题重现了。经排查,发现该问题是由于Session导致的,尤其对于动态IP地址的客户,极为严重。

Ecshop默认的session机制

ecshop中的session和默认的session机制是不一样的。ecshop的session是自己定义的。
ecshop的session原理是基于cookie和ip综合处理生成的随即session字符串的。

ecshop的session就是当你建立一次会话之后,就会通过cookie和ip综合运算形成随即的session_id,存储在session表中。

Session建立的流程

当我们请求ecshop页面,那么就会建立session。

通过includes/init.php初始化

$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'));   //$sess就是新的session对象。

define('SESS_ID', $sess->get_session_id())

在session的类中, $GLOBALS['_SESSION'] = array();就是初始化session全局变量,$this->_ip = real_ip();

这就导致了session和ip有关。所以很多时候,在不同的浏览器下面,会造成session丢失。这个时候我们就该考虑到因为IP引起ecshop session的异常。

解决问题

所以我们需要修改Ecshop的源码,将session生成的机制重新做处理。

 

标签:

非特殊说明,本博所有文章均为博主原创。

头像也是LOGO
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 2145 条评论 1


  1. coonnass

    You need to take part in a contest for one of the best websites on the web. I most certainly will highly recommend this blog!

    回复 2020年2月26日
  2. webcam

    May I simply say what a comfort to discover somebody who actually knows what they are talking about on the web. You actually know how to bring an issue to light and make it important. More people ought to look at this and understand this side of the story. I was surprised you’re not more popular because you surely have the gift.

    回复 2020年2月26日
  3. 슬롯 머신

    Woah! I’m really enjoying the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between user friendliness and visual appearance.
    I must say you’ve done a excellent job with this. Also, the blog loads very fast for me on Chrome.
    Excellent Blog!

    回复 2020年2月26日
  4. damn

    This is a topic which is close to my heart… Thank you! Exactly where are your contact details though?

    回复 2020年2月26日
  5. render farm

    Appreciating the persistence you put into your site and in depth information you present.
    It’s good to come across a blog every once in a while that isn’t the same
    unwanted rehashed information. Wonderful read! I’ve saved your site and I’m adding your
    RSS feeds to my Google account.

    回复 2020年2月26日
  6. erection

    Having read this I believed it was rather informative. I appreciate you finding the time and effort to put this article together. I once again find myself personally spending way too much time both reading and commenting. But so what, it was still worthwhile!

    回复 2020年2月26日
  7. piss off

    I’m impressed, I must say. Seldom do I come across a blog that’s both equally educative and engaging, and without a doubt, you’ve hit the nail on the head. The issue is something that too few men and women are speaking intelligently about. I am very happy I stumbled across this during my search for something concerning this.

    回复 2020年2月26日
  8. ارشفة المواقع

    I am not sure where you are getting your information, but great
    topic. I needs to spend some time learning more or understanding more.
    Thanks for magnificent information I was looking
    for this info for my mission.

    回复 2020年2月26日
  9. assfucker

    Spot on with this write-up, I honestly believe that this web site needs a lot more attention. I’ll probably be returning to read through more, thanks for the information!

    回复 2020年2月26日
  10. jasa pembuatan sbu

    I would like to thank you for the efforts you have put in penning this blog. I’m hoping to see the same high-grade blog posts by you later on as well. In truth, your creative writing abilities has encouraged me to get my very own website now 😉

    回复 2020年2月26日
  11. 코인 카지노

    Hey there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m definitely enjoying your blog and look
    forward to new posts.

    回复 2020年2月26日
  12. 실시간 카지노

    Your style is very unique in comparison to other folks I’ve read stuff from.
    Many thanks for posting when you have the opportunity, Guess I’ll just
    book mark this web site.

    回复 2020年2月26日
  13. tin tức thế giới

    Nice read, I just passed this onto a friend
    who was doing a little research on that. And he actually bought me lunch because I found it for him smile Thus
    let me rephrase that: Thank you for lunch!

    回复 2020年2月26日
  14. 파라오 카지노

    Hey! I know this is kind of off topic but I was wondering if you knew
    where I could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m
    having trouble finding one? Thanks a lot!

    回复 2020年2月26日
  15. XO 카지노

    I simply couldn’t depart your site prior to suggesting that I extremely
    loved the usual info an individual provide to your visitors?

    Is gonna be back incessantly in order to check up on new posts

    回复 2020年2月26日
  16. 카지노

    Just desire to say your article is as astounding.
    The clearness on your publish is simply great and that i could assume
    you are an expert on this subject. Fine with your permission let me to snatch your RSS feed to stay updated
    with impending post. Thank you one million and please carry on the enjoyable work.

    回复 2020年2月26日
  17. atm 카지노

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several
    emails with the same comment. Is there any way you can remove me from that service?
    Cheers!

    回复 2020年2月26日
  18. 피망 포커

    I absolutely love your blog and find nearly all of your post’s to be just what I’m looking for.
    Does one offer guest writers to write content in your case?

    I wouldn’t mind writing a post or elaborating on a lot of the subjects you write
    in relation to here. Again, awesome website!

    回复 2020年2月26日
  19. 올인 119

    Hello! This post couldn’t be written any better!

    Reading this post reminds me of my good old room mate!
    He always kept chatting about this. I will forward this
    page to him. Pretty sure he will have a good read.
    Many thanks for sharing!

    回复 2020年2月26日
  20. la mejor tienda etnica

    I like the valuable information you provide in your articles. I will bookmark your blog and check again here frequently. I am quite certain I’ll learn many new stuff right here! Good luck for the next!

    回复 2020年2月26日
  21. Electric Mountain Bikes

    You made some clear points there. I looked on the internet for the subject and found most individuals will approve with your website.

    回复 2020年2月26日
  22. nbastreams

    Thanks for your marvelous posting! I certainly enjoyed reading it, you are a great author.I will be sure to bookmark your blog and will come back later on. I want to encourage you to ultimately continue your great work, have a nice afternoon!

    回复 2020年2月26日
  23. pornography

    Oh my goodness! Awesome article dude! Many thanks, However I am going through issues with your RSS. I don’t understand the reason why I cannot join it. Is there anyone else having similar RSS issues? Anyone that knows the answer will you kindly respond? Thanks!!

    回复 2020年2月26日
  24. pornography

    Way cool! Some extremely valid points! I appreciate you penning this write-up and the rest of the site is also really good.

    回复 2020年2月26日
  25. Lexus888 Link

    you are in point of fact a good webmaster. The website
    loading pace is amazing. It kind of feels that you are
    doing any unique trick. Moreover, The contents are masterwork.
    you’ve performed a wonderful process in this matter!

    回复 2020年2月26日
  26. faggot

    I could not resist commenting. Very well written!

    回复 2020年2月26日
  27. arse

    After I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and now whenever a comment is added I get four emails with the exact same comment. There has to be a way you are able to remove me from that service? Many thanks!

    回复 2020年2月26日
  28. 예스카지노

    Wine decanters may include a stoppered lid. Additionally, some
    wine decanters include a inbuilt rod that aids the decanting course of. http://theurbanministriesinstitute.com/__media__/js/netsoltrademark.php?d=www.yeta.vip%2Fspace.php%3Fuid%3D4838%26do%3Dblog%26id%3D10596

    回复 2020年2月26日
  29. 예스카지노

    Wine decanters may include a stoppered lid. Additionally,
    some wine decanters include a inbuilt rod that aids the decanting course of. http://theurbanministriesinstitute.com/__media__/js/netsoltrademark.php?d=www.yeta.vip%2Fspace.php%3Fuid%3D4838%26do%3Dblog%26id%3D10596

    回复 2020年2月26日
  30. 카지노 사이트

    hey there and thank you for your information – I’ve
    definitely picked up anything new from right here. I did
    however expertise a few technical issues using this web site, as I experienced
    to reload the web site lots of times previous to
    I could get it to load properly. I had been wondering if your hosting
    is OK? Not that I’m complaining, but sluggish loading instances times will often affect
    your placement in google and can damage your high-quality score if
    advertising and marketing with Adwords. Anyway I am adding this RSS to my email and could
    look out for a lot more of your respective intriguing content.
    Ensure that you update this again soon.

    回复 2020年2月26日
  31. http://iwanttobelieve.Ru/

    Pretty part of content. I simply stumbled upon yolur site and in accession capital to say that I acquire
    actually enjoyed ahcount your blog posts. Anyway I’ll be subscribing on your
    augment or even I achievement you get right of entry to constantly rapidly.

    回复 2020年2月26日
  32. 바카라 사이트

    Hiya! Quick question that’s completely off topic. Do you know
    how to make your site mobile friendly? My site looks weird when browsing from my iphone 4.
    I’m trying to find a theme or plugin that might be able to correct this problem.
    If you have any suggestions, please share. Appreciate it!

    回复 2020年2月26日
  33. douche

    Very nice article. I definitely love this site. Continue the good work!

    回复 2020年2月26日
  34. orgasim

    I truly love your site.. Great colors & theme. Did you build this amazing site yourself? Please reply back as I’m planning to create my own personal website and would like to learn where you got this from or what the theme is called. Thanks!

    回复 2020年2月26日
  35. Lexus888 Live Chat

    I don’t even know the way I stopped up here, however I assumed this post used to be good.
    I do not know who you are but certainly you’re going to a famous blogger if you are not
    already. Cheers!

    回复 2020年2月26日
  36. Zachery

    Hello to every body, it’s my first pay a visit of this weblog; this web site carries awesome and really good
    stuff in support of readers.

    回复 2020年2月26日
  37. black cock

    Everything is very open with a really clear description of the issues. It was definitely informative. Your site is useful. Thank you for sharing!

    回复 2020年2月26日
  38. XO 카지노

    Hmm is anyone else experiencing problems with the images on this blog loading?
    I’m trying to determine if its a problem on my end or if it’s the blog.
    Any responses would be greatly appreciated.

    回复 2020年2月26日
  39. 온라인 바카라

    I think this is among the most important information for me.
    And i’m glad reading your article. But want to remark on few general things, The
    website style is perfect, the articles is really excellent : D.
    Good job, cheers

    回复 2020年2月26日
  40. dating

    Greetings! Very useful advice in this particular article! It’s the little changes that will make the most significant changes. Many thanks for sharing!

    回复 2020年2月26日
  41. pussy

    I blog quite often and I genuinely thank you for your information. This article has really peaked my interest. I will take a note of your site and keep checking for new details about once a week. I opted in for your RSS feed as well.

    回复 2020年2月26日
  42. w88

    Write more, thats all I have to say. Literally, it seems as though you
    relied on the video to make your point. You obviously know what youre
    talking about, why throw away your intelligence on just posting videos
    to your blog when you could be giving us something informative to read?

    回复 2020年2月26日
  43. scr888 android

    In considered one of the most delightful turns of the election season,
    84-year-old state Sen. Douglas Henry slayed everybody in the room Thursday night when he got to his chance
    in a forum request his opponent a tough question.

    Firefighting is very little different. Can make no difference what color someone’s skin is or their when. If they score well on test , really should be offered employment.
    People today that did not score also need to analyze more.
    Regardless of race, gender or any other product.

    Most of the time if you’re have everything in writing on the form of something like
    a contract you shouldn’t have any problems. An individual are do genuine
    effort . a great chance they will be fortunate to be resolved quickly.

    Both candidates said their state should keep its system for getting the scr888 agent
    topup choose the state attorney general, what’s best than electing
    one, their particular view.

    So I’m afraid Judge Gerard Maney will continue to the Family Court until at
    least the next election in 2011, directing parents acquire drug and alcohol classes if want
    eliminate their children. Ironically, he will also continue to supervise Family Treatment Court and Juvenile Drug .

    I laugh a bit about getting caught in the grocery store on “Old Fart’s Day” (usually mid-week), when I find myself quickest thing
    on 4+ wheels in shop. However, the day a cashier looked up at me, smiled, and said, “Do you qualify for our Senior Discount?”, I admit I bristled a touch.

    This Memorial Day, as we pay tribute to folks that have
    given their lives for our freedom, let’s also remember those usually are
    still serving our country today.

    回复 2020年2月26日
  44. cell phone users

    Good write-up. I absolutely love this website. Stick with
    it!

    回复 2020年2月26日
  45. damn

    Very good information. Lucky me I came across your blog by accident (stumbleupon). I have saved as a favorite for later!

    回复 2020年2月26日
  46. modern construction equipments

    Greetings from Ohio! I’m bored at work so I decided to browse your site on my iphone during lunch break. I enjoy the information you provide here and can’t wait to take a look when I get home. I’m surprised at how quick your blog loaded on my cell phone .. I’m not even using WIFI, just 3G .. Anyways, awesome blog!

    回复 2020年2月26日
  47. 슬롯 머신

    Hiya very nice site!! Guy .. Excellent .. Superb .. I will bookmark
    your web site and take the feeds also? I’m glad to seek out numerous useful information right here in the publish, we want develop more techniques
    on this regard, thanks for sharing. . . . . .

    回复 2020年2月26日
  48. a325 tension control bolts

    Hi! I know this is kinda off topic nevertheless I’d figured I’d ask. Would you be interested in exchanging links or maybe guest writing a blog article or vice-versa? My blog covers a lot of the same subjects as yours and I think we could greatly benefit from each other. If you happen to be interested feel free to send me an email. I look forward to hearing from you! Awesome blog by the way!

    回复 2020年2月25日