Changeset 35 for trunk/runID_info.php


Ignore:
Timestamp:
Apr 8, 2018, 4:41:57 PM (7 years ago)
Author:
gegorbet
Message:

mods mostly for use of mysqli

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/runID_info.php

    r15 r35  
    2828
    2929global $uses_airavata;
     30global $link;
    3031
    3132?>
     
    6263function experiment_select( $select_name, $current_ID = NULL )
    6364{
     65  global $link;
    6466  $myID = $_SESSION['id'];
    6567
     
    7274            $users_clause .
    7375            "ORDER BY lname, runID ";
    74   $result = mysql_query( $query )
    75             or die( "Query failed : $query<br />" . mysql_error() );
    76 
    77   if ( mysql_num_rows( $result ) == 0 ) return "";
     76  $result = mysqli_query( $link, $query )
     77            or die( "Query failed : $query<br />" . mysqli_error($link) );
     78
     79  if ( mysqli_num_rows( $result ) == 0 ) return "";
    7880
    7981  $text = "<form action='{$_SERVER['PHP_SELF']}' method='post'>\n" .
    8082          "  <select name='$select_name' size='1' onchange='form.submit();'>\n" .
    8183          "    <option value=-1>Please select...</option>\n";
    82   while ( list( $experimentID, $runID, $lname ) = mysql_fetch_array( $result ) )
     84  while ( list( $experimentID, $runID, $lname ) = mysqli_fetch_array( $result ) )
    8385  {
    8486    $selected = ( $current_ID == $experimentID ) ? " selected='selected'" : "";
     
    9597function runID_info( $experimentID )
    9698{
     99  global $link;
    97100  $query  = "SELECT people.personID, personGUID, lname, fname, email " .
    98101            "FROM experiment, projectPerson, people " .
     
    100103            "AND experiment.projectID = projectPerson.projectID " .
    101104            "AND projectPerson.personID = people.personID ";
    102   $result = mysql_query( $query )
    103             or die( "Query failed : $query<br />\n" . mysql_error() );
    104   list( $ID, $GUID, $lname, $fname, $email ) = mysql_fetch_array( $result );
     105  $result = mysqli_query( $link, $query )
     106            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     107  list( $ID, $GUID, $lname, $fname, $email ) = mysqli_fetch_array( $result );
    105108
    106109  $text = <<<HTML
     
    126129            "WHERE experimentID = $experimentID " .
    127130            "AND experiment.rotorCalibrationID = rotorCalibration.rotorCalibrationID ";
    128   $result = mysql_query( $query )
    129             or die( "Query failed : $query<br />\n" . mysql_error() );
    130   list( $GUID, $coeff1, $coeff2, $type, $runType ) = mysql_fetch_array( $result );
     131  $result = mysqli_query( $link, $query )
     132            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     133  list( $GUID, $coeff1, $coeff2, $type, $runType ) = mysqli_fetch_array( $result );
    131134  $text .= <<<HTML
    132135  <table cellspacing='0' cellpadding='0' class='admin'>
     
    154157            "WHERE experimentID = $experimentID " .
    155158            "ORDER BY filename ";
    156   $result = mysql_query( $query )
    157             or die( "Query failed : $query<br />\n" . mysql_error() );
    158 
    159   if ( mysql_num_rows( $result ) == 0 )
     159  $result = mysqli_query( $link, $query )
     160            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     161
     162  if ( mysqli_num_rows( $result ) == 0 )
    160163    return $text;
    161164
     
    176179HTML;
    177180
    178   while ( list( $ID, $GUID, $filename, $solutionID ) = mysql_fetch_array( $result ) )
     181  while ( list( $ID, $GUID, $filename, $solutionID ) = mysqli_fetch_array( $result ) )
    179182  {
    180183    $rawIDs[]      = $ID;
     
    200203            "WHERE rawDataID IN ( $rawIDs_csv ) " .
    201204            "ORDER BY editedDataID, filename ";
    202   $result = mysql_query( $query )
    203             or die( "Query failed : $query<br />\n" . mysql_error() );
    204 
    205   if ( mysql_num_rows( $result ) == 0 )
     205  $result = mysqli_query( $link, $query )
     206            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     207
     208  if ( mysqli_num_rows( $result ) == 0 )
    206209    return $text;
    207210
     
    222225
    223226  $editIDs = array();
    224   while ( list ( $editID, $rawID, $GUID, $filename ) = mysql_fetch_array( $result ) )
     227  while ( list ( $editID, $rawID, $GUID, $filename ) = mysqli_fetch_array( $result ) )
    225228  {
    226229    $editIDs[] = $editID;
     
    245248            "WHERE editedDataID IN ( $editIDs_csv ) " .
    246249            "ORDER BY modelID ";
    247   $result = mysql_query( $query )
    248             or die( "Query failed : $query<br />\n" . mysql_error() );
    249 
    250   if ( mysql_num_rows( $result ) != 0 )
     250  $result = mysqli_query( $link, $query )
     251            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     252
     253  if ( mysqli_num_rows( $result ) != 0 )
    251254  {
    252255    $text .= <<<HTML
     
    268271
    269272    $modelIDs = array();
    270     while ( list ( $modelID, $editID, $GUID, $variance, $meniscus, $personID ) = mysql_fetch_array( $result ) )
     273    while ( list ( $modelID, $editID, $GUID, $variance, $meniscus, $personID ) = mysqli_fetch_array( $result ) )
    271274    {
    272275      $modelIDs[] = $modelID;
     
    295298              "WHERE modelID IN ( $modelIDs_csv ) " .
    296299              "ORDER BY noiseID ";
    297     $result = mysql_query( $query )
    298               or die( "Query failed : $query<br />\n" . mysql_error() );
    299 
    300     if ( mysql_num_rows( $result ) != 0 )
     300    $result = mysqli_query( $link, $query )
     301              or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     302
     303    if ( mysqli_num_rows( $result ) != 0 )
    301304    {
    302305      $text .= <<<HTML
     
    317320HTML;
    318321
    319       while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysql_fetch_array( $result ) )
     322      while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysqli_fetch_array( $result ) )
    320323      {
    321324        $text .= <<<HTML
     
    340343            "WHERE editedDataID IN ( $editIDs_csv ) " .
    341344            "ORDER BY noiseID ";
    342   $result = mysql_query( $query )
    343             or die( "Query failed : $query<br />\n" . mysql_error() );
    344 
    345   if ( mysql_num_rows( $result ) != 0 )
     345  $result = mysqli_query( $link, $query )
     346            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     347
     348  if ( mysqli_num_rows( $result ) != 0 )
    346349  {
    347350    $text .= <<<HTML
     
    362365HTML;
    363366
    364     while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysql_fetch_array( $result ) )
     367    while ( list ( $noiseID, $GUID, $editID, $modelID, $modelGUID, $type ) = mysqli_fetch_array( $result ) )
    365368    {
    366369      $text .= <<<HTML
     
    386389            "ORDER BY reportID ";
    387390
    388   $result = mysql_query( $query )
    389             or die( "Query failed : $query<br />\n" . mysql_error() );
    390 
    391   if ( mysql_num_rows( $result ) != 0 )
     391  $result = mysqli_query( $link, $query )
     392            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     393
     394  if ( mysqli_num_rows( $result ) != 0 )
    392395  {
    393396    $text .= <<<HTML
     
    405408HTML;
    406409
    407     while ( list ( $reportID, $GUID, $title ) = mysql_fetch_array( $result ) )
     410    while ( list ( $reportID, $GUID, $title ) = mysqli_fetch_array( $result ) )
    408411    {
    409412      $reportIDs[] = $reportID;
     
    430433              "ORDER BY reportID, reportTripleID ";
    431434 
    432     $result = mysql_query( $query )
    433               or die( "Query failed : $query<br />\n" . mysql_error() );
    434 
    435     if ( mysql_num_rows( $result ) != 0 )
     435    $result = mysqli_query( $link, $query )
     436              or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     437
     438    if ( mysqli_num_rows( $result ) != 0 )
    436439    {
    437440      $text .= <<<HTML
     
    453456 
    454457      while ( list ( $reportTripleID, $GUID, $resultID, $triple, $dataDesc, $rptID )
    455                    = mysql_fetch_array( $result ) )
     458                   = mysqli_fetch_array( $result ) )
    456459      {
    457460        $reportTripleIDs[] = $reportTripleID;
     
    483486              "ORDER BY reportTripleID, reportDocumentID ";
    484487 
    485     $result = mysql_query( $query )
    486               or die( "Query failed : $query<br />\n" . mysql_error() );
    487 
    488     if ( mysql_num_rows( $result ) != 0 )
     488    $result = mysqli_query( $link, $query )
     489              or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     490
     491    if ( mysqli_num_rows( $result ) != 0 )
    489492    {
    490493      $text .= <<<HTML
     
    507510      while ( list ( $reportDocumentID, $GUID, $editID, $label, $filename,
    508511                     $analysis, $subAnal, $docType, $tripID )
    509                    = mysql_fetch_array( $result ) )
     512                   = mysqli_fetch_array( $result ) )
    510513      {
    511514        $text .= <<<HTML
     
    531534            "WHERE experimentID = $experimentID " .
    532535            "ORDER BY HPCAnalysisRequestID ";
    533   $result = mysql_query( $query )
    534             or die( "Query failed : $query<br />\n" . mysql_error() );
    535 
    536   if ( mysql_num_rows( $result ) == 0 )
     536  $result = mysqli_query( $link, $query )
     537            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     538
     539  if ( mysqli_num_rows( $result ) == 0 )
    537540    return $text;
    538541
     
    554557HTML;
    555558
    556   while ( list( $ID, $GUID, $filename, $submit, $cluster, $method ) = mysql_fetch_array( $result ) )
     559  while ( list( $ID, $GUID, $filename, $submit, $cluster, $method ) = mysqli_fetch_array( $result ) )
    557560  {
    558561    $requestIDs[]  = $ID;
     
    579582            "WHERE HPCAnalysisRequestID IN ( $requestIDs_csv ) " .
    580583            "ORDER BY HPCAnalysisResultID ";
    581   $result = mysql_query( $query )
    582             or die( "Query failed : $query<br />\n" . mysql_error() );
    583 
    584   if ( mysql_num_rows( $result ) != 0 )
     584  $result = mysqli_query( $link, $query )
     585            or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     586
     587  if ( mysqli_num_rows( $result ) != 0 )
    585588  {
    586589    $text .= <<<HTML
     
    600603
    601604    $incomplete = array();
    602     while ( list( $ID, $requestID, $gfacID, $status, $updated ) = mysql_fetch_array( $result ) )
     605    while ( list( $ID, $requestID, $gfacID, $status, $updated ) = mysqli_fetch_array( $result ) )
    603606    {
    604607      if ( $status != 'completed' )
     
    628631  global $globaldbhost, $globaldbuser, $globaldbpasswd, $globaldbname;
    629632
    630   $globaldb = mysql_connect( $globaldbhost, $globaldbuser, $globaldbpasswd );
     633  $globaldb = mysqli_connect( $globaldbhost, $globaldbuser, $globaldbpasswd, $globaldbname );
    631634
    632635  if ( ! $globaldb )
    633636  {
    634     $text .= "<p>Cannot open global database on $globaldbhost</p>\n";
    635     return $text;
    636   }
    637 
    638   if ( ! mysql_select_db( $globaldbname, $globaldb ) )
    639   {
    640     $text .= "<p>Cannot change to global database $globaldbname</p>\n";
     637    $text .= "<p>Cannot open global database on $globaldbhost : $globaldbname</p>\n";
    641638    return $text;
    642639  }
     
    665662              "FROM analysis " .
    666663              "WHERE gfacID = '$gfacID' ";
    667     $result = mysql_query( $query )
    668               or die( "Query failed : $query<br />\n" . mysql_error() );
    669  
    670     if ( mysql_num_rows( $result ) == 1 )
     664    $result = mysqli_query( $link, $query )
     665              or die( "Query failed : $query<br />\n" . mysqli_error($link) );
     666 
     667    if ( mysqli_num_rows( $result ) == 1 )
    671668    {
    672669      $in_queue++;
    673       list( $cluster, $db, $status, $msg, $time ) = mysql_fetch_array( $result );
     670      list( $cluster, $db, $status, $msg, $time ) = mysqli_fetch_array( $result );
    674671      $text .= <<<HTML
    675672      <tr><td>$gfacID</td>
     
    691688           "</table>\n";
    692689
    693   mysql_close( $globaldb );
     690  mysqli_close( $globaldb );
    694691
    695692  return $text;
     
    698695function HPCDetail( $requestID )
    699696{
     697  global $link;
    700698  $query = "SELECT * FROM HPCAnalysisRequest WHERE HPCAnalysisRequestID=$requestID";
    701   $result = mysql_query( $query )
    702            or die( "Query failed : $query<br />\n" . mysql_error());
    703   $row = mysql_fetch_assoc( $result );
     699  $result = mysqli_query( $link, $query )
     700           or die( "Query failed : $query<br />\n" . mysqli_error($link));
     701  $row = mysqli_fetch_assoc( $result );
    704702  $row['requestXMLFile'] = '<pre>' . htmlentities( $row['requestXMLFile'] ) . '</pre>';
    705703
     
    722720 
    723721  $query = "SELECT * FROM HPCAnalysisResult WHERE HPCAnalysisRequestID=$requestID";
    724   $result = mysql_query( $query )
    725            or die( "Query failed : $query<br />\n" . mysql_error());
    726   $row = mysql_fetch_assoc( $result );
     722  $result = mysqli_query( $link, $query )
     723           or die( "Query failed : $query<br />\n" . mysqli_error($link));
     724  $row = mysqli_fetch_assoc( $result );
    727725  $row['jobfile'] = '<pre>' . htmlentities( $row['jobfile'] ) . '</pre>';
    728726
     
    761759              "WHERE HPCAnalysisResultID = $resultID " .
    762760              "AND HPCAnalysisResultType = 'model' ";
    763     $result = mysql_query( $query )
    764              or die( "Query failed : $query<br />\n" . mysql_error());
    765     $models = mysql_fetch_row( $result );         // An array with all of them
     761    $result = mysqli_query( $link, $query )
     762             or die( "Query failed : $query<br />\n" . mysqli_error($link));
     763    $models = mysqli_fetch_row( $result );         // An array with all of them
    766764    if ( $models !== false )
    767765      $row['modelIDs'] = implode( ", ", $models );
     
    770768              "WHERE HPCAnalysisResultID = $resultID " .
    771769              "AND HPCAnalysisResultType = 'noise' ";
    772     $result = mysql_query( $query )
    773              or die( "Query failed : $query<br />\n" . mysql_error());
    774     $noise  = mysql_fetch_row( $result );         // An array with all of them
     770    $result = mysqli_query( $link, $query )
     771             or die( "Query failed : $query<br />\n" . mysqli_error($link));
     772    $noise  = mysqli_fetch_row( $result );         // An array with all of them
    775773    if ( $noise !== false )
    776774      $row['noiseIDs'] = implode( ", ", $noise );
Note: See TracChangeset for help on using the changeset viewer.