jose.alonso Posted September 6, 2016 Share Posted September 6, 2016 (edited) Hola amigos!! Al implementar en un formulario la url del admin con token y abrirla en otro ordenador, el token cambia. Alguna solución? Gracias! Edited September 6, 2016 by jose.alonso (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted September 8, 2016 Share Posted September 8, 2016 si, te dara una advertencia. el token hay que generarlo con el login del usuario Link to comment Share on other sites More sharing options...
jose.alonso Posted September 8, 2016 Author Share Posted September 8, 2016 Y me podrías decir como se genera para añadirselo a la url? Link to comment Share on other sites More sharing options...
shacker Posted September 8, 2016 Share Posted September 8, 2016 yo uso este, deberas reemplazar por el nombre de tu modulo _PS_BASE_URL_._MODULE_DIR_.'prestaprotect/prestaprotect-cron.php?token='.Tools::substr( Tools::encrypt('prestaprotect/cron') y luego un archivo externo que genera el token llamado prestaprotect-cron.php include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); /* Check to security tocken */ if (Tools::substr(Tools::encrypt('prestaprotect/cron'), 0, 10) != Tools::getValue('token') || !Module::isInstalled('prestaprotect') ) { die('Bad token'); } include(dirname(__FILE__).'/prestaprotect.php'); $prestaprotect = new PrestaProtect(); /* Check if the module is enabled */ if ($prestaprotect->active) { /* Check if the requested shop exists */ if (_PS_VERSION_ > '1.5.0.0') { $shops = Db::getInstance() ->ExecuteS('SELECT id_shop FROM `'._DB_PREFIX_.'shop`'); $list_id_shop = array(); foreach ($shops as $shop) { $list_id_shop[] = (int)$shop['id_shop']; } $id_shop = (Tools::getIsset(Tools::getValue('id_shop')) && in_array( Tools::getValue('id_shop'), $list_id_shop )) ? (int)Tools::getValue('id_shop') : (int)Configuration::get('PS_SHOP_DEFAULT'); $prestaprotect->cron = true; /* for the main run initiat the sitemap's files name stored in the database */ if (!Tools::getIsset(Tools::getValue('continue'))) { $prestaprotect->cron((int)$id_shop); } } else { if (!Tools::getIsset(Tools::getValue('continue'))) { $prestaprotect->cron(); } } } 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