Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
GameOfWords
Commits
d8f183eb
Commit
d8f183eb
authored
May 10, 2017
by
Mathieu Loiseau
Browse files
Add languages and get stats
parent
7e528388
Changes
2
Hide whitespace changes
Inline
Side-by-side
controllers/edit.class.php
View file @
d8f183eb
...
...
@@ -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 s
core
FROM s
tats
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
);
}
}
}
...
...
controllers/register.class.php
View file @
d8f183eb
...
...
@@ -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
))
.
");"
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment