#!/oracle/app/oracle/product/7.3.3/bin/oraperl

##### set Oracle's variables #####
$ENV{'ORACLE_HOME'}='/oracle/app/oracle/product/7.3.3';
$ENV{'ORACLE_SID'}='rabbit';
$orauser="vod";
$orapass="vod";

#### set web server address ####
$WSA = "http://clarissa.npac.syr.edu/vod";
$PROJDIR="/project/K136/VOD";




$input = <>;
#chop $input;

@param = split(/\&/, $input );

foreach (@param)
{
    ##### for URL decoding ######
    ### convert plus to space ###
    $_ =~ s/\+/ /g;
    ### convert %XX from hex numbers to alphanumeric ###
    $_ =~ s/%(..)/pack("c", hex($1))/ge;

    $serverid = $1 if /serverid=(.*)/;

}

if ( $serverid eq "" ) {
print ("Content-type: TEXT/HTML\n\n");
print <<"EndOfHTML";
<HTML>
<TITLE>Video News Database - Modify Server Properties</TITLE>
<BODY bgcolor="tan">
<H3>Error: you have not selected any server to modify!</H3>
<A HREF="$WSA/cgi-bin/modserverform">
Another chance...</A>
</BODY>
</HTML>
EndOfHTML
die;
}


##### logon oracle #####
$lda = &ora_login('', $orauser, $orapass);

$csr = &ora_open($lda, " select sname, ipaddress, platform from servertable where serverid = $serverid ");
($sname, $ipaddress, $platform ) = &ora_fetch($csr) ;
##### logoff oracle #####

print ("Content-type: TEXT/HTML\n\n");
print <<"EndOfHTML"; 
<HTML>
<TITLE>Video News Database - Modify Server Properties - Server: $sname</TITLE>
<BODY bgcolor="tan">
<H1>Modify Server Properties</H1>
<HR>
<CENTER>
<FORM ACTION="$WSA/cgi-bin/modserverdoit" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="serverid" VALUE="$serverid">
<TABLE BORDER="3" WIDTH="60%">
<TR><TD>
Server Name</TD><TD> 
<INPUT TYPE="text" NAME="sname" VALUE="$sname" SIZE="30"></TD></TR>
<BR>
<TR><TD>IP address</TD><TD>
<INPUT NAME="ipaddress" SIZE="30" VALUE="$ipaddress" MAXLENGTH="15"></TD></TR> 
<BR>
<TR><TD>Platform</TD><TD>
<INPUT NAME="platform" SIZE="30" VALUE="$platform" ></TD></TR>
</TABLE></CENTER>
<P>
<INPUT TYPE="Submit" VALUE="MODIFY">
<INPUT TYPE="RESET" VALUE ="RESET">
</FORM>
<HR>
EndOfHTML
