php - X-Cart Login Session -
i'm using x-cart , have employees (each has x-cart administration account). develop custom php webpages (not x-cart modules) require employees login before can access webpages. want employees use existing x-cart accounts login.
for example, whenever employees access custom webpages, if they're logged in x-cart, should fine. if not, should redirected x-cart's admin login page.
my question is: how can php scripts check if users logged in x-cart? tried include auth.php got error message "can not initiate application! please check configuration."
thanks lot!
creating secure admin pages pretty simple:
- create new page in root/admin/my_new_app.php
start code with:
/* new app secure */ require './auth.php'; require $xcart_dir.'/include/security.php'; /* put app code in here... */ /* may (and should) end assigning main template as: $my_main = 'my_new_app'; $location[] = array('new app!', '/admin/my_new_app.php'); /* need go , edit your_skin/single/home.tpl , add this: {elseif $main eq "my_new_app"} {include file="admin/my_new_app.tpl"} , need create template file: admin/my_new_app.tpl */
and that's it. if not admin, redirected login page (administration area).
there 1 important note here: can not use post variables in app without real form on page. have create form, xcart create hidden input field _formid
(and have hashed value, such as: 20b8e92504d1908bb1e3a264b9169f1e
). once have it, can use ajax , post variables, each time including _formid
, value.
the reason telling strange message get: can not initiate application! please check configuration
. not come x-cart, guess is: app tries post, gets no response (missing _formid
).
Comments
Post a Comment