diff --git a/www/approveproject_list.php3 b/www/approveproject_list.php3 index 78b1dc8e1fd81c2cb0004aeb899ded8a33681d37..35b35158be6d70a822dda522a2dcf09f495db740 100755 --- a/www/approveproject_list.php3 +++ b/www/approveproject_list.php3 @@ -27,12 +27,7 @@ if (! $isadmin) { # implies denying the project leader account, when there is just a single # project pending for that project leader. # -$query_result = mysql_db_query($TBDBNAME, - "SELECT * from projects where approved='0'"); -if (! $query_result) { - $err = mysql_error(); - TBERROR("Database Error getting unapproved project list: $err\n", 1); -} +$query_result = DBQueryFatal("SELECT * from projects where approved='0'"); if (mysql_num_rows($query_result) == 0) { USERERROR("There are no projects to approve!", 1); } @@ -65,8 +60,8 @@ while ($projectrow = mysql_fetch_array($query_result)) { $Purl = $projectrow[URL]; $Pname = $projectrow[name]; - $userinfo_result = mysql_db_query($TBDBNAME, - "SELECT * from users where uid=\"$headuid\""); + $userinfo_result = + DBQueryFatal("SELECT * from users where uid='$headuid'"); $row = mysql_fetch_array($userinfo_result); $name = $row[usr_name]; diff --git a/www/dbdefs.php3.in b/www/dbdefs.php3.in index 64f7fef01877d86c463f14164beb05b17416cde7..7f7526644c2128e3cc77bc3eadf0764b867a7344 100644 --- a/www/dbdefs.php3.in +++ b/www/dbdefs.php3.in @@ -1195,8 +1195,9 @@ function DBQuery($query) { global $TBDBNAME; global $DBErrorString; + global $DBlinkid; - $result = mysql_db_query($TBDBNAME, $query); + $result = mysql_query($query, $DBlinkid); if (! $result) { $DBErrorString = diff --git a/www/nodemon.php3 b/www/nodemon.php3 index 2125b8c260edfc449c43017133256d79abd59fbc..482215a8e4a0d896c94d396bbdd393fcfade3d4c 100644 --- a/www/nodemon.php3 +++ b/www/nodemon.php3 @@ -15,12 +15,7 @@ if (!isset($nid) || } $pid = addslashes($pid); -$query_result = mysql_db_query($TBDBNAME, - "SELECT * from wires where node_id1='$nid'"); -if (! $query_result) { - $err = mysql_error(); - TBERROR("Database Error getting node information: $err\n", 1); -} +$query_result = DBQueryFatal("SELECT * from wires where node_id1='$nid'"); echo "<table border=1 padding=1>\n"; echo "<tr> diff --git a/www/nodemon_all.php3 b/www/nodemon_all.php3 index ecbc9db35550988f757b33ff256e1cb2ccfcdb81..b7fbd38ec5a60f979421af996db3bbe443c61bf7 100644 --- a/www/nodemon_all.php3 +++ b/www/nodemon_all.php3 @@ -15,12 +15,7 @@ if (!isset($nid) || } $pid = addslashes($pid); -$query_result = mysql_db_query($TBDBNAME, - "SELECT * from wires where node_id1='$nid'"); -if (! $query_result) { - $err = mysql_error(); - TBERROR("Database Error getting node information: $err\n", 1); -} +$query_result = DBQueryFatal("SELECT * from wires where node_id1='$nid'"); echo "<table border=1 padding=1>\n"; echo "<tr> diff --git a/www/projectlist.php3 b/www/projectlist.php3 index e0364884982b06f9d13e27804fbecbeb60611849..dbd1769a2a98cbbe38b7fb749278d856e51ab103 100644 --- a/www/projectlist.php3 +++ b/www/projectlist.php3 @@ -51,15 +51,11 @@ function GENPLIST ($query_result) # # Get the "active" project list. # -$query_result = mysql_db_query($TBDBNAME, - "SELECT pid,name,URL,usr_affil FROM projects ". - "left join users on projects.head_uid=users.uid ". - "where public=1 and approved=1 and expt_count>0 order by name"); - -if (! $query_result) { - $err = mysql_error(); - TBERROR("Database Error getting active project list: $err\n", 1); -} +$query_result = + DBQueryFatal("SELECT pid,name,URL,usr_affil FROM projects ". + "left join users on projects.head_uid=users.uid ". + "where public=1 and approved=1 and expt_count>0 ". + "order by name"); echo "<table width=\"100%\" border=0 cellpadding=2 cellspacing=2 align='center'>\n"; @@ -71,15 +67,11 @@ if (mysql_num_rows($query_result)) { # # Get the "inactive" project list. # -$query_result = mysql_db_query($TBDBNAME, - "SELECT pid,name,URL,usr_affil FROM projects ". - "left join users on projects.head_uid=users.uid ". - "where public=1 and approved=1 and expt_count=0 order by name"); - -if (! $query_result) { - $err = mysql_error(); - TBERROR("Database Error getting inactive project list: $err\n", 1); -} +$query_result = + DBQueryFatal("SELECT pid,name,URL,usr_affil FROM projects ". + "left join users on projects.head_uid=users.uid ". + "where public=1 and approved=1 and expt_count=0 ". + "order by name"); if (mysql_num_rows($query_result)) { echo "<tr></tr>\n"; diff --git a/www/showproject.php3 b/www/showproject.php3 index 0928764d4470af922eaf3e8cdfcb1f1c5d1cf323..e794bd66bc5e730becf35e5653b724c04a422ea2 100644 --- a/www/showproject.php3 +++ b/www/showproject.php3 @@ -47,7 +47,32 @@ if (! TBProjAccessCheck($uid, $pid, $pid, $TB_PROJECT_READINFO)) { USERERROR("You are not a member of Project $pid.", 1); } -SHOWPROJECT($pid, $uid); +# +# A list of project experiments. +# +$query_result = + DBQueryFatal("SELECT eid,expt_name FROM experiments WHERE pid='$pid' order by eid"); +if (mysql_num_rows($query_result)) { + echo "<center> + <h3>Project Experiments</h3> + </center> + <table align=center border=1>\n"; + + while ($row = mysql_fetch_row($query_result)) { + $eid = $row[0]; + $name = $row[1]; + if (!$name) + $name = "--"; + echo "<tr> + <td> + <A href='showexp.php3?pid=$pid&eid=$eid'>$eid</a> + </td> + <td>$name</td> + </tr>\n"; + } + + echo "</table>\n"; +} # # A list of project members (from the default group). @@ -96,33 +121,6 @@ if (mysql_num_rows($query_result)) { echo "</table>\n"; } -# -# A list of project experiments. -# -$query_result = - DBQueryFatal("SELECT eid,expt_name FROM experiments WHERE pid='$pid' order by eid"); -if (mysql_num_rows($query_result)) { - echo "<center> - <h3>Project Experiments</h3> - </center> - <table align=center border=1>\n"; - - while ($row = mysql_fetch_row($query_result)) { - $eid = $row[0]; - $name = $row[1]; - if (!$name) - $name = "--"; - echo "<tr> - <td> - <A href='showexp.php3?pid=$pid&eid=$eid'>$eid</a> - </td> - <td>$name</td> - </tr>\n"; - } - - echo "</table>\n"; -} - # # A list of project Groups (if more than just the default). # @@ -164,6 +162,8 @@ echo "<p><center> <A href='newgroup_form.php3?pid=$pid'>Create</a> a new Group? </center>\n"; +SHOWPROJECT($pid, $uid); + if ($isadmin) { echo "<p> <A href='deleteproject.php3?pid=$pid'> diff --git a/www/showproject_dump.php3 b/www/showproject_dump.php3 index 5ad85e9faa38e79b19d3718294321c5a5fce0e7b..aa33aa13b30e58f1850c1937993dce12507cd336 100644 --- a/www/showproject_dump.php3 +++ b/www/showproject_dump.php3 @@ -2,8 +2,7 @@ # # This is an included file. No headers or footers or includes! # -$query_result = - DBQueryFatal("SELECT * FROM projects WHERE pid='$pid'"); +$query_result = DBQueryFatal("SELECT * FROM projects WHERE pid='$pid'"); if (mysql_num_rows($query_result) == 0) { USERERROR("The project $pid is not a valid project.", 1); } @@ -91,8 +90,8 @@ echo "<tr> echo "</table>\n"; -$userinfo_result = mysql_db_query($TBDBNAME, - "SELECT * from users where uid=\"$proj_head_uid\""); +$userinfo_result = + DBQueryFatal("SELECT * from users where uid='$proj_head_uid'"); $row = mysql_fetch_array($userinfo_result); $usr_expires = $row[usr_expires]; diff --git a/www/showstuff.php3 b/www/showstuff.php3 index 81beb57164ac735fd9ef349a08951443c33b2f29..c041c430499268f2f4b2b3fbe1cd400246dcf54b 100644 --- a/www/showstuff.php3 +++ b/www/showstuff.php3 @@ -11,11 +11,8 @@ function SHOWPROJECT($pid, $thisuid) { global $TBDBNAME; - $query_result = mysql_db_query($TBDBNAME, - "SELECT * FROM projects WHERE pid=\"$pid\""); - if (mysql_num_rows($query_result) == 0) { - USERERROR("The project $pid is not a valid project.", 1); - } + $query_result = + DBQueryFatal("SELECT * FROM projects WHERE pid='$pid'"); $row = mysql_fetch_array($query_result); echo "<center> @@ -319,9 +316,9 @@ function SHOWGROUPMEMBERSHIP($uid) { # function SHOWUSER($uid) { global $TBDBNAME; - - $userinfo_result = mysql_db_query($TBDBNAME, - "SELECT * from users where uid=\"$uid\""); + + $userinfo_result = + DBQueryFatal("SELECT * from users where uid='$uid'"); $row = mysql_fetch_array($userinfo_result); $usr_expires = $row[usr_expires]; @@ -587,9 +584,9 @@ function SHOWNODES($pid, $eid) { global $TBDBNAME; global $TBOPSPID; - $reserved_result = mysql_db_query($TBDBNAME, - "SELECT * FROM reserved WHERE ". - "eid=\"$eid\" and pid=\"$pid\""); + $reserved_result = + DBQueryFatal("SELECT * FROM reserved WHERE ". + "eid='$eid' and pid='$pid'"); # If this is an expt in emulab-ops, we don't care about vname, # since it won't be defined. But we do want to know when the node @@ -620,8 +617,8 @@ function SHOWNODES($pid, $eid) { <td align=center>Ready<br>Status[<b>3</b>]</td> </tr>\n"; - $query_result = mysql_db_query($TBDBNAME, - "SELECT nodes.*,reserved.vname, ". + $query_result = + DBQueryFatal("SELECT nodes.*,reserved.vname, ". "date_format(rsrv_time,\"%Y-%m-%d %T\") as rsrvtime ". "FROM nodes LEFT JOIN reserved ". "ON nodes.node_id=reserved.node_id ". @@ -698,8 +695,8 @@ function SHOWNODES($pid, $eid) { function SHOWOSINFO($osid) { global $TBDBNAME; - $query_result = mysql_db_query($TBDBNAME, - "SELECT * FROM os_info WHERE osid='$osid'"); + $query_result = + DBQueryFatal("SELECT * FROM os_info WHERE osid='$osid'"); $osrow = mysql_fetch_array($query_result);