JHtml::_('behavior.keepalive'); <?php echo JHtml::_('form.token'); ?>JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));var_dump($_REQUEST);--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
href="<?php echo JRoute::_('index.php?option=com_pgclassifieds&view=newad&layout=start'); ?>"<a href=<?php echo JRoute::_('index.php?option=com_mycomponent&view=myview&' . JSession::getFormToken() .'=1'); ?>var_dump($app->input->post);$app->input->post)$app->input->post' is because I 'm trying to see why it fails in session.php function checkToken().$app->input->post), not the get ($_GET variables)...JSession::checkToken();
JSession::checkToken('get');There is a section on Securing Forms towards the end of this page https://docs.joomla.org/Secure_coding_guidelines that describes what you need to do, although I notice it needs updating to use JSession instead of JRequest. Anyone have a minute to update it?Chris.
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
How can I check this? (if it's expected from the GET variables)
Τη Δευτέρα, 15 Φεβρουαρίου 2016 - 6:57:14 μ.μ. UTC, ο χρήστης Michael Babker έγραψε:If the request you're sending the token in is expecting it from the GET variables, then call `JSession::checkToken('get')`. Otherwise it's going to use the default POST. You need to tell Joomla where you're expecting the token to be found if it isn't using the default behavior (and the default's coded for the more typical use case of a form's CSRF token and forms are more often than not submitted via POST).
function checkToken() {
$app = JFactory::getApplication();
$token = JSession::getFormToken();
if (!$_REQUEST[$token]) {
$session = JFactory::getSession();
if ($session->isNew()) {
// Redirect to login screen.
$app->enqueueMessage(JText::_('JLIB_ENVIRONMENT_SESSION_EXPIRED'), 'warning');
$app->redirect(JRoute::_('index.php'));
} else {
return false;
}
} else {
return true;
}
}
function checkToken(){
$result = JSession::checkToken();
if(!$result){$result = JSession::checkToken('get');}
}
<a href=<?php echo JRoute::_('index.php?option=com_mycomponentview=myview&' . JSession::getFormToken() .'=1'); ?><?php echo JRoute::_('index.php?option=com_mycomponentview=myview'>.