abra123cadabra Posted June 4, 2007 Share Posted June 4, 2007 Hi @ll, I hope someone here has come across a similar problem or has any idea to shed some light on this. My shop is running over a year now and until this morning, it never happened before. There have not been any php upgrades on the server or any other server changes that I'm aware of. So here is the problem: Yesterday I was working on my /catalog/shopping_cart.php to display some further details about the current box size used for shipping etc. To hide this new feature from current visitors, I added the new code within an if clause. if ($_SESSION['customer_id'] = '2') { ... } Could someone please tell me, if this code sets the session variable customer_id to '2'? And that because of this, as soon as a visitor to the shop adds an item to the cart or simply goes to /catalog/shopping_cart.php, they are logged in as customer with customer_id 2 (which happens to be me). I already changed above code to have == instead of = (I want to hide the code unless customer 2 is logged in, just got the statement wrong :-( ). abra The First Law of E-Commerce: If the user can't find the product, the user can't buy the product. Feedback and suggestions on my shop welcome. Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong. Link to comment Share on other sites More sharing options...
Guest Posted June 4, 2007 Share Posted June 4, 2007 yes it does set the customer_id session to 2. Use the tep_session_xxxx wrapper functions instead. You can avoid this kind of problem, because it's easy to make a mistake with equal signs and comparisons. Link to comment Share on other sites More sharing options...
abra123cadabra Posted June 4, 2007 Author Share Posted June 4, 2007 Thanks for the fast reply. I started to panic a tiny little bit there ..., especially because I couldn't quite remember what else I modified that could have had this effect. But, I found the source of the problem, so that's a pat on the back for me and a slap on my fingers for missing that second =. abra The First Law of E-Commerce: If the user can't find the product, the user can't buy the product. Feedback and suggestions on my shop welcome. Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.