|
@@ 320-330 (lines=11) @@
|
| 317 |
|
* @param string $username Username |
| 318 |
|
* @return mixed User id matching username |
| 319 |
|
*/ |
| 320 |
|
public function get_owner_id_from_username($username) |
| 321 |
|
{ |
| 322 |
|
$sql = 'SELECT user_id |
| 323 |
|
FROM ' . USERS_TABLE . " |
| 324 |
|
WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'"; |
| 325 |
|
$result = $this->db->sql_query($sql); |
| 326 |
|
$user_id = $this->db->sql_fetchfield('user_id'); |
| 327 |
|
$this->db->sql_freeresult($result); |
| 328 |
|
|
| 329 |
|
return $user_id; |
| 330 |
|
} |
| 331 |
|
|
| 332 |
|
/** |
| 333 |
|
* Get user_id from username |
|
@@ 338-348 (lines=11) @@
|
| 335 |
|
* @param int $user_id User ID |
| 336 |
|
* @return mixed Username matching user_id |
| 337 |
|
*/ |
| 338 |
|
public function get_owner_username_from_id($user_id) |
| 339 |
|
{ |
| 340 |
|
$sql = 'SELECT username |
| 341 |
|
FROM ' . USERS_TABLE . ' |
| 342 |
|
WHERE user_id = ' . (int) $user_id; |
| 343 |
|
$result = $this->db->sql_query($sql); |
| 344 |
|
$username = $this->db->sql_fetchfield('username'); |
| 345 |
|
$this->db->sql_freeresult($result); |
| 346 |
|
|
| 347 |
|
return $username; |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
/** |
| 351 |
|
* Make sure only necessary data make their way to SQL query |