Beispiel #1
0
function ryzom_authenticate_with_char_and_password($character, $password, &$cid)
{
    $db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING);
    $char = $db->escape_string($character);
    $sql = "SELECT char_id, char_name, user_id, home_mainland_session_id FROM characters WHERE char_name = '{$char}'";
    $row = $db->query_single_row($sql);
    $character = $row['char_name'];
    $cid = $row['char_id'];
    $uid = $row['user_id'];
    $db->select_db('nel');
    $sql = "SELECT Password FROM user WHERE UId = {$uid}";
    $row = $db->query_single_row($sql);
    $ok = $row['Password'] == crypt($password, $row['Password']);
    return $ok;
}
Beispiel #2
0
function ryzom_authenticate_with_char_and_password($character, $password, &$cid)
{
    $db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING);
    $char = $db->escape_string($character);
    $schar = explode('@', $char);
    $_SESSION['dev_shard'] = 0;
    if (count($schar) == 2 && $schar[1] == RYAPI_DEV_SHARD) {
        $_SESSION['dev_shard'] = 1;
        $char = $schar[0];
        $db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING_DEV);
    }
    $sql = "SELECT char_id, char_name, user_id, home_mainland_session_id FROM characters WHERE char_name = '{$char}'";
    $row = $db->query_single_row($sql);
    $character = $row['char_name'];
    $cid = $row['char_id'];
    $uid = $row['user_id'];
    $db->select_db('nel');
    $sql = "SELECT Password FROM user WHERE UId = {$uid}";
    $row = $db->query_single_row($sql);
    $ok = $row['Password'] == crypt($password, $row['Password']);
    return $ok;
}