Commit 2ea7a758 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Minor cleanup; get rid of unused DB field accesses.

parent d8b38f19
......@@ -31,7 +31,6 @@ if ($uid) {
$usr_addr = $row[usr_addr];
$usr_name = $row[usr_name];
$usr_phone = $row[usr_phone];
$usr_passwd = $row[usr_pswd];
$usr_title = $row[usr_title];
$usr_affil = $row[usr_affil];
......
......@@ -594,6 +594,21 @@ function TBUserInfo($uid, &$user_name, &$user_email)
$user_email = $row[usr_email];
}
#
# Confirm a current user or not.
#
# usage TBCurrentUser($uid)
# returns 1 if a valid user.
# returns 0 if not a valid user.
#
function TBCurrentUser($uid)
{
$query_result =
DBQueryFatal("SELECT usr_pswd FROM users WHERE uid='$uid'");
return mysql_num_rows($query_result);
}
#
# Confirm a valid pid/gid
#
......@@ -886,7 +901,7 @@ function TBExpUidLastLogins($pid, $eid)
}
#
#
# Number of globally free PCs.
#
function TBFreePCs()
{
......@@ -900,6 +915,20 @@ function TBFreePCs()
return mysql_num_rows($query_result);
}
function TBUserPCs($uid)
{
$query_result =
DBQueryFatal("select a.node_id from nodes as a ".
"left join reserved as b on a.node_id=b.node_id ".
"left join node_types as nt on a.type=nt.type ".
"left join experiments as e on b.pid=e.pid and ".
" b.eid=e.eid ".
"where e.expt_head_uid='$uid' and e.pid!='emulab-ops' ".
" and a.role='testnode' and a.type like 'pc%'");
return mysql_num_rows($query_result);
}
#
# DB Interface.
#
......
......@@ -68,7 +68,6 @@ $usr_URL = $row[usr_URL];
$usr_addr = $row[usr_addr];
$usr_name = $row[usr_name];
$usr_phone = $row[usr_phone];
$usr_passwd = $row[usr_pswd];
$usr_title = $row[usr_title];
$usr_affil = $row[usr_affil];
......@@ -170,7 +169,7 @@ echo "<h4><blockquote><blockquote>
<dl COMPACT>
<dt>[1]
<dd>Please consult our
<a href = 'docwrapper.php3?docname=security.html'>
<a href='docwrapper.php3?docname=security.html'>
security policies</a> for information
regarding passwords and email addresses.
</dl>
......
......@@ -178,15 +178,7 @@ if (mysql_num_rows($query_result)) {
#
# See if this is a new user or one returning.
#
$pswd_result =
DBQueryFatal("SELECT usr_pswd FROM users WHERE uid='$proj_head_uid'");
if ($row = mysql_fetch_row($pswd_result)) {
$returning = 1;
}
else {
$returning = 0;
}
$returning = TBCurrentUser($proj_head_uid);
#
# If a user returning, then the login must be valid to continue any further.
......
......@@ -101,7 +101,6 @@ $usr_URL = $row[usr_URL];
$usr_addr = $row[usr_addr];
$usr_name = $row[usr_name];
$usr_phone = $row[usr_phone];
$usr_passwd = $row[usr_pswd];
$usr_title = $row[usr_title];
$usr_affil = $row[usr_affil];
......
......@@ -282,7 +282,6 @@ function SHOWUSER($uid) {
$usr_addr = $row[usr_addr];
$usr_name = $row[usr_name];
$usr_phone = $row[usr_phone];
$usr_passwd = $row[usr_pswd];
$usr_title = $row[usr_title];
$usr_affil = $row[usr_affil];
$status = $row[status];
......
......@@ -101,18 +101,7 @@ $usr_phone = addslashes($usr_phone);
#
# See if this is a new user or one returning.
#
$query_result = mysql_db_query($TBDBNAME,
"SELECT usr_pswd FROM users WHERE uid=\"$joining_uid\"");
if (! $query_result) {
$err = mysql_error();
TBERROR("Database Error retrieving info for $joining_uid: $err\n", 1);
}
if (mysql_num_rows($query_result) > 0) {
$returning = 1;
}
else {
$returning = 0;
}
$returning = TBCurrentUser($joining_uid);
#
# If a user returning, then the login must be valid to continue any further.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment