Changeset 14 for trunk/class/User.php


Ignore:
Timestamp:
Jun 19, 2012, 12:09:30 PM (13 years ago)
Author:
maron
Message:

přihlášení

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/class/User.php

    r11 r14  
    3232  function Login($Name, $Password)
    3333  {
    34           ECHO 'TES';
    3534    $DbResult = $this->Database->query('SELECT `ID` FROM `User` WHERE LOWER(`Name`) = LOWER("'.$Name.'") AND `Pass` = '.$this->CryptPasswordSQL('"'.$Password.'"', '`Salt`'));
    3635    if($DbResult->num_rows > 0)
     
    4241      $this->UpdateState();
    4342    } else $ŧhis->Role = LICENCE_ANONYMOUS;
     43  }
     44 
     45  function Register($Email,$RegUser,$RegPass,$RegPass2)
     46  {
     47         
     48         if ($RegPass != $RegPass2) return -1;
     49         
     50         $Salt = $this->GetPasswordSalt();
     51         
     52         $DbResult = $this->Database->insert('User', array(
     53         'Email' => '"'.$Email.'"',
     54         'Name' => '"'.$RegUser.'"',
     55         'Pass' => $this->CryptPasswordSQL('"'.$RegPass.'"', '"'.$Salt.'"'),
     56         'LastIP' => '"'.$_SERVER['REMOTE_ADDR'].'"',
     57         'Salt' => '"'.$Salt.'"',
     58         )
     59         );
     60         
     61         
     62          return $DbResult;
     63         
    4464  }
    4565 
     
    5777    // Security: Password and Salt hash should not be loaded to variables
    5878    $this->Id = $User['ID'];
    59     $this->Team = $User['Team'];
    6079    $this->Name = $User['Name'];
    61     $this->Role = $User['GM'];
     80    $this->Role = LICENCE_USER;
    6281    $this->Email = $User['Email'];
    6382  }
     
    86105    $this->Name = 'anonymous';
    87106    $this->Role = LICENCE_ANONYMOUS;
    88     $this->Language = 1;
    89     $this->Redirecting = 1;
    90     $this->Team = 0;
    91107    $this->Email = '';
    92108  }
Note: See TracChangeset for help on using the changeset viewer.