#! /usr/local/bin/oraperl

###read the 2 parameters

($old, $new) = split ( /\&/, $ENV{'QUERY_STRING'} );

$old =~ s/old=(\.*)/$1/;
$new =~ s/new=(\.*)/$1/;

print ("Content-type: TEXT/HTML\n\n");
print ("<TITLE>Server Modification</TITLE>\n");
print ("<H2>Server IP address change</H2><HR>\n");
print ("you submitted the following servers:<P> \n");
print ("<B>old server </B>: $old <BR>\n");
print ("<B>new server </B>: $new <P>\n");

### set Oracle's variables.... first!

$ENV{'ORACLE_HOME'}='/usr/oracle';
$ENV{'ORACLE_SID'}='nodb';

### logon kayak
$lda = &ora_login('','michal','michal');

### change the server

$query = " update  clip set server='$new' where server='$old' ";
if (!($ret =&ora_do($lda, $query))) 
  { 
      print ("$ora_errstr<BR>\n");
      print "Modification failed!!!<BR>\n";
  }
else 
  {
      #if ($ret = 'OK') {$ret = 0}
      print ("rows updated: $ret<BR> \n");
#     print ("$ora_errstr <BR>\n");
      print "Modification successful. <BR>\n";
      &ora_commit($lda);
  }
###logoff
# print ("I logged off kayak\n");
&ora_logoff($lda);

print ("<HR>\n");
print ("<ADDRESS>In case of problems contact Michal Kurmanowicz (michal@npac.syr.edu)</ADDRESS>");


