#!/bin/sh

# disable filename globbing
echo Content-type: text/html
echo

BASE=`pwd`
APPLDIR=$BASE/appl
DATADIR=$BASE/data
PATH=$PATH:$BASE/ihd/bin:.
export PATH APPLDIR DATADIR
ZONA=`./appl/sh/usuar|awk -v a=$REMOTE_USER -F"^" 'index($3,a){print substr($4,1,3);exit}' -`
NIV=`./appl/sh/usuar|awk -v a=$REMOTE_USER -F"^" 'index($3,a){print $11;exit}' -`
NIV=0

{

awk ' BEGIN {
print "<html>"
print "<head>"
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">"
print "<meta name=\"GENERATOR\" content=\"Inhedo 4gt 1.0\">"
print "<meta name=\"ProgId\" content=\"Inhedo Form Generator\">"
if ("'"$NIV"'"==1) printf "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=https://lg.inhedo.com/Acceso%d\">\n","'"$NIV"'"
else if ("'"$NIV"'"+0==0) printf "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=https://lg.inhedo.com/Premed\">\n"
else print "Prohibido el Acceso"
print "</head>"
print "</body>"
print "</head>"
} '
} 2>/tmp/LOG
cat /tmp/LOG
