コード例 #1
0
 public function UpdateClient($email, $mdp, $nom, $prenom)
 {
     $con = db::getInstance();
     $req = "UPDATE  exiastore.client SET Email = '" . $email . "' , Mdp =  '" . $mdp . "' ,  Nom = '" . $nom . "' , Prenom = '" . $prenom . "' WHERE  client.Email='" . $_SESSION['user']['user_info'] . "'";
     $exec = $con->exec($req);
     return 1;
 }
コード例 #2
0
ファイル: model.cls.php プロジェクト: iquanxin/march
 public function __construct()
 {
     $this->table_pre = $this->db_config[$this->db_setting]['prefix'];
     $this->table_name = $this->table_pre . $this->table_name;
     $this->db = db::getInstance($this->db_config)->getDb($this->db_setting);
     //获取数据库抽象层mysqli_db对象实例
 }
コード例 #3
0
ファイル: m_admin_set.php プロジェクト: allok/PhpTS
 public function __construct($par = null)
 {
     if (is_null($par)) {
         $this->mysql = db::getInstance();
         if (!empty($_POST['test']) && !empty($_POST['check'])) {
             $test_id = (int) $_POST['test'];
             $sum = 0;
             foreach ($_POST['check'] as $ch) {
                 $r = $this->mysql->executeQuery("SELECT `id_set` FROM `set_to_test` WHERE `id_set`=:set_id AND `id_test`=:test_id", array(array(':test_id', $test_id, 'integer'), array(':set_id', (int) $ch, 'integer')));
                 $sum += $r['rows'];
             }
             if ($sum < 1) {
                 foreach ($_POST['check'] as $ch) {
                     $this->mysql->executeQuery("INSERT INTO `set_to_test` (`id_test`, `id_set`) VALUES (:test_id, :set_id)", array(array(':test_id', $test_id, 'integer'), array(':set_id', (int) $ch, 'integer')));
                 }
                 $this->data['alert'] = array('type' => 'success', 'mess' => array('addtotest'));
             } else {
                 $this->data['alert'] = array('type' => 'warning', 'mess' => array('testanyet'));
             }
         }
         parent::__construct('adm_menu_set');
         $r = $this->mysql->executeQuery("SELECT `id_set`, `s_name` FROM `set`");
         while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
             $this->data['set'][] = $row;
         }
         $r = $this->mysql->executeQuery("SELECT `id_test`, `t_test_name` FROM `test`");
         if ($r['rows'] >= 1) {
             while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
                 $this->data['test'][] = $row;
             }
         }
     }
 }
コード例 #4
0
 public function process()
 {
     $user = user::getInstance();
     $db = db::getInstance();
     include './models/game.class.php';
     include './models/grid.class.php';
     // récupérer le gameid
     $this->gameid = isset($_REQUEST['gameid']) ? intval($_REQUEST['gameid']) : false;
     if ($this->gameid === false) {
         trigger_error('Game not found', E_USER_ERROR);
     }
     // lecture de l'objet game
     $game = new game();
     $game->read($this->gameid);
     // création d'une nouvelle grille
     $gridtype = GRIDTYPE_ALLWORDS;
     $grid = new grid();
     $gridid = $grid->create($gridtype);
     // ajout de la grille au game
     $game->assign_grid($gridid);
     $game->start_grid($gridid);
     // enrichissement du retour json
     $res = $grid->get();
     $res->gameid = $this->gameid;
     $res->gametype = GAMETYPE_PRACTICE_ALLWORDS;
     header('Content-Type: application/json');
     echo json_encode($res);
     die;
 }
コード例 #5
0
 public function search($search_query, $critere, $theme, $type)
 {
     $con = db::getInstance();
     $req = 'SELECT * FROM Articles WHERE ' . $critere . ' LIKE \'%' . $search_query . '%\'' . $theme . $type;
     $query = $con->query($req);
     return $query->fetchAll();
 }
コード例 #6
0
    private function display()
    {
        $db = db::getInstance();
        $user = user::getInstance();
        // refuser l'invitation
        $deleteid = isset($_REQUEST['deleteid']) ? intval($_REQUEST['deleteid']) : false;
        $delete = isset($_REQUEST['delete']) ? intval($_REQUEST['delete']) : false;
        if ($delete == 1) {
            $sql = 'DELETE FROM invitations
						WHERE invitid = ' . $deleteid;
            $db->query($sql);
        }
        // invitation reçues
        $awaitings = array();
        $sql = 'SELECT i.*, u.username
					FROM invitations i, users u
					WHERE u.userid = i.fromuserid
						AND i.touserid = ' . intval($user->id);
        $result = $db->query($sql);
        while ($row = $result->fetch_assoc()) {
            $awaitings[] = $row;
        }
        // invitations envoyées
        $sents = array();
        $sql = 'SELECT i.*, u.username
					FROM invitations i, users u
					WHERE u.userid = i.touserid
						AND i.fromuserid = ' . intval($user->id);
        $result = $db->query($sql);
        while ($row = $result->fetch_assoc()) {
            $sents[] = $row;
        }
        include './views/invitations.pendings.html';
        return true;
    }
コード例 #7
0
 public function ListeDeroulanteTypeCb()
 {
     $con = db::getInstance();
     $req = "SELECT typecb FROM typecb";
     $query = $con->query($req);
     return $query->fetchAll();
 }
コード例 #8
0
 private function init()
 {
     // récupération de l'id de l'utilisateur et de sa langue étudiée
     $this->user = user::getInstance();
     $this->userlang = $this->user->langGame;
     $this->createur = $this->user->id;
     //récupération de la date au format jour/mois/année/heure
     $this->et_c_est_le_temps_qui_court = date("d/m/Y H:i");
     //récupération des points druides
     $this->pointsDr = pointsDruid;
     // récupération du formulaire de création de carte
     $this->submit = isset($_POST['submit_form']);
     if ($this->submit) {
         $this->res['mot'] = isset($_POST['mot']) ? trim($_POST['mot']) : '';
         $this->res['theme_carte'] = isset($_POST['theme_carte']) ? trim($_POST['theme_carte']) : '';
         $this->res['nivcarte'] = isset($_POST['nivcarte']) ? trim($_POST['nivcarte']) : '';
         $this->res['tabou1'] = isset($_POST['tabou1']) ? trim($_POST['tabou1']) : '';
         $this->res['tabou2'] = isset($_POST['tabou2']) ? trim($_POST['tabou2']) : '';
         $this->res['tabou3'] = isset($_POST['tabou3']) ? trim($_POST['tabou3']) : '';
         $this->res['tabou4'] = isset($_POST['tabou4']) ? trim($_POST['tabou4']) : '';
         $this->res['tabou5'] = isset($_POST['tabou5']) ? trim($_POST['tabou5']) : '';
         $this->res['tabou6'] = isset($_POST['tabou6']) ? trim($_POST['tabou6']) : '';
     }
     $db = db::getInstance();
     //A theme object would not have been bad… notimenow
     $sql = 'SELECT DISTINCT `themeFR` FROM `themes` ORDER BY `themes`.`themeFR` ASC';
     $db->query($sql);
     $this->theme_carte = array();
     while ($theme = $db->fetch_object()) {
         array_push($this->theme_carte, $theme->themeFR);
     }
     return true;
 }
コード例 #9
0
 private function check()
 {
     $db = db::getInstance();
     if (!$this->submit) {
         return false;
     }
     if (empty($this->username)) {
         $this->errors[] = 'You must enter a user name';
     }
     if (empty($this->password)) {
         $this->errors[] = 'You must enter a password';
     }
     if (!$this->errors) {
         $sql = 'SELECT *
                     FROM users
                     WHERE username = '******'userpasswd']) {
             $this->errors[] = 'The user name or the password are not a match.';
         }
     }
     if (!$this->errors) {
         $this->userid = intval($row['userid']);
     }
 }
コード例 #10
0
/**
 * @param $businessId
 * @param $shopfrontPic
 * @param $licencePic
 * @throws Exception
 */
function updateBusinessInfor($businessId, $shopfrontPic, $licencePic)
{
    $businessName = $_REQUEST['$businessName'];
    $startTime = $_REQUEST['$startTime'];
    $endTime = $_REQUEST['$endTime'];
    $lon = $_REQUEST['$lon'];
    $lat = $_REQUEST['$lat'];
    $mobilePhone = $_REQUEST['$mobilePhone'];
    $sortF = $_REQUEST['$sortF'];
    $sortS = $_REQUEST['$sortS'];
    $privileges = $_REQUEST['$privileges'];
    $description = $_REQUEST['$description'];
    $serviceindex = $_REQUEST['$serviceindex'];
    $province = $_REQUEST['$province'];
    $city = $_REQUEST['$city'];
    $addresDetail = $_REQUEST['$addresDetail'];
    $fixTelephone = $_REQUEST['$fixTelephone'];
    // 字符必须添加'',数字不必添加
    $sqlUpdate = "UPDATE\n                          `business`\n                    SET\n                          `name` = '{$businessName}',\n                          `sortF` = {$sortF},\n                          `sortS` = {$sortS},\n                          `privileges` = '{$privileges}',\n                          `picUrl` = '{$shopfrontPic}',\n                          `description` = '{$description}',\n                          `businessSTime` = {$startTime},\n                          `businessETime` = {$endTime},\n                          `licensePicUrl` = '{$licencePic}',\n                          `mobilePhone` = '{$mobilePhone}',\n                          `serviceindex` = {$serviceindex},\n                          `longitude` = {$lon},\n                          `latitude` = {$lat},\n                          `province` = {$province},\n                          `city` = {$city},\n                          `addresDetail` = '{$addresDetail}',\n                          `fixTelephone` = '{$fixTelephone}'\n                    WHERE\n                          `business`.`id` = {$businessId}";
    $connect = db::getInstance()->connect();
    $result = mysqli_query($connect, $sqlUpdate);
    if ($result) {
        echo '更新基本数据成功';
    } else {
        echo response::show(201, '更新基本数据失败');
    }
}
コード例 #11
0
    public function read($gameid)
    {
        $db = db::getInstance();
        $this->userids = array();
        $this->gameid = 0;
        $this->gametype = 0;
        $this->gamelang = '';
        $this->gamefinished = 0;
        // lecture de l'entête
        $sql = 'SELECT *
					FROM games
					WHERE gameid = ' . intval($gameid);
        $result = $db->query($sql);
        if (!($row = $result->fetch_assoc())) {
            return false;
        }
        $this->gameid = intval($row['gameid']);
        $this->gametype = intval($row['gametype']);
        $this->gamelang = intval($row['gamelang']);
        $this->gamefinished = intval($row['gamefinished']);
        // lecture des utilisateurs
        $sql = 'SELECT gu.*, u.username
					FROM gamesusers gu, users u
					WHERE gu.gameid = ' . intval($gameid) . '
						AND u.userid = gu.userid';
        $result = $db->query($sql);
        while ($row = $result->fetch_assoc()) {
            $this->userids[intval($row['userid'])] = $row['username'];
        }
        return true;
    }
コード例 #12
0
ファイル: card.class.php プロジェクト: benabri/GameOfWord
 /**
  * The constructor can either create the object from scratch, or retrieve it in the database.
  * The one parameter constructor takes the card id and picks it up in db, whereas the regular one requires one value per attribute
  */
 public function __construct($idOrLang, $extLangueOrView = NULL, $niveau = NULL, $categorie = NULL, $idDruide = NULL, $mot = NULL, $forb = NULL, $themes = NULL, $aview = NULL)
 {
     $this->db = db::getInstance();
     if (!isset($mot)) {
         //db fetch
         if (is_int($idOrLang) || $idOrLang === (string) (int) $idOrLang) {
             $this->get_from_id($idOrLang);
             $this->set_view($extLangueOrView);
         } else {
             throw new Exception("{$idOrLang} (Card ID) is not an integer…");
         }
     } else {
         //plein de paramètres
         //testing data types would not be entirely superfluous…
         $this->id = false;
         $this->lang = $idOrLang;
         $this->langPrecisions = $extLangueOrView;
         $this->level = $niveau;
         $this->cat = $categorie;
         $this->author = $idDruide;
         $this->guessWord = $mot;
         /*getting unique values in a simple array (good to prevent duplicate key errors later on)*/
         $this->themes = array_keys(array_flip($themes));
         $this->forbiddenWords = array_keys(array_flip($forb));
         $this->set_view($aview);
     }
 }
コード例 #13
0
 public function select_all()
 {
     $con = db::getInstance();
     $req = "SELECT * FROM Articles";
     $query = $con->query($req);
     return $query->fetch();
 }
コード例 #14
0
 public function InsertInscriptionAdresse($email, $adresse, $ville, $cp)
 {
     $con = db::getInstance($email, $adresse, $ville, $cp);
     $req = "INSERT INTO adresses (ID_Client, Adresse, Ville, CP) VALUES ((SELECT ID_Client FROM client WHERE Email = '" . $email . "'),'" . $adresse . "', '" . $ville . "', " . $cp . ")";
     $exec = $con->exec($req);
     return 1;
 }
