Your IP : 216.73.216.48


Current Path : /var/www/sick/test/includes/libs/
Upload File :
Current File : //var/www/sick/test/includes/libs/Users.class.php

<?php

class Users {

    private $_dbAdapter;
    private $_table;

    public function __construct() {
        $this->_dbAdapter = new MySQL();
        $this->_table = TABLE_PREFIX . 'users';
    }

    public function checkUser($username, $password) {
        $select = $this->_dbAdapter->runQuery('SELECT * FROM ' . $this->_table . '
            WHERE username="' . $username . '" AND password="' . sha1($password) . '"');

        if ($this->_dbAdapter->countRows($select) > 0) {
            return true;
        } else {
            return false;
        }
    }

    public function addUser($username, $email, $password) {
        return $this->_dbAdapter->runQuery('INSERT INTO ' . $this->_table . '
            (username, email, password, date_registered)
            VALUES ("' . $username . '","' . $email . '","' . sha1($password) . '","' . time() . '")');
    }

}