cirrus3d Posted November 16, 2012 Share Posted November 16, 2012 Hi all, I am currently writing an external PHP application to create products using the webservice. By external I mean this is a normal HTML/PHP page, the user fills in the product data, and then the product is created when he presses submit. How do I check if the user is logged in or not? Can I do this using the webservice? Do I need to keep a separate user database on my system? Thanks Link to comment Share on other sites More sharing options...
CartExpert.net Posted November 16, 2012 Share Posted November 16, 2012 Hi. The logged in status is stored with cookies, so you can't check from another domain if a user is logged in or not. Regards. Robin. The CartExpert Team Link to comment Share on other sites More sharing options...
cirrus3d Posted November 19, 2012 Author Share Posted November 19, 2012 Thanks for the reply. My external html/page will be on the same domain. How do I check from there? Link to comment Share on other sites More sharing options...
CartExpert.net Posted November 19, 2012 Share Posted November 19, 2012 Hi. You need to include the config.inc.php file and check with PHP if user is logged in. Regards. Robin. The CartExpert Team 1 Link to comment Share on other sites More sharing options...
cirrus3d Posted November 20, 2012 Author Share Posted November 20, 2012 (edited) Thanks for the reply. To help others, bootstrapping prestashop into your php file is easy. On top of your page you can include: include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/init.php'); global $cookie; if your php file is on the site root. Then, to see if a user is logged in or not you can do a: echo $cookie->logged; and it will return true if the user is logged in, or nothing if he is not. Edited November 20, 2012 by cirrus3d (see edit history) 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now