コード例 #15
0
ファイル: m_admin_users.php プロジェクト: allok/PhpTS
 public function __construct($par = null)
 {
     $this->mysql = db::getInstance();
     if (!empty($_POST['train']) && !empty($_POST['group']) && !empty($_POST['id'])) {
         $this->mysql->executeQuery("UPDATE `user` SET `id_group`=:group WHERE `id_user`=:user_id", array(array(':group', (int) $_POST['group'], 'integer'), array(':user_id', (int) $_POST['id'], 'integer')));
         $this->data['alert'] = array('type' => 'success', 'mess' => array('userupdate'));
     }
     if (is_null($par)) {
         if (!empty($_POST['check']) && !empty($_POST['group'])) {
             $gr_id = (int) $_POST['group'];
             $sum = 0;
             foreach ($_POST['check'] as $ch) {
                 $r = $this->mysql->executeQuery("SELECT `id_user` FROM `user_to_group` WHERE `id_user`=:user_id AND `id_student_group`=:group_id", array(array(':user_id', (int) $ch, 'integer'), array(':group_id', $gr_id, 'integer')));
                 $sum += $r['rows'];
             }
             if ($sum < 1) {
                 foreach ($_POST['check'] as $ch) {
                     $this->mysql->executeQuery("INSERT INTO `user_to_group` (`id_user`, `id_student_group`) VALUES (:user_id, :group_id)", array(array(':user_id', (int) $ch, 'integer'), array(':group_id', $gr_id, 'integer')));
                 }
                 $this->data['alert'] = array('type' => 'success', 'mess' => array('addtogroup'));
             } else {
                 $this->data['alert'] = array('type' => 'warning', 'mess' => array('user_yet_gr'));
             }
         }
         parent::__construct('adm_tabs_users');
         $r = $this->mysql->executeQuery("SELECT `id_user`, `u_username`, `u_name`,`u_sname`,`id_group`, `u_reg_date` FROM `user`");
         while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
             $this->data['users'][$row['id_user']] = $row;
             $this->data['users'][$row['id_user']]['u_training_name'] = '-';
             $this->data['users'][$row['id_user']]['u_reg_date'] = date("d.m.y G:i", $this->data['users'][$row['id_user']]['u_reg_date']);
         }
         $r = $this->mysql->executeQuery("SELECT `id_user`, `sg_name` FROM `user_to_group` JOIN `student_group` USING (`id_student_group`) ");
         while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
             $this->data['users'][$row['id_user']]['u_training_name'] = $row['sg_name'];
         }
         $r = $this->mysql->executeQuery("SELECT `id_student_group`, `sg_name` FROM `student_group`");
         if ($r['rows'] >= 1) {
             while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
                 $this->data['group'][] = $row;
             }
         }
     } else {
         parent::__construct('adm_smen_uconf');
         $id = (int) $par;
         $r = $this->mysql->executeQuery("SELECT `u_username`, `u_name`,`u_sname` FROM `user` WHERE `id_user`=:user_id LIMIT 1", array(array(':user_id', $id, 'integer')));
         if ($r['rows'] === 1) {
             foreach ($r['stmt']->fetch(PDO::FETCH_ASSOC) as $k => $v) {
                 $this->data[$k] = $v;
             }
             $r = $this->mysql->executeQuery("SELECT `id_student_group`, `sg_name` FROM `student_group`");
             while ($row = $r['stmt']->fetch(PDO::FETCH_ASSOC)) {
                 $this->data['stud_group'][] = $row;
             }
             $this->data['id'] = $id;
         } else {
             header('Location: ' . DIRURL . 'admin/users');
         }
     }
 }
コード例 #16
0
    public function read()
    {
        $db = db::getInstance();
        $sql = 'SELECT * FROM results
					ORDER BY resultid
					DESC LIMIT 1';
        $db->query($sql);
    }
コード例 #17
0
ファイル: ctrl.php プロジェクト: barkalovys/banlist
 public function __construct()
 {
     $this->db = db::getInstance();
     // 		if (isset($_SESSION['user'])) {
     // 			$this->user = true;
     // 			if ($_SESSION['user']['user_type'] == 'admin') $this->admin = true;
     // 		}
 }
コード例 #18
0
ファイル: engine.php プロジェクト: Ashaan/phpgallery
 public function __construct($option = '')
 {
     if ($option == 'AJAX_SESSION') {
         $this->ajax = true;
     }
     $db = db::getInstance();
     session::getInstance();
 }
コード例 #19
0
ファイル: model.php プロジェクト: Enrage/lean-center
 public function __construct()
 {
     $this->db = db::getInstance();
     $this->met = new method();
     if (isset($_SESSION['auth']['user'])) {
         $this->user_id = $_SESSION['auth']['user_id'];
     }
 }
コード例 #20
0
ファイル: template.php プロジェクト: Ashaan/phpcv
 /**
  * Constructeur
  *
  * @param string $name
  */
 public function __construct($name)
 {
     $this->name = $name;
     if (class_exists('db')) {
         $this->db = db::getInstance();
     } else {
         $this->db = null;
     }
 }
コード例 #21
0
 function initNotif()
 {
     //Récupération des informaions de base: userid
     $this->user = user::getInstance();
     //connexion à la BD
     $this->db = db::getInstance();
     $this->time = date('Y-m-d H:i:s');
     return true;
 }
コード例 #22
0
ファイル: tests.php プロジェクト: Enrage/lean-center
 public function __construct()
 {
     $this->db = db::getInstance();
     $this->date = time();
     $this->met = new method();
     $this->id = $_SESSION['auth']['user_id'] ?? null;
     $this->name = $_SESSION['auth']['user'] ?? null;
     $this->email = $_SESSION['auth']['email'] ?? null;
 }
コード例 #23
0
ファイル: login.class.php プロジェクト: abdouh/pets
 function valid_attempt()
 {
     $table = db::$tables['login_attempts'];
     $query = "DELETE FROM {$table} WHERE `user_id` = '{$this->user_data['id']}'";
     $stmt = db::getInstance()->query($query);
     $table = db::$tables['users'];
     $query = "UPDATE {$table} SET `is_blocked` = 0 WHERE `id` = '{$this->user_data['id']}'";
     $stmt = db::getInstance()->query($query);
 }
コード例 #24
0
    private function insert_wordofday()
    {
        $db = db::getInstance();
        $user = user::getInstance();
        $sql = 'INSERT INTO wordofday
					(userid, wordofdayword, wordofdaydate, wordofdaylang)
					VALUES ( ' . intval($user->id) . ', ' . $db->escape((string) $this->random_word) . ', ' . intval($this->current_day) . ', ' . $db->escape((string) $this->userlang) . ')';
        $db->query($sql);
    }
コード例 #25
0
    public function create($userid, $gameid, $gridid, $word, $wordexists, $wordpoints)
    {
        $db = db::getInstance();
        $sql = 'INSERT INTO gamesuserswords
					(userid, gameid, gridid, word, wordexists, wordpoints)
					VALUES (' . intval($userid) . ', ' . intval($gameid) . ', ' . intval($gridid) . ', ' . $db->escape((string) $word) . ', ' . intval($wordexists) . ', ' . intval($wordpoints) . '
					)';
        $db->query($sql);
        return true;
    }
コード例 #26
0
ファイル: class.search.php プロジェクト: sbrilenko/gea
 public function __construct($table, $fieldsearch, $fieldpopular, $orderBy = 'id DESC', $limit = 50, $and = '')
 {
     $this->_db = db::getInstance();
     $this->_table = $table;
     $this->_fieldsearch = $fieldsearch;
     $this->_fieldpopular = $fieldpopular;
     $this->_limit = $limit;
     $this->_orderBy = $orderBy;
     $this->_and = $and;
 }
コード例 #27
0
    public function read()
    {
        $db = db::getInstance();
        $user = user::getInstance();
        $sql = 'SELECT * FROM wordbox
					ORDER BY wordboxword
					WHERE userid = ' . intval($user->id) . '
						AND wordboxlang = ' . $db->escape((string) $this->wordboxlang);
        $db->query($sql);
    }
コード例 #28
0
ファイル: m_signin.php プロジェクト: allok/PhpTS
 private static function processLoginByCookie()
 {
     $mysql = db::getInstance();
     $r = $mysql->executeQuery("SELECT `id_user`, `u_name`, `u_sname`, `id_group` FROM `user` WHERE `u_hash`=:remember LIMIT 1", array(array(':remember', $_COOKIE['remember'])));
     if ($r['rows'] === 1) {
         $user_data = $r['stmt']->fetch(PDO::FETCH_ASSOC);
         return $user_data;
     } else {
         return false;
     }
 }
コード例 #29
0
ファイル: model.php プロジェクト: Enrage/lean-center
 public function __construct()
 {
     $this->db = db::getInstance();
     $this->met = new method();
     $this->visible = '1';
     $this->razdel = '1';
     $this->now_date = time();
     $this->activation = '0';
     $this->mail = new Mail();
     $this->user_id = $_SESSION['auth']['user_id'] ?? null;
 }
コード例 #30
0
ファイル: user.class.php プロジェクト: AlternaCraft/MCGestor
 public static function getRankValue($rankname)
 {
     $db = db::getInstance();
     $req = $db->prepare("select rank from roles where name like :rolename", array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
     $req->execute(array(':rolename' => $rankname));
     if (!($resul = $req->fetch(PDO::FETCH_ASSOC))) {
         return false;
     } else {
         return $resul['rank'];
     }
 }