43 lines
957 B
PHP
43 lines
957 B
PHP
|
<?php
|
||
|
|
||
|
// $var clef à rechercher dans $_POST, $_GET, et $_SESSION (si $session=true)
|
||
|
// $default valeur retournée si aucune valeur n'est trouvée
|
||
|
// $session: si true, rechercher aussi dans $_SESSION
|
||
|
|
||
|
function getpost( $var, $default="", $session=false )
|
||
|
{
|
||
|
//echo '$var =>' . $var . "<br />";
|
||
|
if ( isset($_GET[$var]) )
|
||
|
{
|
||
|
//echo '$_get -> $var =>' . $var . "<br />";
|
||
|
return $_GET[$var];
|
||
|
}
|
||
|
elseif ( isset($_POST[$var]) )
|
||
|
{
|
||
|
//echo '$_POST -> $var =>' . $var . "<br />";
|
||
|
return $_POST[$var];
|
||
|
}else
|
||
|
{
|
||
|
if ( isset($_SESSION[$var]) AND $session==true )
|
||
|
{
|
||
|
return $_SESSION[$var];
|
||
|
}else
|
||
|
{
|
||
|
//echo 'default -> $var =>' . $var . "<br />";
|
||
|
return $default;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
// MET LA PREMIÈRE LETTRE D'UN MOT EN MAJUSCULE ( utf8 compliant )
|
||
|
|
||
|
function mb_ucfirst($str) {
|
||
|
$char = mb_substr($str,0,1,"UTF8");
|
||
|
$str = mb_substr( $str, 1, NULL, "UTF8");
|
||
|
$char = mb_strtoupper( $char, "UTF8");
|
||
|
return $char . $str;
|
||
|
}
|
||
|
|