xd_check
This commit is contained in:
parent
bd86b9cc65
commit
e2987ed71c
|
@ -11,6 +11,50 @@ function get_arenas_list(){
|
||||||
}
|
}
|
||||||
return $arenas;
|
return $arenas;
|
||||||
}
|
}
|
||||||
|
function rand_str($length = 32, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'){
|
||||||
|
|
||||||
|
$chars_length = (strlen($chars) - 1);
|
||||||
|
$string = $chars{rand(0, $chars_length)};
|
||||||
|
|
||||||
|
for ($i = 1; $i < $length; $i = strlen($string)){
|
||||||
|
$r = $chars{rand(0, $chars_length)};
|
||||||
|
if ($r != $string{$i - 1}) $string .= $r;
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
function xd_check_input($id=1){
|
||||||
|
/*
|
||||||
|
*On génére un hash aléatoire qui sera
|
||||||
|
*ajouté aux formulaires, afin d'ajouter
|
||||||
|
*une vérification supplémentaire
|
||||||
|
*lors du traitement de ce dernier
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* le parametre $id permet de selectionner le type de retour
|
||||||
|
* 0=> un input type hidden sans id
|
||||||
|
* 1=> un input type hidden avec id
|
||||||
|
* 2=> juste la valeur
|
||||||
|
*/
|
||||||
|
if(!isset($_SESSION['xd_check'])){
|
||||||
|
//le générer
|
||||||
|
$_SESSION['xd_check']=rand_str(25);
|
||||||
|
}
|
||||||
|
switch($id){
|
||||||
|
case 0:
|
||||||
|
return "<input type=\"hidden\" name=\"xd_check\" value=\"".$_SESSION['xd_check']."\"/>";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return "<input type=\"hidden\" name=\"xd_check\" id=\"xd_check\" value=\"".$_SESSION['xd_check']."\"/>";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return $_SESSION['xd_check'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "<input type=\"hidden\" name=\"xd_check\" id=\"xd_check\" value=\"".$_SESSION['xd_check']."\"/>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function get_language_array(){
|
function get_language_array(){
|
||||||
/*
|
/*
|
||||||
* Choisir la langue de l'utilisateur
|
* Choisir la langue de l'utilisateur
|
||||||
|
|
Loading…
Reference in New Issue
Block a user