Ignore:
Timestamp:
Nov 25, 2008, 5:12:10 PM (16 years ago)
Author:
maron
Message:

Struktura databáze

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3/class/user.php

    r34 r38  
    22
    33  class user
    4   { // BEGIN class User
     4  { // BEGIN class user
    55        // variables
    66        var $ID,$user,$Database;
    7           var $AnonymousUserId = 0;
     7          var $AnonymoususerId = 0;
    88        var $DefaultRole = 2;
    99        var $IPAddress = ' ';
     
    2222    $this->IPAddress = gethostbyaddr($_SERVER['REMOTE_ADDR']).' '.$_SERVER['REMOTE_ADDR'];
    2323    // Lookup user record
    24     $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
     24    $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"');
    2525    if($this->Database->LastDataSet)
    2626    {
    2727      // Refresh time of last access
    28       $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('Time' => 'NOW()','IpAddress' => $this->IPAddress));
     28      $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('Time' => 'NOW()','IpAddress' => $this->IPAddress));
    2929    } else {
    30      $this->Database->insert('UserOnline', array('SessionId' => $SID, 'User' => $this->AnonymousUserId, 'Time' => 'NOW()', 'IpAddress' => $this->IPAddress)); 
     30     $this->Database->insert('useronline', array('SessionId' => $SID, 'user' => $this->AnonymoususerId, 'Time' => 'NOW()', 'IpAddress' => $this->IPAddress)); 
    3131    }
    3232    // Odeber neaktivní uživatele
    33     $this->Database->delete('UserOnline', 'Time < DATE_SUB(NOW(), INTERVAL '.USER_TIMEOUT.' SECOND)');
     33    $this->Database->delete('useronline', 'Time < DATE_SUB(NOW(), INTERVAL '.USER_TIMEOUT.' SECOND)');
    3434
    3535    // Zkontroluj přihlášení
    36     $Query = $this->Database->select('UserOnline', '*', 'SessionId="'.$SID.'"');
     36    $Query = $this->Database->select('useronline', '*', 'SessionId="'.$SID.'"');
    3737    $Row = $Query->fetch_array();
    38     if($Row['User'] != $this->AnonymousUserId)
     38    if($Row['user'] != $this->AnonymoususerId)
    3939    {
    40       $Query = $this->Database->select('User', '*', "Id=".$Row['User']."");
     40      $Query = $this->Database->select('user', '*', "Id=".$Row['user']."");
    4141      $this->user = $Query->fetch_array();
    4242      $Result = USER_LOGGED;
    4343      $this->LoadPermission($this->user['Permission']);
    4444    } else {
    45       $Query = $this->Database->select('User', '*', "Id=".$this->AnonymousUserId);
     45      $Query = $this->Database->select('user', '*', "Id=".$this->AnonymoususerId);
    4646      $this->user = $Query->fetch_array();
    4747      $Result = USER_NOT_LOGGED;
     
    6060    {
    6161      // Je uživatel registrován?
    62       $Query = $this->Database->select('User', '*', 'Name = "'.$Data['Nick'].'"');
     62      $Query = $this->Database->select('user', '*', 'Name = "'.$Data['Nick'].'"');
    6363      if($this->Database->LastDataSet) $Result = NICK_USED;
    6464      else
    6565      {
    66         $this->Database->insert('User', array('Name' => addslashes($Data['Nick']), 'FullName' => addslashes($Data['FullName']), 'Password' => addslashes($Data['Password']), 'Email' => htmlspecialchars($Data['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Data['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()'));
     66        $this->Database->insert('user', array('Name' => addslashes($Data['Nick']), 'FullName' => addslashes($Data['FullName']), 'Password' => addslashes($Data['Password']), 'Email' => htmlspecialchars($Data['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Data['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()'));
    6767      //echo $this->Database->LastQuery;
    6868        $Result = USER_REGISTRATED;
     
    7676    $SID = session_id();
    7777    // Je uživatel registrován?
    78     $Query = $this->Database->select('User', '*', 'Name="'.$Data['Nick'].'"');
     78    $Query = $this->Database->select('user', '*', 'Name="'.$Data['Nick'].'"');
    7979    if($Query->num_rows > 0)
    8080    {
     
    8383      else
    8484      {
    85         $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => $this->IPAddress));   
    86         $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id']));
     85        $this->Database->update('user', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => $this->IPAddress));   
     86        $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('user' => $Row['Id']));
    8787        // načtení stavu stromu
    8888        $Result = USER_LOGGED_IN;   
     
    9797  {
    9898    $SID = session_id();
    99     $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $this->AnonymousUserId));
     99    $this->Database->update('useronline', 'SessionId="'.$SID.'"', array('user' => $this->AnonymoususerId));
    100100    $this->Check();
    101101    return(USER_LOGGED_OUT);
     
    105105  {
    106106    $this->user['Permission'] = array();
    107     $DbResult = $this->Database->select('Permission','*','ID='.$Permission);
     107    $DbResult = $this->Database->select('permission','*','ID='.$Permission);
    108108    if($this->Database->LastDataSet)
    109109    while($DbRow = $DbResult->fetch_array())
     
    121121  } // END function Permission
    122122 
    123   } // END class User
     123  } // END class user
    124124 
    125125?>
Note: See TracChangeset for help on using the changeset viewer.