Jump to content

Problème accès back office: page de connexion se recharge avec dans l'adresse redirect=index.php


Recommended Posts

Bonjour,

 

je suis sur Prestashop 1.4.1, chez OVH en pro.

 

Depuis plusieurs jours, à chaque fois que j'essaye de me connecter au BO, j'ai donc la page de login qui se recharge avec redirect=index.php à la fin de l'adresse. Il faut au moins trois essais pour parvenir sur la page d'accueil du BO, puis quand j'essaye d'ajouter un produit ou n'importe quelle autre action (aller dans les modules ou dans les préférences par exemple), au bout de deux ou trois clics, j'ai de nouveau la page de connexion qui s'affiche avec "redirect...". J'arrive de nouveau à me connecter, puis au clic suivant, la page de connexion s'affiche de nouveau avec en arrière-plan le back office affiché bizarrement, comme sur un écran de téléphone. Je clique donc encore une fois pour me connecter, la page de login s'affiche cette fois normalement mais avec dans l'adresse "redirect=ajax.php". Je dois cliquer encore deux fois pour arriver à me connecter, et quand c'est fait, j'ai une page blanche qui s'affiche avec l'adresse qui se termine par /ajax.php.

 

Quand je vide le cache et les cookies du navigateur, le back office marche de nouveau normalement pendant très peu de temps - par exemple, il me laisse tranquille assez longtemps pour ajouter un produit - puis le bug recommence.

 

Plusieurs fois lorsque j'arrivais enfin au back office après la connexion où l'adresse s'affiche avec /ajax.php, j'ai eu des boites de dialogues qui s'ouvraient avec "la page www.elinorabijoux.com indique: supplier error: parsererror" puis "manager error: parsererror".

 

Mon navigateur habituel est Google Chrome, j'ai aussi essayé sur Mozilla et c'est la même chose.

 

En revanche, la boutique en front office semble marcher normalement.

 

Je ne sais pas dans quelle mesure cela peut avoir une influence, mais récemment j'ai changé l'adresse du site (ça n'a pas posé problème donc je pense que cela n'a rien à voir) et je viens d'acheter un certificat ssl (mais je n'ai pas activé l'option dans Prestashop, étant donné qu'OVH dictait de ne rien faire).

 

Je ne sais plus quoi faire, en plus je suis une néophyte en Prestashop donc je n'ai pas la moindre idée d'où peut provenir ce problème.

 

Merci pour votre aide!

Link to comment
Share on other sites

Bonjour,

Tu prends le fichier ajax.php dans l'archive de ton prestashop (que tu as du télécharger avant d'installer sur le serveur)

Puis tu transferes ce fichier sur ton serveur à l'endroit ou il doit aller pour remplacer l'actuel.

 

Tu es en quel version?

Link to comment
Share on other sites

Bonjour à tous,

 

je suis en 1.5.6.1 et j'ai le même problème.

L'origine de mon problème est différent : j'ai fait la grosse bêtise faire une mise a jour auto en 1.5.6.2 et mon theme ne fonctionnait pas ; donc je suis revenu à ma version qui tournait nickel ce matin ; et là tout a fonctionné pendant le downgrade et voilà que maintenant j''ai une page connexion qui me raméne en boucle à la page login.php?redirect=index.php.

Quand je lance la récupération du mot de passe admin, ça fonctionne et quand j'essaie de me connecter avec c'est la même page de connexion qui revient sans aucun message d'erreur.

 

je suis bloqué : help les amis. ma boutique est bloquée en mode maintenance. génies qui passe par là, soyez magnanime .

 

merci à tous et vive ce forum ou j'ai trouvé déjà 1001 réponses à 1002 problèmes pour l'instant

Link to comment
Share on other sites

@Elinora:

Quand tu arrives à te connecter sur ton BO après plusieurs tentatives, si tu vas dans préférences>SEO & URLS,

tout en bas dans "Configuration des URL" est ce que tu as bien la bonne URL étant donné que tu as changé de nom de domaine.

Edited by zaar (see edit history)
Link to comment
Share on other sites

Alors c'est encore plus bizarre... Je suis sur Chrome et là je viens d'essayer sur Firefox et c'est toujours la même chose (c'est même pire sur chrome).

 

Après avoir vu ton deuxième message j'ai réessayé, c'est toujours pareil

Link to comment
Share on other sites

Excusez moi de me mêler de ça mais dans mon cas j'ai essayé depuis un autre Pc et j'ai toujours la même page de connexion qui revient en boucle et me redemande de m'identifier

 

Je vais donc tenter une solution qui me fait peur : réupliader tout le contenu de prestashop, j'espère que je ne perdrais pas ma boutique

 

Je vous tiens informé

 

A+

Link to comment
Share on other sites

oui elinora c'est moi qui ai touché à ça,

 

désolé j'étais o boulot je viens de rentrer à la maison :)

 

Pourtant comme je te le disais, j'utilise firefox et je n'ai aucun probleme a me connecter ou même naviguer dans tous les onglet de ton back office.

 

@booccsn fait d'abord une sauvegarde de ta boutique et de ta base sql pour ne pas à avoir à tout refaire !!!

Edited by zaar (see edit history)
Link to comment
Share on other sites

Le problème est toujours le même chez moi. J'ai désinstallé et réinstallé Chrome, donc je ne crois pas que ça vienne de là. 

 

En fait il semble qu'il y ait deux problèmes distincts: 

 

