DaScheff: scripts kombinieren

Beitrag lesen

Dieses Hier: :-)
<translation>
mein Perl-Script den Inhalt 2er JS-Scripte an den Browser liefern
</translation>
Also, komplettes script:
Danke!

#!/usr/bin/perl
######################################################################
#  anmerkung.neu.pl                                                     #
#                                                                    #
######################################################################

use DBI;

$table = "ANMERKUNG";
$database = "dateb";
$data_source = "dbi:mysql";
$user = "benutzer";
$passwd = "datenbank";

print "Content-type: text/html\n\n";

if ($ENV{'REQUEST_METHOD'} eq 'GET') {
  @pairs = split(/&/, $ENV{'QUERY_STRING'});
}
elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
  read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

@pairs = split(/&/, $buffer);
}
else {
  &error('request_method');
}

foreach $pair (@pairs) {
  ($name, $value) = split(/=/, $pair);

$value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/<!--(.|\n)*-->//g;

$FORM{$name} = $value;

$FORM{$name} =~ tr/'/./;
  $FORM{$name} =~ tr/`/./;
  $FORM{$name} =~ tr/"/./;
  $FORM{$name} =~ tr/\/./;
  $FORM{$name} =~ tr/$/./;
  $FORM{$name} =~ tr/@/./;
}

$sth = $dbh->prepare($statement) or &error('database_prepare');
$sth->execute or &error('database_execute');

$statement = "select distinct * from ANMERKUNG where
r_id="$FORM{r_id}" ";

$sth = $dbh->prepare($statement) or &error('database_prepare');
$sth->execute or &error('database_execute');
$rows_returned = $sth->rows;

print "<html>\n";
print "<head>\n";
print "<title>SQL Ergebnis</title>\n";
print"
<script language="javascript">
<!--
 function ZeitAnzeigen()
     {
      var Jetzt = new Date();
      var Tag = Jetzt.getDate();
      var Monat = Jetzt.getMonth() + 1;
      var Jahr = Jetzt.getYear();
      window.document.Anzeige.datum.value = Jahr + "-" + Monat + "-" + Tag;
     }
-->
</script>
<!-- <script language="Javascript1.2" src="../htmlarea/editor.js"></script>
 <script>
 _editor_url = "/htmlarea/";

</script>

<style type="text/css"><!--
  .btn   { BORDER-WIDTH: 1; width: 26px; height: 24px; }
  .btnDN { BORDER-WIDTH: 1; width: 26px; height: 24px; BORDER-STYLE: inset;
 BACKGROUND-COLOR: buttonhighlight; }
  .btnNA { BORDER-WIDTH: 1; width: 26px; height: 24px; filter:
 alpha(opacity=25); }
 --></style>

</head>";

print "</head>\n";
print "<body
onLoad="window.setTimeout('ZeitAnzeigen()',1000)"
text=#000000 vLink=#000080 aLink=#000080 link=#000080 bgColor=#fcee72>\n";
print "<center>\n";

print "<form name="Anzeige" action="/cgi-bin/anmerkung.neu.ok.pl" >".

" <center>

<TABLE cellPadding=1 width=366 bgColor=#dddddd border=0 height="295">
  <TBODY>
  <TR bgColor=#999999>
    <TH width="360" height="32"><FONT size=+1>Anmerkung Eingeben</FONT>
</TH></TR>
  <TR>
    <TD width="360" align="center" height="225"><INPUT type=hidden
value=$FORM{p_id} name=p_id><BR>
<TEXTAREA id="text" name="text" rows=8 wrap=hard cols=40></TEXTAREA>

<script language="javascript1.2">
editor_generate('text'); // field, width, height
</script>

<p align="left">Datum: <INPUT name=datum size="20"></TD></TR>
  <TR>
    <TD width="360" align="center" height="26"><INPUT type=submit
value=Speichern></td></tr>

</td>
</tr>
</table>
</form>";

print "</body>\n";
print "</html>\n";