Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
documentation:2.1:extendedfunctions [2019/09/29 23:00]
cmaudoux [token]
documentation:2.1:extendedfunctions [2019/11/05 20:42] (current)
cmaudoux [isInNet6]
Line 185: Line 185:
 <code perl> <code perl>
 isInNet6($ipAddr,​ '​fe80::/​10'​) isInNet6($ipAddr,​ '​fe80::/​10'​)
 +</​code>​
 +
 +==== varIsInUri ====
 +
 +Function to check if a variable is in requested URI. Example //check if $uid is in /​check-auth/​ URI//:
 +
 +<code perl>
 +varIsInUri($ENV{REQUEST_URI},​ '/​check-auth/',​ $uid)
 +
 +https://​test1.example.com/​check-auth/​dwho ​    -> true
 +https://​test1.example.com/​check-auth/​dwho/​api -> true
 +https://​test1.example.com/​check-auth/​dwh ​     -> false
 +</​code>​
 +
 +* You can set "​restricted"​ flag to match exact URI:
 +
 +<code perl>
 +varIsInUri($ENV{REQUEST_URI},​ '/​check-auth/',​ "​$uid/",​ 1)
 +
 +https://​test1.example.com/​check-auth/​rtyler/ ​    -> true
 +https://​test1.example.com/​check-auth/​rtyler/​api ​ -> false
 +https://​test1.example.com/​check-auth/​rtyler ​     -> false
 </​code>​ </​code>​