Jump to content

Webservice and check if user is logged in


cirrus3d

Recommended Posts

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

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 by cirrus3d (see edit history)
  • Like 3
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...