From a445a5d6fac8bdf0422854816a094dc6c05d20ed Mon Sep 17 00:00:00 2001 From: FramaJosephK Date: Mon, 2 Mar 2015 19:30:26 +0100 Subject: [PATCH] Fix collisions + Inversion bandeau Gitlab entre README et INSTALL --- INSTALL.md | 9 --------- README.md | 9 +++++++++ creation_sondage.php | 25 +++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index bfc9623..b1a2243 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,12 +1,3 @@ -[![](https://git.framasoft.org/assets/logo-black-f52905a40830b30aa287f784b537c823.png)](https://git.framasoft.org) - -![English:](http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Flag_of_the_United_Kingdom.svg/20px-Flag_of_the_United_Kingdom.svg.png) **Framasoft uses GitLab** for the development of its free softwares. Our Github repositories are only mirrors. -If you want to work with us, **fork us on [git.framasoft.org](https://git.framasoft.org)**. (no registration needed, you can sign in with your Github account) - -![Français :](http://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Flag_of_France.svg/20px-Flag_of_France.svg.png) **Framasoft utilise GitLab** pour le développement de ses logiciels libres. Nos dépôts Github ne sont que des mirroirs. -Si vous souhaitez travailler avec nous, **forkez-nous sur [git.framasoft.org](https://git.framasoft.org)**. (l'inscription n'est pas nécessaire, vous pouvez vous connecter avec votre compte Github) -* * * - ![English:](http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Flag_of_the_United_Kingdom.svg/20px-Flag_of_the_United_Kingdom.svg.png) This software is governed by the CeCILL-B license. If a copy of this license is not distributed with this file, you can obtain one at diff --git a/README.md b/README.md index 87f3903..e57038b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ +[![](https://git.framasoft.org/assets/logo-black-f52905a40830b30aa287f784b537c823.png)](https://git.framasoft.org) + +![English:](http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Flag_of_the_United_Kingdom.svg/20px-Flag_of_the_United_Kingdom.svg.png) **Framasoft uses GitLab** for the development of its free softwares. Our Github repositories are only mirrors. +If you want to work with us, **fork us on [git.framasoft.org](https://git.framasoft.org)**. (no registration needed, you can sign in with your Github account) + +![Français :](http://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Flag_of_France.svg/20px-Flag_of_France.svg.png) **Framasoft utilise GitLab** pour le développement de ses logiciels libres. Nos dépôts Github ne sont que des mirroirs. +Si vous souhaitez travailler avec nous, **forkez-nous sur [git.framasoft.org](https://git.framasoft.org)**. (l'inscription n'est pas nécessaire, vous pouvez vous connecter avec votre compte Github) +* * * + ![English:](http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Flag_of_the_United_Kingdom.svg/20px-Flag_of_the_United_Kingdom.svg.png) This software is governed by the CeCILL-B license. If a copy of this license is not distributed with this file, you can obtain one at diff --git a/creation_sondage.php b/creation_sondage.php index bf22246..948d43b 100644 --- a/creation_sondage.php +++ b/creation_sondage.php @@ -38,13 +38,34 @@ function random($car) return $string; } +// Like function get_sondage_from_id() +function check_poll_id($id) +{ + global $connect; + + $sql = 'SELECT `id_sondage` FROM sondage`id_sondage` = ' . $connect->Param('id_sondage') ; + $sql = $connect->Prepare($sql); + $poll = $connect->Execute($sql, [$id]); + + if ($poll === false) { + return false; + } + + $dbpoll = $poll->FetchObject(false); + + return $dbpoll->id_sondage; +} + function ajouter_sondage() { global $connect; global $config; - $sondage=random(16); - $sondage_admin=$sondage.random(8); + $sondage = random(16); + while(check_poll_id($sondage) == $sondage) { + $sondage = random(16); + } + $sondage_admin = $sondage.random(8); $date_fin = $_SESSION["champdatefin"]; // provided by choix_autre.php or choix_date.php $_SESSION["champdatefin"]=""; //clean param cause 2 polls created by the same user in the same session can be affected by this param during the 2nd creation.