Changeset 674 for trunk/lib


Ignore:
Timestamp:
May 2, 2019 10:17:26 PM (5 years ago)
Author:
anonymous
Message:

Add user.cli.php and supporting changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Auth_SQL.inc.php

    r671 r674  
    896896    }
    897897
     898    /**
     899     * Returns a user_id for a specified username.
     900     *
     901     * @param  string  $username    Username to look for.
     902     * @return string               User_id, or false if none found.
     903     */
     904    public function getUserID($username)
     905    {
     906        $db =& DB::getInstance();
     907
     908        $this->initDB();
     909
     910        $qid = $db->query("
     911            SELECT " . $this->_params['db_primary_key'] . "
     912            FROM " . $this->_params['db_table'] . "
     913            WHERE " . $this->_params['db_username_column'] . " = '" . $db->escapeString($username) . "'
     914        ");
     915        if (list($user_id) = mysql_fetch_row($qid)) {
     916            return $user_id;
     917        } else {
     918            return false;
     919        }
     920    }
     921
    898922    /*
    899923    * Generate a cryptographically secure, random password.
Note: See TracChangeset for help on using the changeset viewer.