Advertisement
Guest User

Untitled

a guest
Aug 24th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.36 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * WebControlSystem V1.0
  5.  * Credits to Steve Winfield
  6.  *
  7.  * All rights reserved.
  8. **/
  9. if (!defined ('ON_PAGE'))
  10.     exit ('Access not allowed.');
  11.  
  12. /**
  13.  * @seel model
  14. **/
  15. class User_Model extends Security_Model {
  16.    
  17.     public function __construct() {
  18.         parent::__construct();
  19.     }
  20.    
  21.     public function updateUserMotto($id, $motto) {
  22.         if (!$this->driver->connected)
  23.             $this->driver->connect();
  24.         if ($stm = $this->driver->prepare('UPDATE users SET motto = ? WHERE id = '. (int)$id)) {
  25.             $stm->bind_param('s', $motto);
  26.             $stm->execute();
  27.         } else {
  28.             Core::error($this->driver->error);
  29.         }
  30.     }
  31.    
  32.     public function setUser($user, $userId, $userPass) {
  33.         if (!$this->driver->connected)
  34.             $this->driver->connect();
  35.         if ($stm = $this->driver->prepare('SELECT id, username, real_name, password, look, credits, activity_points, vip_points, motto FROM users WHERE id = ? AND password = ? ORDER BY id DESC LIMIT 1')) {
  36.             $stm->bind_param('is', $userId, $userPass);
  37.             $stm->execute();
  38.             $stm->store_result();
  39.             if ($stm->num_rows > 0) {
  40.                 $stm->bind_result($user->Id, $user->Name, $user->RealName, $user->Password, $user->Figure, $user->Credits, $user->Pixels, $user->Shells, $user->Motto);
  41.                 $stm->fetch();
  42.                 return TRUE;
  43.             } else {
  44.                 return FALSE;
  45.             }
  46.         } else {
  47.             Core::error ($this->driver->error);
  48.             return FALSE;
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement