mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add uid_from_email(), similar to uid_from_username
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
parent
6ee8b88c58
commit
6d65997f0c
1 changed files with 20 additions and 1 deletions
|
@ -404,6 +404,25 @@ function uid_from_username($username="")
|
|||
return $row[0];
|
||||
}
|
||||
|
||||
# obtain the uid given a Users.Email
|
||||
#
|
||||
function uid_from_email($email="")
|
||||
{
|
||||
if (!$email) {
|
||||
return "";
|
||||
}
|
||||
$dbh = db_connect();
|
||||
$q = "SELECT ID FROM Users WHERE Email = '".mysql_real_escape_string($email)
|
||||
."'";
|
||||
$result = db_query($q, $dbh);
|
||||
if (!$result) {
|
||||
return "None";
|
||||
}
|
||||
$row = mysql_fetch_row($result);
|
||||
|
||||
return $row[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate clean url with edited/added user values
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue