Salut , merci de ta confirmation.
Dans le script suivant j'aimerai qu'il m'ignore les tests sur la validité de LEFTNEXTHOP, LEFT, RIGHT et RIGHTNEXTHOP... comment mettre ses lignes en commentaires car quand je met un # il me met une erreur 500 lors de l'affichage de la page
merci
#!/usr/bin/perl
#
# SmoothWall CGIs
#
# This code is distributed under the terms of the GPL
#
# (c) The SmoothWall Team
#
# $Id: vpnconfig.dat,v 1.3.2.1 2002/01/20 11:43:42 eanna Exp $
#
require '/var/ipcop/header.pl';
use File::Copy;
my %cgiparams;
my $filename = "${swroot}/vpn/config";
$cgiparams{'ENABLED'} = 'off';
# wantfile required for import, sadly it can only be enabled globally...
&getcgihash(\%cgiparams, {'wantfile' => 1, 'filevar' => 'FH'});
my $errormessage = '';
if ($cgiparams{'ACTION'} eq $tr{'add'})
{
unless ($cgiparams{'NAME'} =~ /^[a-zA-Z]+$/) {
$errormessage = $tr{'name must only contain characters'}; }
unless (&validip($cgiparams{'LEFT'})) {
$errormessage = $tr{'left ip is invalid'}; }
unless (&validip($cgiparams{'LEFTNEXTHOP'})) {
$errormessage = $tr{'left next hop ip is invalid'}; }
unless (&validipandmask($cgiparams{'LEFT_SUBNET'})) {
$errormessage = $tr{'left subnet is invalid'}; }
unless (&validip($cgiparams{'RIGHT'})) {
$errormessage = $tr{'right ip is invalid'}; }
unless (&validip($cgiparams{'RIGHTNEXTHOP'})) {
$errormessage = $tr{'right next hop ip is invalid'}; }
unless (&validipandmask($cgiparams{'RIGHT_SUBNET'})) {
$errormessage = $tr{'right subnet is invalid'}; }
open(FILE, $filename) or die 'Unable to open config file.';
my @current = <FILE>;
close(FILE);
unless ($errormessage)
{
open(FILE,">>$filename" ) or die 'Unable to open config file.';
flock FILE, 2;
print FILE "$cgiparams{'NAME'},$cgiparams{'
;LEFT'},$cgiparams{'LEFTNEXTHOP'
},$cgiparams{'LEFT_SUBNET'},$cgiparams
{'RIGHT'},$cgiparams{'RIGHTNEXTH
OP'},$cgiparams{'RIGHT_SUBNET'},
$cgiparams{'SECRET'},$cgiparams{'
;ENABLED'}\n";
close(FILE);
undef %cgiparams;
&writeipsecfiles();
}
}