- une erreur de redirection sur la page de login

- une erreur ajax supplier/ manager parsererror.

 

Encore une fois, la boutique en front office marche comme il faut, cela semble vraiment provenir du back office. Une redirection mal refaite? et il me semble que le problème est apparu peu de temps après avoir acheté et fait activer au niveau d'OVH le certificat ssl.

 

Si quelqu'un a la solution....

 

Merci encore pour ton aide Zaar. 

Link to comment
Share on other sites

Salut elinora,

 

Aujourd'hui j'ai encore essayé de visiter ton back office et j'ai même ajouté un nouveau produit (que j'ai supprimer bien sûr) sans aucun je dis bien aucun souci rencontré.

 

Pour infos de suis sous mozilla firefox pour windows.

 

Je ne comprends pas pourquoi de ton côté tu n'y arrive pas?

 

Je viens de désactiver "Rediriger automatiquement vers l'url canonique"  tu peux réésayer pour voir?

Link to comment
Share on other sites

J'ai réussi à ajouter un produit avant que ça ne recommence à bugger, au moment où je retournais dans la catégorie Accueil

 

+ Le front office ne s'affiche pas correctement et avec le cadenas à triangle jaune dans l'adresse. Peux-tu rétablir tel que c'était? merci.

Link to comment
Share on other sites

Chez moi le problème continue.
Ça vient soit de admin/login.php soit de admin/ajax.php
 
Voici les deux fichiers, si on peut me dire si quelque chose cloche.
 
Ajax
 
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
 
define('_PS_ADMIN_DIR_', getcwd());
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
 
include(PS_ADMIN_DIR.'/../config/config.inc.php');
/* Getting cookie or logout */
require_once(dirname(__FILE__).'/init.php');
 
if (isset($_GET['changeParentUrl']))
echo '<script type="text/javascript">parent.parent.document.location.href = "'.addslashes(urldecode(Tools::getValue('changeParentUrl'))).'";</script>';
if (isset($_GET['installBoughtModule']))
{
$file = false;
while ($file === false OR file_exists(_PS_MODULE_DIR_.$file))
$file = uniqid();
$file = _PS_MODULE_DIR_.$file.'.zip';
if (!copy($sourceFile, $file))
{
if (!($content = file_get_contents($sourceFile)))
die(displayJavascriptAlert('Access denied: Please download your module directly from PrestaShop Addons website'));
elseif (!file_put_contents($file, $content))
die(displayJavascriptAlert('Local error: your module directory is not writable'));
}
$first6 = fread($fd = fopen($file, 'r'), 6);
if (!strncmp($first6, 'Error:', 6))
{
$displayJavascriptAlert = displayJavascriptAlert(fread($fd, 1024));
fclose($fd);
unlink($file);
die($displayJavascriptAlert);
}
fclose($fd);
if (!Tools::ZipExtract($file, _PS_MODULE_DIR_))
{
unlink($file);
die(displayJavascriptAlert('Cannot unzip file'));
}
unlink($file);
die(displayJavascriptAlert('Module copied to disk'));
}
 
