Changeset 11 for trunk/class/User.php


Ignore:
Timestamp:
Jun 19, 2012, 10:26:04 AM (13 years ago)
Author:
maron
Message:

zachytávání zpráv

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/class/User.php

    r10 r11  
    2020  function __construct($Database)
    2121  {
     22        $this->Database =  $Database;
    2223    if(isset($_SESSION)) $this->Restore();   
    2324      else $this->SetAnonymous();
     
    3132  function Login($Name, $Password)
    3233  {
    33         global $Database;
    34     $DbResult = $Database->query('SELECT `ID` FROM `User` WHERE LOWER(`Name`) = LOWER("'.$Name.'") AND `Pass` = '.$this->CryptPasswordSQL('"'.$Password.'"', '`Salt`'));
     34          ECHO 'TES';
     35    $DbResult = $this->Database->query('SELECT `ID` FROM `User` WHERE LOWER(`Name`) = LOWER("'.$Name.'") AND `Pass` = '.$this->CryptPasswordSQL('"'.$Password.'"', '`Salt`'));
    3536    if($DbResult->num_rows > 0)
    3637    {
     
    4647  {
    4748    if($this->Role != LICENCE_ANONYMOUS)
    48       $this->System->Database->query('UPDATE `User` SET `LastLogout` = NOW() WHERE `ID` = '.$this->Id);
     49      $this->Database->query('UPDATE `User` SET `LastLogout` = NOW() WHERE `ID` = '.$this->Id);
    4950    $this->SetAnonymous();
    5051  }
     
    5253  function Load()
    5354  {
    54     $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$this->Id);
     55    $DbResult = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$this->Id);
    5556    $User = $DbResult->fetch_assoc();
    5657    // Security: Password and Salt hash should not be loaded to variables
     
    110111  {
    111112    if(array_key_exists('REMOTE_ADDR', $_SERVER))
    112       $this->System->Database->query('UPDATE `User` SET `LastIP` = "'.$_SERVER['REMOTE_ADDR'].'", `LastLogin` = NOW() WHERE `ID` = '.$this->Id);
     113      $this->Database->query('UPDATE `User` SET `LastIP` = "'.$_SERVER['REMOTE_ADDR'].'", `LastLogin` = NOW() WHERE `ID` = '.$this->Id);
    113114  }
    114115}
Note: See TracChangeset for help on using the changeset viewer.