81 lines
2.6 KiB
PHP
81 lines
2.6 KiB
PHP
<?php
|
|
|
|
|
|
|
|
require_once 'include/utils/utils.php';
|
|
|
|
require_once 'includes/Loader.php';
|
|
|
|
vimport ('includes.runtime.EntryPoint');
|
|
|
|
require_once 'SUtiles.php';
|
|
|
|
@session_start();
|
|
|
|
|
|
|
|
|
|
|
|
global $adb;
|
|
|
|
|
|
|
|
$current_user = Users_Record_Model::getCurrentUserModel();
|
|
|
|
$userId = $current_user->get('id');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ($x = 0; $x < sizeof($_SESSION['id_ligne_formulaire']); $x++) {
|
|
|
|
|
|
|
|
$choix1="choix1".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix1=$_POST[$choix1];
|
|
|
|
|
|
|
|
|
|
|
|
$choix2="choix2".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix2=$_POST[$choix2];
|
|
|
|
|
|
|
|
$choix3="choix3".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix3=$_POST[$choix3];
|
|
|
|
|
|
|
|
$choix4="choix4".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix4=$_POST[$choix4];
|
|
|
|
|
|
|
|
$choix5="choix5".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix5=$_POST[$choix5];
|
|
|
|
|
|
|
|
$choix6="choix6".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix6=$_POST[$choix6];
|
|
|
|
|
|
|
|
|
|
|
|
$choix7="choix7".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix7=$_POST[$choix7];
|
|
|
|
|
|
|
|
$choix8="choix8".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix8=$_POST[$choix8];
|
|
|
|
|
|
|
|
$choix9="choix9".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix9=$_POST[$choix9];
|
|
|
|
|
|
|
|
$choix10="choix10".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
$choix10=$_POST[$choix10];
|
|
|
|
|
|
|
|
$autres="autres".$_SESSION['id_ligne_formulaire'][$x];
|
|
|
|
|
|
|
|
$originid = "";
|
|
|
|
if(isset($_POST['origin_id']))
|
|
|
|
$originid = $_POST['origin_id'];
|
|
|
|
//n enregisrer pas les questions vide
|
|
|
|
$chaine = $choix1.$choix2.$choix3.$choix4.$choix5.$choix6.$choix7.$choix8.$choix9.$choix10;
|
|
|
|
$tailles=strlen(preg_replace('/\s+/', '',$chaine));
|
|
|
|
|
|
|
|
if($tailles > 0){
|
|
|
|
$query = "INSERT INTO `result_lignes_formulaire`(`id_formulaire`,`id_ligne_formulaire`, `reponse1`, `reponse2`, `reponse3`, `reponse4`, `reponse5`, `reponse6`, `reponse7`, `reponse8`, `reponse9`, `reponse10`,`autres`,`accountId`, `user_id`, `origin`)
|
|
|
|
VALUES ('".$_SESSION['id_formulaire'][$x]."', '".$_SESSION['id_ligne_formulaire'][$x]."' ,'".addslashes($choix1)."','".addslashes($choix2)."','".addslashes($choix3)."','".addslashes($choix4)."' ,'".addslashes($choix5)."','".addslashes($choix6)."','".addslashes($choix7)."','".addslashes($choix8)."','".addslashes($choix9)."','".addslashes($choix10)."', '".addslashes($_POST[$autres])."','".$_SESSION["accountID"]."' , '".$userId."' , '".$originid."');";
|
|
|
|
$res = $adb->query($query);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// cet variable pour Ajax Controle
|
|
|
|
if($res == true){
|
|
|
|
echo "1" ;
|
|
|
|
}else{
|
|
|
|
echo "0";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|