Files
keliopanel-v1/0.7.1/panel/system/function.php
2016-02-21 01:33:05 +01:00

102 lines
2.1 KiB
PHP
Executable File

<?php
/*
Copyright (C) 2007 Mercier Benjamin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// Page contenant toute les functions
// Function de redirection
function Redirect ($Destination)
{
header ('Location: '.$Destination);
die ("Fin des opérations");
}
// Function de verificatio des form GET avec regex
function VerifGET ($Get, $Regex, $TailleMIN, $TailleMAX)
{
if ( !empty($_GET[$Get]) )
{
if ( preg_match ($Regex, $_GET[$Get]) )
{
$Taille = strlen($_GET[$Get]);
if ( ($Taille >= $TailleMIN) or ($TailleMIN == 0) )
{
if ( ($Taille <= $TailleMAX) or ($TailleMAX == 0) )
{
return "ChaineValide";
}
else
{
return "ChaineLongue";
}
}
else
{
return "ChaineCourte";
}
}
else
{
return "ChaineInvalide";
}
}
else
{
return "ChaineVide";
}
}
// Function de verificatio des form POST avec regex
function VerifPOST ($Get, $Regex, $TailleMIN, $TailleMAX)
{
if ( !empty($_POST[$Get]) )
{
if ( preg_match ($Regex, $_POST[$Get]) )
{
$Taille = strlen($_POST[$Get]);
if ( ($Taille >= $TailleMIN) or ($TailleMIN == 0) )
{
if ( ($Taille <= $TailleMAX) or ($TailleMAX == 0) )
{
return "ChaineValide";
}
else
{
return "ChaineLongue";
}
}
else
{
return "ChaineCourte";
}
}
else
{
return "ChaineInvalide";
}
}
else
{
return "ChaineVide";
}
}
?>