-
Notifications
You must be signed in to change notification settings - Fork 3
/
update_userlang_game.php
executable file
·60 lines (57 loc) · 1.63 KB
/
update_userlang_game.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
session_start();
require_once("models/user.class.php");
require_once("sys/db.class.php");
require_once('./controllers/notificationMessage.php');
require('./models/userlvl.class.php');
require('./languages/language.php');
$user = user::getInstance();
$db = db::getInstance();
if(isset($_GET['page_not'])){
$role = strtolower($_GET['page_not']);
if($role == "devin"){
$role="diviner";
}
$role = "./profil/$role.jpg";
if(isset($_GET['userlang_game'])){
require_once('./sys/load_iso.php');
$lang_iso = new IsoLang();
$sql = "UPDATE user SET userlang_game ='"
. $_GET['userlang_game']
. "' WHERE userid = '" . intval($user->id)."'";
echo $sql;
if ($db->query($sql)){
echo "update success";
$mess = $_GET['page_not']." : ".$lang["languePlay"].$lang_iso->french_for($_GET['userlang_game']);
$notif = new Notification();
$notif->addNotifGAME($user->id,$mess,$role);
}
else {
echo "update fails";
}
$_SESSION["langDevin"] = $_GET['userlang_game'];
}
elseif (isset($_GET['game_lvl'])) {
$sql = "UPDATE `user` SET `userlvl` ='"
. $_GET['game_lvl']
. "' WHERE userid = '" . intval($user->id)."'";
echo $sql;
if ($db->query($sql)){
echo "update success";
$mess = $_GET['page_not']." : ".$lang["levelChange"].$lang["level_".$_GET['game_lvl']]."→".$lang[$_GET['page_not']."_".$_GET['game_lvl']];
$notif = new Notification();
$notif->addNotifGAME($user->id,$mess,$role);
}
else {
echo "update fails";
}
$_SESSION["langDevin"] = $_GET['userlang_game'];
}
else{
echo "no query...";
}
}
else{
echo "missing origin…";
}
?>