Search the Community
Showing results for tags 'mysql vs sessions'.
-
After MONTHS of wrestling with "Sessions," battling ENDLESS "undefined index," "undefined this or that," "this array is not a string you idiot" errors, I think my website finally works. NOW I WANT TO SCRAP IT ALL! While fighting Sessions a few weeks ago, one of the best Admins here tossed out an idea, "...or you could use mySQL." I thought the suggestion was ridiculous ("just answer my damn question don't give me stupid alternatives")... but now the more I think about it: 1.) Sessions are a pain. 2.) Sessions are really glorified cookies a.) Nobody really likes cookies b.) Time is wasted contemplating the 'GDPR compliance' loophole (I don't want a dumb banner on my site) 3.) Sessions DO add a drag/overhead that IS noticeable, albeit barely. 4.) MANY people proudly have "cookies disabled" on their browser Conversely, mySQL is 1.) Ridiculously fast 2.) Appears to me Virtually BULLETPROOF from a "server storing server-generated data" standpoint. 3.) If you love annoying banners, you can put one up that says "THIS SITE DOES NOT USE COOKIES!" BUT.... There are 2 problems I need to overcome: Problem 1.) How to "maintain state" i.e. follow visitor through the site? Maybe generate a unique ID like this? $uniqueID = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc')); Problem 2.) My product page expands as visitor continues POSTs more products to it...... How do I "maintain state" if visitor tries to add an additional product via a $_GET request from a referral page? Example: Product Page: Bicycle: $25.00 // visitor now posts a Horse: Product Page now says: Bicycle: $25.00 Horse: $100.00 // visitor now posts a Buggy: Product Page now says: Bicycle: $25.00 Horse: $100.00 Buggy: $10.00 // visitor now adds a Donkey, via Referral Page: Product Page now says: Donkey: $25.00 (Notice how all $_POST data just got lost?) Hmmm....... Any thoughts will be appreciated (maybe not appreciated right away, but eventually 😀 )