#!/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=(.*)/;
    $sname    = $1 if /sname=(.*)/;
    $ipaddress= $1 if /ipaddress=(.*)/;
    $platform = $1 if /platform=(.*)/;
}


print "Content-type: text/html\n\n ";
print <<"EndOfHTML";
<HTML>
<TITLE>NPAC Video News DataBase : Modify Server Property</TITLE>
<BODY bgcolor="tan">
<B>
<H1> Result of the "Modify a server" operation </H1>
<HR>
<FONT Size="4"> Input data <BR><BR>
<FONT Size="3">
Server name : $sname <BR>
IP address : $ipaddress<BR>
Platform : $platform <BR><BR>
<HR>
<FONT Size="4"> Results of the "Modify Server" operation: <BR><BR>
<FONT Size="3">
EndOfHTML

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

$ret = &ora_do ($lda, " update servertable set sname='$sname', ipaddress='$ipaddress', platform='$platform'   where serverid=$serverid ");
if($ret==1)  {
  &ora_commit($lda);
  print "$ret row is updated<BR>";
} else  {
  print "Error occured.<BR>$ora_errstr<BR>";
}

&ora_logoff($lda);

print <<"EndOfHTML";
<HR>
<A HREF="$WSA/cgi-bin/modserverform">MODIFY ANOTHER</A>
</BODY>
</HTML>
EndOfHTML
