home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 May / PCWorld_2004-05_cd.bin / akce / openoffice / f_0299 / savepic.pl
Perl Script  |  2002-12-12  |  878b  |  42 lines

  1. #!/usr/bin/perl
  2.  
  3. require "common.pl";
  4.  
  5. %aRequestMap = common::HTTP_getRequest();
  6.  
  7. # get new picture
  8. $sCurrPic = $aRequestMap{ "CurrPic" };
  9.  
  10. @aPictureArray = common::File_read( "picture.txt" );
  11. $nPictureArrayLen = @aPictureArray;
  12.  
  13. # check if + or - was pressed
  14. if( $aRequestMap{ "Auswahl" } eq "+" )
  15. {
  16.     $sCurrPic = abs( $sCurrPic ) + 1;
  17. }
  18.  
  19. if( $aRequestMap{ "Auswahl" } eq "-" )
  20. {
  21.     $sCurrPic = abs( $sCurrPic ) - 1;
  22. }
  23.  
  24. # save picture name
  25. if( (abs( $sCurrPic ) > 0) && ( abs( $sCurrPic ) < ( $nPictureArrayLen ) ) )
  26. {
  27.     open( F_CURRPIC, ">currpic.txt");
  28.     print F_CURRPIC abs( $sCurrPic );
  29.     close( F_CURRPIC );
  30. }
  31.  
  32. # return to edit page
  33. print "Content-type: text/html\n\n";
  34. print "<HTML>\n<HEAD>\n";
  35. print "<META http-equiv=\"refresh\" CONTENT=\"0 ;URL=editpic.pl\">";
  36. print "<title>savepic.pl</title>";
  37. print "</HEAD>\n";
  38. print "<BODY>\n";
  39. print "</BODY>\n";
  40. print "</HTML>\n";
  41. %>
  42.