From bfc5f8d1bf84865c1fe795831005b16b95ce433c Mon Sep 17 00:00:00 2001 From: Naglfar Date: Wed, 7 Jun 2023 15:53:57 +0000 Subject: check if environment variable REQUEST_URI is defined --- index.cgi | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'index.cgi') diff --git a/index.cgi b/index.cgi index 91778f1..2f12203 100755 --- a/index.cgi +++ b/index.cgi @@ -1,14 +1,15 @@ #!/usr/bin/perl -wT +$request = 'main'; # breaks up a string according to a separator -@uri = split('/', $ENV{REQUEST_URI}); -if ( $#uri > -1 && -e "/openwcms/data/$uri[1].html" ) +if(defined($ENV{REQUEST_URI})) { - $request = "$uri[1]"; -} -else -{ - $request = 'main'; + @uri = split('/', $ENV{REQUEST_URI}); + + if( $#uri > -1 && -e "/openwcms/data/$uri[1].html" ) + { + $request = "$uri[1]"; + } } require '/openwcms/add_items.pl'; -- cgit v1.2.3