function displayJavascriptAlert($s){echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';}
 
if (isset($_GET['ajaxProductManufacturers']))
{
$currentIndex = 'index.php?tab=AdminCatalog';
$manufacturers = Manufacturer::getManufacturers();
if ($manufacturers)
{
$jsonArray = array();
foreach ($manufacturers as $manufacturer)
$jsonArray[] = '{"optionValue": "'.$manufacturer['id_manufacturer'].'", "optionDisplay": "'.htmlspecialchars(trim($manufacturer['name'])).'"}';
die('['.implode(',', $jsonArray).']');
}
}
if (isset($_GET['ajaxReferrers']))
{
require('tabs/AdminReferrers.php');
}
 
if (isset($_GET['ajaxProductSuppliers']))
{
$currentIndex = 'index.php?tab=AdminCatalog';
$suppliers = Supplier::getSuppliers();
if ($suppliers)
{
$jsonArray = array();
foreach ($suppliers as $supplier)
$jsonArray[] = '{"optionValue": "'.$supplier['id_supplier'].'", "optionDisplay": "'.htmlspecialchars(trim($supplier['name'])).'"}';
die('['.implode(',', $jsonArray).']');
}
}
 
if (isset($_GET['ajaxProductAccessories']))
{
$currentIndex = 'index.php?tab=AdminCatalog';
$jsonArray = array();
 
$products = Db::getInstance()->ExecuteS('
SELECT p.`id_product`, pl.`name`
FROM `'._DB_PREFIX_.'product` p
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
AND p.`id_product` != '.(int)(Tools::getValue('id_product')).'
AND p.`id_product` NOT IN (
SELECT a.`id_product_2`
FROM `'._DB_PREFIX_.'accessory` a
WHERE a.`id_product_1` = '.(int)(Tools::getValue('id_product')).')
ORDER BY pl.`name`');
 
foreach ($products as $accessory)
$jsonArray[] = '{"value: "'.(int)($accessory['id_product']).'-'.addslashes($accessory['name']).'", "text":"'.(int)($accessory['id_product']).' - '.addslashes($accessory['name']).'"}';
die('['.implode(',', $jsonArray).']');
}
 
if (isset($_GET['ajaxDiscountCustomers']))
{
global $cookie;
 
$currentIndex = 'index.php?tab=AdminDiscounts';
$jsonArray = array();
$filter = Tools::getValue('filter');
 
if (Validate::isBool_Id($filter))
$filterArray = explode('_', $filter);
 
if (is_numeric($filter) AND Validate::isUnsignedId($filter))
$customers = Db::getInstance()->ExecuteS('
SELECT `id_customer`, `email`, CONCAT(`lastname`, \' \', `firstname`) as name
FROM `'._DB_PREFIX_.'customer`
WHERE id_customer = '.intval($filter).'
LIMIT 1');
else
$customers = Db::getInstance()->ExecuteS('
SELECT `id_customer`, `email`, CONCAT(`lastname`, \' \', `firstname`) as name
FROM `'._DB_PREFIX_.'customer`
WHERE email LIKE "%'.pSQL($filter).'%"
OR CONCAT(`firstname`, \' \', `lastname`) LIKE "%'.pSQL($filter).'%"
OR CONCAT(`lastname`, \' \', `firstname`) LIKE "%'.pSQL($filter).'%"
ORDER BY CONCAT(`lastname`, \' \', `firstname`) ASC
LIMIT 50');
 
$groups = Db::getInstance()->ExecuteS('
SELECT g.`id_group`, gl.`name`
FROM `'._DB_PREFIX_.'group` g
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($cookie->id_lang).')
WHERE '.(Validate::isUnsignedInt($filter) ? 'g.`id_group` = '.(int)($filter) : 'gl.`name` LIKE "%'.pSQL($filter).'%"
'.((Validate::isBool_Id($filter) AND $filterArray[0] == 1) ? 'OR g.`id_group` = '.(int)($filterArray[1]) : '')).'
ORDER BY gl.`name` ASC
LIMIT 50');
 
$json = '{"customers" : ';
foreach ($customers as $customer)
$jsonArray[] = '{"value":"0_'.(int)($customer['id_customer']).'", "text":"'.addcslashes($customer['name'], '"\\/').' ('.addcslashes($customer['email'], '"\\/').')"}';
$json .= '['.implode(',', $jsonArray).'],
"groups" : ';
$jsonArray = array();
foreach ($groups as $group)
$jsonArray[] = '{"value":"1_'.(int)($group['id_group']).'", "text":"'.addcslashes($group['name'], '"\\/').'"}';
$json .= '['.implode(',', $jsonArray).']}';
die($json);
}
 
if (Tools::getValue('page') == 'prestastore' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
readfile('http://addons.prestashop.com/adminmodules.php?lang='.Language::getIsoById($cookie->id_lang));
if (Tools::getValue('page') == 'themes'  AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
readfile('http://addons.prestashop.com/adminthemes.php?lang='.Language::getIsoById($cookie->id_lang));
 
if ($step = (int)(Tools::getValue('ajaxProductTab')))
{
require_once(dirname(__FILE__).'/tabs/AdminCatalog.php');
$catalog = new AdminCatalog();
$admin = new AdminProducts();
 
$languages = Language::getLanguages(false);
$defaultLanguage = (int)(_PS_LANG_DEFAULT_);
$product = new Product((int)(Tools::getValue('id_product')));
if (!Validate::isLoadedObject($product))
die (Tools::displayError('Product cannot be loaded'));
 
$switchArray = array(3 => 'displayFormPrices', 4 => 'displayFormAttributes', 5 => 'displayFormFeatures', 6 => 'displayFormCustomization', 7 => 'displayFormAttachments');
$currentIndex = 'index.php?tab=AdminCatalog';
if (key_exists($step, $switchArray))
$admin->{$switchArray[$step]}($product, $languages, $defaultLanguage);
}
 
if (isset($_GET['getAvailableFields']) and isset($_GET['entity']))
{
$currentIndex = 'index.php?tab=AdminImport';
$jsonArray = array();
require_once(dirname(__FILE__).'/tabs/AdminImport.php');
$import = new AdminImport();
 
$languages = Language::getLanguages(false);
$defaultLanguage = (int)(_PS_LANG_DEFAULT_);
$fields = $import->getAvailableFields(true);
foreach ($fields as $field)
$jsonArray[] = '{"field":"'.addslashes($field).'"}';
die('['.implode(',', $jsonArray).']');
}
 
if (array_key_exists('ajaxModulesPositions', $_POST))
{
$id_module = (int)(Tools::getValue('id_module'));
$id_hook = (int)(Tools::getValue('id_hook'));
$way = (int)(Tools::getValue('way'));
$positions = Tools::getValue(strval($id_hook));
$position = (is_array($positions)) ? array_search($id_hook.'_'.$id_module, $positions) : null;
$module = Module::getInstanceById($id_module);
if (Validate::isLoadedObject($module))
if ($module->updatePosition($id_hook, $way, $position))
die(true);
else
die('{"hasError" : true, "errors" : "Can not update module position"}');
else
die('{"hasError" : true, "errors" : "This module can not be loaded"}');
}
 
if (array_key_exists('ajaxCategoriesPositions', $_POST))
{
$id_category_to_move = (int)(Tools::getValue('id_category_to_move'));
$id_category_parent = (int)(Tools::getValue('id_category_parent'));
$way = (int)(Tools::getValue('way'));
$positions = Tools::getValue('category');
if (is_array($positions))
foreach ($positions as $key => $value)
{
$pos = explode('_', $value);
if ((isset($pos[1]) AND isset($pos[2])) AND ($pos[1] == $id_category_parent AND $pos[2] == $id_category_to_move))
{
$position = $key;
break;
}
}
$category = new Category((int)$id_category_to_move);
if (Validate::isLoadedObject($category))
{
if (isset($position) && $category->updatePosition($way, $position))
{
Category::regenerateEntireNtree();
Module::hookExec('categoryUpdate', array('category' => $category));
die(true);
}
else
die('{"hasError" : true, errors : "Can not update categories position"}');
}
else
die('{"hasError" : true, "errors" : "This category can not be loaded"}');
}
 
if (array_key_exists('ajaxCMSCategoriesPositions', $_POST))
{
$id_cms_category_to_move = (int)(Tools::getValue('id_cms_category_to_move'));
$id_cms_category_parent = (int)(Tools::getValue('id_cms_category_parent'));
$way = (int)(Tools::getValue('way'));
$positions = Tools::getValue('cms_category');
if (is_array($positions))
foreach ($positions as $key => $value)
{
$pos = explode('_', $value);
if ((isset($pos[1]) AND isset($pos[2])) AND ($pos[1] == $id_cms_category_parent AND $pos[2] == $id_cms_category_to_move))
{
$position = $key;
break;
}
}
$cms_category = new CMSCategory($id_cms_category_to_move);
if (Validate::isLoadedObject($cms_category))
{
if (isset($position) && $cms_category->updatePosition($way, $position))
die(true);
else
die('{"hasError" : true, "errors" : "Can not update cms categories position"}');
}
else
die('{"hasError" : true, "errors" : "This cms category can not be loaded"}');
}
 
if (array_key_exists('ajaxCMSPositions', $_POST))
{
$id_cms = (int)(Tools::getValue('id_cms'));
$id_category = (int)(Tools::getValue('id_cms_category'));
$way = (int)(Tools::getValue('way'));
$positions = Tools::getValue('cms');
if (is_array($positions))
foreach ($positions as $key => $value)
{
$pos = explode('_', $value);
if ((isset($pos[1]) AND isset($pos[2])) AND ($pos[1] == $id_category AND $pos[2] == $id_cms))
{
$position = $key;
break;
}
}
$cms = new CMS($id_cms);
if (Validate::isLoadedObject($cms))
{
if (isset($position) && $cms->updatePosition($way, $position))
die(true);
else
die('{"hasError" : true, "errors" : "Can not update cms position"}');
}
else
die('{"hasError" : true, "errors" : "This cms can not be loaded"}');
}
 
/* Modify product position in catalog */
if (array_key_exists('ajaxProductsPositions', $_POST))
{
$way = (int)(Tools::getValue('way'));
$id_product = (int)(Tools::getValue('id_product'));
$id_category = (int)(Tools::getValue('id_category'));
$positions = Tools::getValue('product');
 
if (is_array($positions))
foreach ($positions as $position => $value)
{
// pos[1] = id_categ, pos[2] = id_product, pos[3]=old position
$pos = explode('_', $value);
 
if ((isset($pos[1]) AND isset($pos[2])) AND ($pos[1] == $id_category AND (int)$pos[2] === $id_product))
{
if ($product = new Product((int)$pos[2]))
if (isset($position) && $product->updatePosition($way, $position))
{
$category = new Category((int)$id_category);
if (Validate::isLoadedObject($category))
Module::hookExec('categoryUpdate', array('category' => $category));
echo "ok position ".(int)$position." for product ".(int)$pos[2]."\r\n";
}
else
echo '{"hasError" : true, "errors" : "Can not update product '. $id_product . ' to position '.(int)$position.' "}';
else
echo '{"hasError" : true, "errors" : "This product ('.$id_product.') can t be loaded"}';
 
break;
}
}
}
 
if (isset($_GET['ajaxProductPackItems']))
{
$jsonArray = array();
$products = Db::getInstance()->ExecuteS('
SELECT p.`id_product`, pl.`name`
FROM `'._DB_PREFIX_.'product` p
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
AND p.`id_product` NOT IN (SELECT DISTINCT id_product_pack FROM `'._DB_PREFIX_.'pack`)
AND p.`id_product` != '.(int)(Tools::getValue('id_product')));
 
foreach ($products as $packItem)
$jsonArray[] = '{"value": "'.(int)($packItem['id_product']).'-'.addslashes($packItem['name']).'", "text":"'.(int)($packItem['id_product']).' - '.addslashes($packItem['name']).'"}';
die('['.implode(',', $jsonArray).']');
}
 
if (isset($_GET['ajaxStates']) AND isset($_GET['id_country']))
{
$states = Db::getInstance()->ExecuteS('
SELECT s.id_state, s.name
FROM '._DB_PREFIX_.'state s
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
ORDER BY s.`name` ASC');
 
if (is_array($states) AND !empty($states))
{
$list = '';
if (Tools::getValue('no_empty') != true)
$list = '<option value="0">-----------</option>'."\n";
 
foreach ($states as $state)
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
}
else
$list = 'false';
 
die($list);
}
 
if (Tools::isSubmit('submitCustomerNote') AND $id_customer = (int)Tools::getValue('id_customer'))
{
$note = html_entity_decode(Tools::getValue('note'));
if (!empty($note) AND !Validate::isCleanHtml($note))
die ('error:validation');
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `note` = "'.pSQL($note, true).'" WHERE id_customer = '.(int)$id_customer.' LIMIT 1'))
die ('error:update');
die('ok');
}
 
if (Tools::getValue('form_language_id'))
{
if (!($cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
die ('Error while updating cookie.');
die ('Form language updated.');
}
 
if (Tools::getValue('submitPublishProduct'))
{
global $cookie;
 
if (Tools::getIsset('id_product'))
{
$id_product = (int)(Tools::getValue('id_product'));
$id_tab_catalog = (int)(Tab::getIdFromClassName('AdminCatalog'));
$token = Tools::getAdminToken('AdminCatalog'.(int)($id_tab_catalog).(int)($cookie->id_employee));
$bo_product_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.$token;
 
if (Tools::getValue('redirect'))
die($bo_product_url);
 
$profileAccess = Profile::getProfileAccess((int)$cookie->profile, $id_tab_catalog);
if ($profileAccess['edit'])
{
$product = new Product((int)(Tools::getValue('id_product')));
if (!Validate::isLoadedObject($product))
die('error: invalid id');
 
$product->active = 1;
 
if ($product->save())
die($bo_product_url);
else
die('error: saving');
 
} else {
die('error: permissions');
}
}
else
die ('error: parameters');
}
 
if (Tools::getValue('submitPublishCMS'))
{
global $cookie;
 
if (Tools::getIsset('id_cms'))
{
$id_cms = (int)(Tools::getValue('id_cms'));
$id_tab_cms = (int)(Tab::getIdFromClassName('AdminCMSContent'));
$token = Tools::getAdminToken('AdminCMSContent'.(int)($id_tab_cms).(int)($cookie->id_employee));
$bo_cms_url = dirname($_SERVER['PHP_SELF']).'/index.php?tab=AdminCMSContent&id_cms='.(int)$id_cms.'&updatecms&token='.$token;
 
if (Tools::getValue('redirect'))
die($bo_cms_url);
 
$profileAccess = Profile::getProfileAccess((int)$cookie->profile, $id_tab_cms);
if ($profileAccess['edit'])
{
$cms = new CMS((int)(Tools::getValue('id_cms')));
if (!Validate::isLoadedObject($cms))
die('error: invalid id');
 
$cms->active = 1;
 
if ($cms->save())
die($bo_cms_url);
else
die('error: saving');
 
} else {
die('error: permissions');
}
}
else
die ('error: parameters');
}
 
if (Tools::isSubmit('submitTrackClickOnHelp'))
{
$label = Tools::getValue('label');
$version = Tools::getValue('version');
 
if (!empty($label) && !empty($version))
HelpAccess::trackClick($label, $version);
}
 
if (Tools::isSubmit('saveImportMatchs'))
{
$match = implode('|', Tools::getValue('type_value'));
Db::getInstance()->Execute('INSERT INTO  `'._DB_PREFIX_.'import_match` (`id_import_match`, `name`, `match`, `skip`) VALUES (NULL,
\''.pSQL(Tools::getValue('newImportMatchs')).'\', \''.pSQL($match).'\', \''.pSQL(Tools::getValue('skip')).'\')');
 
die('{"id" : "'.Db::getInstance()->Insert_ID().'"}');
}
 
if (Tools::isSubmit('deleteImportMatchs'))
   Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
 
if (Tools::isSubmit('loadImportMatchs'))
{
   $return = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'import_match` WHERE `id_import_match` = '.(int)Tools::getValue('idImportMatchs'));
   die('{"id" : "'.$return[0]['id_import_match'].'", "matchs" : "'.$return[0]['match'].'", "skip" : "'.$return[0]['skip'].'"}');
}
 
if (Tools::isSubmit('toggleScreencast'))
{
global $cookie;
 
$employee = new Employee($cookie->id_employee);
if (Validate::isLoadedObject($employee))
{
$employee->bo_show_screencast = !$employee->bo_show_screencast;
$employee->update();
}
}
 
if (Tools::isSubmit('ajaxAddZipCode') OR Tools::isSubmit('ajaxRemoveZipCode'))
{
require_once(PS_ADMIN_DIR.'/tabs/AdminCounty.php');
 
$zipcodes = Tools::getValue('zipcodes');
$id_county = (int)Tools::getValue('id_county');
$id_state = (int)Tools::getValue('id_state');
 
if (!$county = new County($id_county) OR !Validate::isLoadedObject($county))
die('error : This county is invalid.');
list($from, $to) = $county->breakDownZipCode($zipcodes);
 
if (Tools::isSubmit('ajaxAddZipCode'))
{
if (!$state = new State($id_state) OR !Validate::isLoadedObject($state))
die(Tools::displayError('error: This requires a state selection.'));
if (!$country = new Country((int)$state->id_country) OR !Validate::isLoadedObject($country))
die('error: This requires a country selection.');
$zip_code_format = $country->zip_code_format;
if ($zip_code_format)
{
if ((empty($from) || $from === $to)  && !$country->checkZipCode($zipcodes))
die('error: <strong>'.Tools::displayError('Zip/ Postal code').'</strong> '.Tools::displayError('is invalid.').'<br />'.str_replace(':', '', Tools::displayError('Must be typed as follows:')).' '.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format))));
elseif ($from !== $to && (!$country->checkZipCode($from) || !$country->checkZipCode($to)))
die('error: <strong>'.Tools::displayError('Zip/ Postal code').'</strong> '.Tools::displayError('is invalid.').'<br />'.str_replace(':', '', Tools::displayError('Must be typed as follows:')).' '.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format))));
if ($county->isZipCodeRangePresent($from, $to))
die('error: '.Tools::displayError('This Zip Code is already in use.'));
if ($county->addZipCodes($from, $to))
die(AdminCounty::renderZipCodeList($county->getZipCodes()));
}
}
elseif (Tools::isSubmit('ajaxRemoveZipCode') AND $county->removeZipCodes($from, $to))
die(AdminCounty::renderZipCodeList($county->getZipCodes()));
}
 
if (Tools::isSubmit('helpAccess'))
{
$item = Tools::getValue('item');
$isoUser = Tools::getValue('isoUser');
$country = Tools::getValue('country');
$version = Tools::getValue('version');
 
if (isset($item) && isset($isoUser) && isset($country))
die(HelpAccess::displayHelp($item, $isoUser,  $country, $version));
die();
}
 
if (Tools::isSubmit('getHookableList'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
/* PrestaShop demo mode*/
 
if (!strlen(Tools::getValue('hooks_list')))
die('{"hasError" : true, "errors" : ["Live Edit : no module on this page"]}');
 
$modules_list = explode(',', Tools::getValue('modules_list'));
$hooks_list = explode(',', Tools::getValue('hooks_list'));
$hookableList = array();
 
foreach ($modules_list as $module)
{
$moduleInstance = Module::getInstanceByName($module);
foreach($hooks_list as $hook_name)
{
if (!array_key_exists($hook_name, $hookableList))
$hookableList[$hook_name] = array();
if ($moduleInstance->isHookableOn($hook_name))
array_push($hookableList[$hook_name], $module);
}
 
}
$hookableList['hasError'] = false;
die(Tools::jsonEncode($hookableList));
}
 
if (Tools::isSubmit('getHookableModuleList'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
/* PrestaShop demo mode*/
 
include('../init.php');
$hook_name = Tools::getValue('hook');
$hookableModulesList = array();
$modules = Db::getInstance()->ExecuteS('SELECT id_module, name FROM `'._DB_PREFIX_.'module` ');
foreach ($modules as $module)
{
if (file_exists(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php'))
{
include_once(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php');
$mod = new $module['name']();
if ($mod->isHookableOn($hook_name))
$hookableModulesList[] = array('id' => (int)$mod->id, 'name' => $mod->displayName, 'display' => Module::hookExec($hook_name, array(), (int)$mod->id));
}
}
die(Tools::jsonEncode($hookableModulesList));
}
 
if (Tools::isSubmit('saveHook'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
die('{"hasError" : true, "errors" : ["Live Edit : This functionnality has been disabled"]}');
/* PrestaShop demo mode*/
 
$hooks_list = explode(',', Tools::getValue('hooks_list'));
foreach ($hooks_list as $hook)
{
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'hook_module` WHERE `id_hook` = (SELECT id_hook FROM `'._DB_PREFIX_.'hook` WHERE `name` = \''.pSQL($hook).'\' LIMIT 0, 1)');
$hookedModules = explode(',', Tools::getValue($hook));
$i = 1;
$value = '';
$ids = array();
foreach($hookedModules as $module)
{
$id = explode('_', $module);
if (!in_array($id[1], $ids))
{
$ids[] = $id[1];
$value .= '('.(int)$id[1].', (SELECT id_hook FROM `'._DB_PREFIX_.'hook` WHERE `name` = \''.pSQL($hook).'\' LIMIT 0, 1), '.(int)$i.'),';
}
$i ++;
}
$value = rtrim($value, ',');
Db::getInstance()->Execute('INSERT INTO  `'._DB_PREFIX_.'hook_module` (`id_module`, `id_hook`, `position`) VALUES '.$value);
 
}
die('{"hasError" : false, "errors" : ""}');
}
 
if (Tools::isSubmit('getAdminHomeElement'))
{
$result = array();
 
$protocol = Tools::usingSecureMode() ? 'https' : 'http';
$isoUser = Language::getIsoById(intval($cookie->id_lang));
$isoCountry = Country::getIsoById(_PS_COUNTRY_DEFAULT_);
$stream_context = @stream_context_create(array('http' => array('method'=> 'GET', 'timeout' => 5)));
 
// SCREENCAST
if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3))
$result['screencast'] = 'OK';
else
$result['screencast'] = 'NOK';
 
// PREACTIVATION
if (!$content)
$result['partner_preactivation'] = 'NOK';
else
{
$content = explode('|', $content);
if ($content[0] == 'OK' && Validate::isCleanHtml($content[2]) && Validate::isCleanHtml($content[1]))
{
$result['partner_preactivation'] = $content[2];
$content[1] = explode('#%#', $content[1]);
foreach ($content[1] as $partnerPopUp)
if ($partnerPopUp)
{
$partnerPopUp = explode('%%', $partnerPopUp);
if (!Configuration::get('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0])))
{
$result['partner_preactivation'] .= $partnerPopUp[1];
Configuration::updateValue('PS_PREACTIVATION_'.strtoupper($partnerPopUp[0]), 'TRUE');
}
}
}
else
$result['partner_preactivation'] = 'NOK';
}
 
// PREACTIVATION PAYPAL WARNING
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(_PS_COUNTRY_DEFAULT_)).'&iso_lang='.Tools::strtolower(Language::getIsoById(intval($cookie->id_lang))).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context);
$content = explode('|', $content);
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', $content[1]);
else
Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', '');
 
// DISCOVER PRESTASHOP
if (!$content)
$result['discover_prestashop'] = 'NOK';
else
{
$content = explode('|', $content);
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
$result['discover_prestashop'] = $content[1];
else
$result['discover_prestashop'] = 'NOK';
 
if (@fsockopen('www.prestashop.com', 80, $errno, $errst, 3))
 
$content = explode('|', $content);
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
$result['discover_prestashop'] .= $content[1];
}
 
die(Tools::jsonEncode($result));
}
 
if (Tools::isSubmit('getChildrenCategories') && Tools::getValue('id_category_parent'))
{
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), $cookie->id_lang);
die(Tools::jsonEncode($children_categories));
}
  1.  

 

 

Login

 

<?php

/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
 
ob_start();
define('_PS_ADMIN_DIR_', getcwd());
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
 
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(PS_ADMIN_DIR.'/functions.php');
 
$clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'), explode(',', Configuration::get('PS_MAINTENANCE_IP'))));
 
$errors = array();
 
if ((empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off')
AND _PS_SSL_ENABLED_)
{
// You can uncomment theses lines if you want to force https even from localhost and automatically redirect
// header('HTTP/1.1 301 Moved Permanently');
// header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
// exit();
 
// If ssl is enabled, https protocol is required. Exception for maintenance and local (127.0.0.1) IP
if ($clientIsMaintenanceOrLocal)
$errors[] = translate('SSL is activated. However, your IP is allowed to use unsecure mode (Maintenance or local IP).').'<br/>';
else
$warningSslMessage = translate('SSL is activated. Please connect using the following url to log in in secure mode (https).')
}
 
$cookie = new Cookie('psAdmin', substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__), -10));
if (!isset($cookie->id_lang))
$cookie->id_lang = _PS_LANG_DEFAULT_;
$iso = strtolower(Language::getIsoById((int)($cookie->id_lang)));
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
 
/* Cookie creation and redirection */
if (Tools::isSubmit('Submit'))
{
  /* Check fields validity */
$passwd = trim(Tools::getValue('passwd'));
$email = trim(Tools::getValue('email'));
if (empty($email))
$errors[] = Tools::displayError('E-mail is empty');
elseif (!Validate::isEmail($email))
$errors[] = Tools::displayError('Invalid e-mail address');
elseif (empty($passwd))
$errors[] = Tools::displayError('Password is blank');
elseif (!Validate::isPasswd($passwd))
$errors[] = Tools::displayError('Invalid password');
else
{
/* Seeking for employee */
$employee = new Employee();
$employee = $employee->getByemail($email, $passwd);
if (!$employee)
{
$errors[] = Tools::displayError('Employee does not exist or password is incorrect.');
$cookie->logout();
}
else
{
/* Creating cookie */
$cookie->id_employee = $employee->id;
$cookie->email = $employee->email;
$cookie->profile = $employee->id_profile;
$cookie->passwd = $employee->passwd;
$cookie->remote_addr = ip2long(Tools::getRemoteAddr());
$cookie->write();
/* Redirect to admin panel */
if (isset($_GET['redirect']))
$url = strval($_GET['redirect'].(isset($_GET['token']) ? ('&token='.$_GET['token']) : ''));
else
$url = 'index.php';
if (!Validate::isCleanHtml($url))
die(Tools::displayError());
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
<meta http-equiv="Refresh" content="0;URL='.str_replace('&', '&', Tools::safeOutput($url, true)).'">
<head>
<script language="javascript" type="text/javascript">
window.location.replace("'.str_replace('&', '&', Tools::safeOutput($url, true)).'");
</script>
<div style="text-align:center; margin-top:250px;"><a href="'.str_replace('&', '&', Tools::safeOutput($url, true)).'">'.translate('Click here to launch Administration panel').'</a></div>
</head>
</html>';
exit ;
}
}
}
 
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../css/login.css" />
<title>PrestaShop™ - '.translate('Administration panel').'</title>';
echo '
</head>
<body>
<div id="container">';
 
if ($nbErrors = count($errors))
{
echo '
<div id="error">
<h3>'.($nbErrors > 1 ? translate('There are') : translate('There is')).' '.$nbErrors.' '.($nbErrors > 1 ? translate('errors') : translate('error')).'</h3>
<ol style="margin: 0 0 0 20px;">';
foreach ($errors as $error)
echo '<li>'.$error.'</li>';
echo '
</ol>
</div>
<br />';
}
 
echo '
<div id="login">
<h1>'.Tools::htmlentitiesUTF8(Configuration::get('PS_SHOP_NAME')).'</h1>
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">';
 
if (file_exists(PS_ADMIN_DIR.'/../install') || file_exists(PS_ADMIN_DIR.'/../admin'))
{
$randomNb = rand(100, 999);
echo '<span>'.translate('For security reasons, you cannot connect to the Back Office until after you have:').'<br /><br />
- '.translate('delete the /install folder').'<br />
- '.translate('renamed the /admin folder (eg. ').'/admin'.(int)$randomNb.')<br />
<br />'.translate('Please then access this page by the new url (eg. http://www.domain.tld/admin').(int)$randomNb.')</span>';
}
else
{
// If https enabled, we force it except if you try to log in from maintenance or local ip
if ((empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') && (_PS_SSL_ENABLED_ && !$clientIsMaintenanceOrLocal))
echo '<div class="error">'.$warningSslMessage.'</div>';
else
echo '<label for="email">'.translate('E-mail address:').'</label><br />
<input type="text" id="email" name="email" value="'.Tools::safeOutput(Tools::getValue('email')).'" class="input"/>
<div style="margin: 1.8em 0 0 0;">
<label for="passwd">'.translate('Password:').'</label><br />
<input id="passwd" type="password" name="passwd" class="input" value=""/>
</div>
<div>
<div id="submit"><input type="submit" name="Submit" value="'.translate('Log in').'" class="button" /></div>
<div id="lost"><a href="password.php">'.translate('Lost password?').'</a></div>
</div>';
}
?>
<script type="text/javascript">
//<![CDATA[
if (document.getElementById('email')) document.getElementById('email').focus();
//]]>
</script>
</form>
</div>
<h2><a href="http://www.prestashop.com">Copyright © 2013 PrestaShop. all rights reserved.</a></h2>
</div>
</body>
</html>
Link to comment
Share on other sites

Je viens de remplacer les deux fichiers et mon back office est maintenant inaccessible. Je sens que je deviens dingue! et évidemment j'ai oublié de télécharger les deux fichiers sur mon ordinateur au cas où. 

 

L'erreur indiquée lors de la tentative d'accès au back office est 

 

 

"La page Web à l'adressehttp://www.elinorabijoux.com//prestashop/adminelinorac/login.php?redirect=index.php?controller=AdminLogin a déclenché trop de redirections. Pour résoudre le problème, effacez les cookies de ce site ou autorisez les cookies tiers. Si le problème persiste, il peut être dû à une mauvaise configuration du serveur et n'être aucunement lié à votre ordinateur.

 
En savoir plus sur ce problème.
Code d'erreur : ERR_TOO_MANY_REDIRECTS."
 
Par contre le front office marche toujours.
Link to comment
Share on other sites

Merci Zaar, j'ai bien l'accès au BO! mais toujours le même problème + une ligne en haut à droite, sur la page du back office

 

"Fatal error: Class 'Context' not found in /homez.559/elinorac/www/prestashop/adminelinorac/ajax.php on line 32".

 

Cette erreur s'affiche aussi quand après plusieurs connexions j'en arrive à la page blanche et l'adresse http://www.mondomaine.com/prestashop/admin/ajax.php.

Link to comment
Share on other sites

Non toujours pas... L'erreur n'apparaît plus mais j'ai toujours le même problème de redirection.

 

En fait si je comprends bien, il semble que ça me redirige de login.php à index.php

 

voilà la partie de l'adresse qui semble bizarre:

 

login.php?redirect=index.php?tab=AdminCatalog&token=6791bafa446225f5b3f0421f0d1bdf51 

Edited by Elinora (see edit history)
Link to comment
Share on other sites

La redirectioon de login à index est normale.

Une fois logguée vous êtes redirigé vers l'index.php de votre admin

 

Seulement tout fonctionne corresctement chez moi.

 

Pouvez vous nettoyer le cache de votre navigateur et me dire quel navigateur vous utlisez?

Link to comment
Share on other sites

En fait, quand cette adresse avec login.php?redirect=index.php?tab=AdminCatalog&token=6791bafa446225f5b3f0421f0d1bdf51  s'affiche, 

ça me redirige vers la page de connexion, et je dois donc de nouveau me connecter.

 

Quand je finis par réussir à me connecter, il y a juste /prestashop/admin/index.php, ce qui est normal.

 

Donc il doit y avoir un souci au niveau de la redirection qui au lieu de me faire parvenir à l'écran d'accueil me fait revenir à la connexion. A chaque fois il faut quelque chose comme trois ou quatre essais avant de parvenir à la page voulue, puis quand j'exécute d'autres actions, systématiquement je suis redirigée vers la page d'identification, c'est à peine si j'ai le temps d'enregistrer un produit.

 

Je suis sur Google Chrome, je fais ça sans arrêt de vider le cache et les cookies, ainsi que sur Mozilla Firefox. Sur Firefox c'est pire que sur Chrome, je n'arrive pas du tout à me connecter. Invariablement, je suis ramenée à l'identification.

Link to comment
Share on other sites

Souvent ça arrive que je puisse faire en entier l'enregistrement d'un produit avec l'image. Ensuite quand je retourne dans la catégorie pour le mettre en tête de liste, le problème reparaît. En général, quand ça marche, ça dure une ou deux minutes et ensuite ça recommence. Peut-être que ça vient vraiment de Chrome, mais dans ce cas pourquoi ça ne marche pas sur Mozilla?

Link to comment
Share on other sites

L'erreur qui finit systématiquement par arriver c'est quand ça me redirige vers une adresse qui se finit en ajax.php et une page blanche. Et quand je parviens à me reconnecter ensuite, j'ai la plupart du temps "supplier ajax error: parsererror" suivi de "manager ajax error: parsererror".

 

Donc il y a de façon sûre et certaine une erreur dans le fichier ajax php. Mais je ne vois pas quoi. Et je ne vois pas pourquoi c'est arrivé si soudainement!

Link to comment
Share on other sites

Bon ben problème résolu finalement en mp.

 

La démarche:

Utiliser Smarty 2 au lieu de Smarty 3 -> j'ai mis oui car vu t'as version de presta j'étais pas sur que tu sois en smarty 3 (a vérifier bien sûr)

 

Et ce qui semble avoir réglé le problème :

 

Vérifier l'IP dans le cookie: j'ai mis non et c'est apparement ce qui a résolu ce problème. Pourquoi je ne sais pas mais au moins ça marche.

 

Pour ces modifications c'est dans ->Préférences

 

Je rappelle que la version de presta ici est la 1.4.11.0

  • Like 1
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...