if-then-else tests

TrafficScript provides ‘if’ and ‘if/else’ statements for conditional execution. The condition is an expression, which is evaluated.

The return value of the expression determines whether the condition is ‘true’ or ‘false’:

  • A non-zero number or non-empty string is ‘true’;
  • A zero number or empty string is ‘false’.

For example:

if( $url == "/" ) {
   log.info( "Access to home page" );
}

or

if( $isAuthenticated ) {
   pool.use( "local pool" );
} else {
   log.info( "Unauthenticated user accessed the service" );
   connection.close();
}
Owen Garrett [Zeus Dev Team] 01 July 2005  Permalink  
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)
Download Free ZXTM Desktop Edition

Recent Articles

Other Resources



www.zeus.com