is_date) { require_once('exportics.php'); } die(); } // quand on ajoute un commentaire utilisateur if(isset($_POST['ajoutcomment'])) { if (isset($_SERVER['REMOTE_USER'])) { $comment_user = $_SESSION['nom']; } elseif(isset($_POST["commentuser"]) && ! empty($_POST["commentuser"])) { $comment_user = $connect->qstr(strip_tags($_POST["commentuser"])); } elseif(isset($_POST["commentuser"])) { $err |= COMMENT_USER_EMPTY; } else { $comment_user = _('anonyme'); } if(empty($_POST["comment"])) { $err |= COMMENT_EMPTY; } if (isset($_POST["comment"]) && ! is_error(COMMENT_EMPTY) && ! is_error(NO_POLL) && ! is_error(COMMENT_USER_EMPTY)) { if( ! $connect->Execute('INSERT INTO comments ' . '(id_sondage, comment, usercomment) VALUES ("'. $numsondage . '","'. $connect->qstr(strip_tags($_POST['comment'])). '","' . $comment_user .'")') ) { $err |= COMMENT_INSERT_FAILED; } } } // Action quand on clique le bouton participer $user_studs=$connect->Execute("SELECT * FROM user_studs WHERE id_sondage='$numsondage' ORDER BY id_users"); $nbcolonnes=substr_count($dsondage->sujet,',')+1; if (!is_error(NO_POLL) && isset($_POST["boutonp"])) { //Si le nom est bien entré if (! isset($_POST["nom"]) || empty($_POST['nom'])) { $err |= NAME_EMPTY; } if(!is_error(NAME_EMPTY) && (!isset($_SERVER['REMOTE_USER']) || $_POST["nom"] == $_SESSION["nom"])) { for ($i=0;$i<$nbcolonnes;$i++) { // Si la checkbox est enclenchée alors la valeur est 1 if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') { $nouveauchoix.="1"; } else { // sinon c'est 0 $nouveauchoix.="0"; } } while($user = $user_studs->FetchNextObject(false)) { if ($_POST["nom"]==$user->nom) { $err |= NAME_TAKEN; } } // Ecriture des choix de l'utilisateur dans la base if (!is_error(NAME_TAKEN) && ! is_error(NAME_EMPTY)) { // TODO: throw error $nom=substr($_POST["nom"],0,64); $connect->Execute('INSERT INTO user_studs (nom,id_sondage,reponses) VALUES ("' . $nom . '","' . $numsondage . '","' . $nouveauchoix . '")'); if ($dsondage->mailsonde || /* compatibility for non boolean DB */ $dsondage->mailsonde=="yes" || $dsondage->mailsonde=="true") { $headers="From: ".NOMAPPLICATION." <".ADRESSEMAILADMIN.">\r\nContent-Type: text/plain; charset=\"UTF-8\"\nContent-Transfer-Encoding: 8bit"; mail ("$dsondage->mail_admin", "[".NOMAPPLICATION."] "._("Poll's participation")." : $dsondage->titre", "\"$nom\" ". _("has filled a line.\nYou can find your poll at the link") . " :\n\n". get_server_name()."/studs.php?sondage=$numsondage \n\n" . _("Thanks for your confidence.") . "\n". NOMAPPLICATION, $headers); } } } else { $err |= NAME_EMPTY; } } print_header(true, $dsondage->titre); echo '
'."\n"; logo(); bandeau_tete(); bandeau_titre(_("Make your polls")); sous_bandeau(); if($err != 0) { bandeau_titre(_("Error!")); echo '