- copy gtickets.php into modules/(dirname)/include/
- include gtickets.php in your scripts
- add Ticket hidden into your forms like this:
<input type='hidden' name='op' value='order' />
".$xoopsGTicket->getTicketHtml( __LINE__ )."
<input type='submit' name='submit' value='"._SUBMIT."' />
4 methods are valid for each usages.
See the last of this post.
- add Ticket checker into your recipent of form data like this:
if ( ! $xoopsGTicket->check() ) {
redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors());
}
- That's all!
4 methods of getting a ticket:
// render form as plain html
function getTicketHtml( $salt = '' , $timeout = 1800 )
{
return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue( $salt , $timeout ).'" />' ;
}
// returns an object of XoopsFormHidden including theh ticket
function getTicketXoopsForm( $salt = '' , $timeout = 1800 )
{
return new XoopsFormHidden( 'XOOPS_G_TICKET' , $this->issue( $salt , $timeout ) ) ;
}
// returns an array for xoops_confirm() ;
function getTicketArray( $salt = '' , $timeout = 1800 )
{
return array( 'XOOPS_G_TICKET' => $this->issue( $salt , $timeout ) ) ;
}
// return GET parameter string.
function getTicketParamString( $salt = '' , $noamp = false , $timeout=1800 )
{
return ( $noamp ? '' : '&' ) . 'XOOPS_G_TICKET=' . $this->issue( $salt, $timeout ) ;
}