ariklevy Posted February 12, 2009 Posted February 12, 2009 I've searched all over and I know this is pretty simple but I can't find a solution anywhere. I store a bunch of information in session variable on my website. Primarily I'm interested in knowing if a user has already logged in to my website which Auth.php stores in a session variable along with the username. However, as soon as you go to my /catalog directory (osCommerce) the session gets overwritten by OSC's new session. I renamed the PHP_SESSION_NAME to PHPSESSID to try to just have OSC use the same session but it still creates a new one. Any way that I can access my website session through OSC or access the OSC session through my website would be a lifesaver. Thanks Arik.
morehawes Posted February 26, 2009 Posted February 26, 2009 I've searched all over and I know this is pretty simple but I can't find a solution anywhere. Hi, I am having a very similar problem that I have been trying to solve. I am trying to access the session variables set by OSc from outside the catalog directory. For example my OSc installation is inside www.mydoimain.co.uk/shop, on www.mydoimain.co.uk/index.php I am trying to determine whether a user is logged in to the shop by checking $_SESSION['customer_id'] however the followig returns false once a user is logged in: <?php /* This is www.mydoimain.co.uk/index.php, catalog directory is www.mydoimain.co.uk/shop */ session_start(); ... isset($_SESSION['customer_id']); //this returns false on this page but not in OSc catalog page ... ?> I have turned on force cookie usage and the cookie path to be for the whole domain in includes/configure.php: define('HTTP_COOKIE_PATH', '/'); define('HTTPS_COOKIE_PATH', '/'); Any ideas anyone? There must be a way of accessing the session variables I just can't work it out! Many thanks in advance. Joe. Joe MacMan strikes again! Always backup first before listening to me!
gbb123 Posted July 11, 2009 Posted July 11, 2009 I've searched all over and I know this is pretty simple but I can't find a solution anywhere. I store a bunch of information in session variable on my website. Primarily I'm interested in knowing if a user has already logged in to my website which Auth.php stores in a session variable along with the username. However, as soon as you go to my /catalog directory (osCommerce) the session gets overwritten by OSC's new session. I renamed the PHP_SESSION_NAME to PHPSESSID to try to just have OSC use the same session but it still creates a new one. Any way that I can access my website session through OSC or access the OSC session through my website would be a lifesaver. Thanks Arik. I'm having this exact same issue. I'm trying to have a member only store. So I created a session variable named $myusername and $ip, after a valid login has been typed in. I want to be able to verify that $myusername is not empty, and that the IP of the user has not changed for security purposes, but OsCommerce keeps on overwriting my session data with its own somehow. I try putting the following code into the tep_session_start() function in \includes\functions\sessions.php: $newip = $_SERVER['REMOTE_ADDR']; if (!isset($_SESSION['myusername']) || empty($_SESSION['myusername']) || $newip!=($_SESSION['ip'])) { header("location:logout.php"); } This way the user would go to logout.php if they are not logged in and storing the session variable $myusername or if their ip has changed from when they first logged in. What happens when I insert this code is that when you go to any page within oscommerce root dir, it sends the user to logout.php, even after the user has logged in and the session variable $myusername has been stored which tells me that the issue I'm having has something to do with OsCommerce overwriting or erasing the session variable somehow. Since I don't know enough about the inner workings of how sessions are stored, etc... within osCommerce, I am unable to get my member only store to work properly. When I include the above code in any other file but OsCommerce my session variables are stored properly, and everything works as expected. It is only when inserting the code into OsCommerce that it breaks. Any help in solving this issue would be greatly apreciated since I have looked everywhere on the net for a solution to no avail.
germ Posted July 11, 2009 Posted July 11, 2009 There are contributions for "Members only" stores. And before you go too far, you can't use the IP address because it might change with a page refresh. Not everyone has a static IP address. When I started doing web sites years ago I had an AOL account and wrote a program that displayed my IP address and noticed that it changed slightly with each page refresh. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.