diff --git a/controllers/edit.class.php b/controllers/edit.class.php index a4910ad80225ab5087a1a50322c86174e451f599..940cfe4cde1f9c27f9802927f8100ed126a8098e 100755 --- a/controllers/edit.class.php +++ b/controllers/edit.class.php @@ -15,6 +15,7 @@ class edit private $niveau=''; private $photo =''; private $userlvl = ''; + private $lang_iso; private $userlang_game = ''; private $userlang_interface = ''; @@ -37,7 +38,7 @@ class edit private function init(){ require_once('./sys/load_iso.php'); - $lang_iso = new IsoLang(); + $this->lang_iso = new IsoLang(); $db = db::getInstance(); $user = user::getInstance(); $this->userlang = $user->get_lang(); @@ -128,7 +129,7 @@ class edit } - $this->userlang_game = isset($_POST['lang_game']) ? $lang_iso->language_code_for(trim($_POST['lang_game'])) : ''; + $this->userlang_game = isset($_POST['lang_game']) ? $this->lang_iso->language_code_for(trim($_POST['lang_game'])) : ''; // $this->userlang_interface = isset($_POST['userlang_interface']) ? trim($_POST['userlang_interface']) : ''; //$this->spoken_lang = isset($_POST['userlang_spoken']) ? trim($_POST['userlang_spoken']) : ''; //echo $this->spoken_lang; @@ -228,13 +229,14 @@ class edit for ($i=1; $i<=10; $i++) { if(isset($_POST['choix_langs_'.$i]) && $_POST['choix_langs_'.$i]!=""){ $sql = 'SELECT * - FROM score + FROM stats WHERE userid = ' . intval($this->userid).' AND langue="'.$_POST["choix_langs_".$i].'"'; $result = $db->query($sql); if (!($result->num_rows > 0)) { $score = 0; - $sql = 'INSERT INTO `score`(`userid`, `scoreGlobal`, `scoreOracle`, `scoreDruide`, `scoreDevin`, `langue`) VALUES ('.$this->userid.','.$score.','.$score.','.$score.','.$score.',"'.$_POST["choix_langs_".$i].'")'; - $db->query($sql); + $sql = "INSERT INTO `stats` (`userid`, `langue`) + VALUES('".$this->userid."',".$db->escape($this->lang_iso->any_to_iso($_POST["choix_langs_".$i])).");"; + $db->query($sql); } } } diff --git a/controllers/register.class.php b/controllers/register.class.php index 42133233abaa6f1ca5d301bc8f137b082412bf87..c90927afe8bccc012d2600502f13c3228c0b5993 100755 --- a/controllers/register.class.php +++ b/controllers/register.class.php @@ -163,8 +163,6 @@ class register $spoken_langg = explode(';',$this->spoken_lang); foreach ($spoken_langg as $key){ if($key!=""){ - array_push($sql, 'INSERT INTO `score` (`userid`, `langue`)'. - "VALUES(@USER_ID,".$db->escape((string) $key).");"); array_push($sql, "INSERT INTO `stats` (`userid`, `langue`) VALUES(@USER_ID,".$db->escape($this->lang_iso->any_to_iso($key)).");"); }