|
@@ 307-317 (lines=11) @@
|
| 304 |
|
* @param string $username Username |
| 305 |
|
* @return mixed User id matching username |
| 306 |
|
*/ |
| 307 |
|
public function get_owner_id_from_username($username) |
| 308 |
|
{ |
| 309 |
|
$sql = 'SELECT user_id |
| 310 |
|
FROM ' . USERS_TABLE . " |
| 311 |
|
WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'"; |
| 312 |
|
$result = $this->db->sql_query($sql); |
| 313 |
|
$user_id = $this->db->sql_fetchfield('user_id'); |
| 314 |
|
$this->db->sql_freeresult($result); |
| 315 |
|
|
| 316 |
|
return $user_id; |
| 317 |
|
} |
| 318 |
|
|
| 319 |
|
/** |
| 320 |
|
* Get user_id from username |
|
@@ 325-335 (lines=11) @@
|
| 322 |
|
* @param int $user_id User ID |
| 323 |
|
* @return mixed Username matching user_id |
| 324 |
|
*/ |
| 325 |
|
public function get_owner_username_from_id($user_id) |
| 326 |
|
{ |
| 327 |
|
$sql = 'SELECT username |
| 328 |
|
FROM ' . USERS_TABLE . ' |
| 329 |
|
WHERE user_id = ' . (int) $user_id; |
| 330 |
|
$result = $this->db->sql_query($sql); |
| 331 |
|
$username = $this->db->sql_fetchfield('username'); |
| 332 |
|
$this->db->sql_freeresult($result); |
| 333 |
|
|
| 334 |
|
return $username; |
| 335 |
|
} |
| 336 |
|
|
| 337 |
|
/** |
| 338 |
|
* Make sure only necessary data make their way to SQL query |