Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules

Search

Donate to XOOPS!

Please select an amount to donate


Do you want your username revealed with your donation?
Yes - List me as a Generous Donor
No - List my donation as from an Anonymous Donor


Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

admin Arabic banner block Christmas comments cumulus DayDawn dhsoft e-Commerce E-Learning Git Google GUI hacks instant-zero jQuery module mygalleries news Nordic Olédrion oxygen PageRank PHP rmcommon security SEO simple-XOOPS Smarty sport tag Theme tutorial wiki WOX xoops XoopsEngine ZendFramework

New Users

Registering user

# 133963

hillsync

Welcome to XOOPS!
[Main Page]

Xoops Security Class

From XOOPS Web Application System

Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki mode

Printable version | Disclaimers | Privacy policy
Category: DevWiki

DevWiki Index

The XoopsSecurity class is used to create a token to ensure the page was entered via the website and not entered via a potential cross-site (xsite) scripting method.

Enter the Xoops Token either using a form item or HTML:

Usage In XOOPS Form Element

Usage in a Form item use the AddElement method:

$form->AddElement(new XoopsFormHiddenToken());

Usage In HTML

For usage in a template or HTML directly, first generate the html by getting the token:

$html = $GLOBALS['xoopsSecurity']->getTokenHTML();

For example this creates a html <input> entity like:

<input type='hidden' name='XOOPS_TOKEN_REQUEST' id='XOOPS_TOKEN_REQUEST' value='9c87534e1fec743d0a985740a7ec927d' />

You can also pass the <input> entity to the template by assigning it to a Smarty variable, something like:

$xoopTpl->assign('token', $html);

Then place Smarty variable <{$token}> in the html template so it is included when the form is submitted.


Validation

To validate the security code place the following in the form verification routine:

if ($GLOBALS['xoopsSecurity']->check()) {
  // success path
} else {
  // fails path
}

Retrieved from "http://xoops.org/modules/mediawiki/index.php/Xoops_Security_Class"

This page has been accessed 3,491 times. This page was last modified 22:17, 9 April 2010. Content is available under XOOPS Web Application System.