#!/usr/local/bin/perl # # Show a message using xmessage under X11 # $version="1.00b"; # # (c) 1998 Emmanuel PIERRE # epierre@e-nef.com # http://www.e-nef.com/users/Emmanuel.PIERRE # require "cgi-lib.pl"; $prog="rwho.cgi"; # Some default vriables: $PATH = $ENV{'PATH_INFO'} ; chop $PATH if substr($PATH, -1) eq "/" ; @_ = split('/', $PATH) ; &ErrBadPath unless &ValidPath ; # Check for server spoofing # # # # # # Main # &ReadParse(*in); print &PrintHeader; # # # # # # # Affiche la page # print << "END"; Web des Eleves


Résultat



Message en cours d'émission ...


END ($fic = open(XMESG,"|/usr/X11/bin/xmessage -center -file - -display :0")) or die "ERR: $!"; (kill 0,$fic) or die "xmessage invocation failed"; print XMESG "Message de $in{'name'} <$in{'address'}>\n"; print XMESG "---------------------------------------\n"; print XMESG "$in{'comment'}"; close(XMESG); print << "END"; Message reçu ! END # # # # # # Tests # sub ValidPath { return 1 unless /\.\./ ; return '' if /^\.\./ ; return '' if /\/\.\.\// ; return '' if /\.\.$/ ; return 1 ; }