Difference between revisions of "PHP:Proxies head"

From distributed.net
Jump to navigationJump to search
(update to php72)
 
Line 2: Line 2:
  
 
global $dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName;
 
global $dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName;
$db = mysql_pconnect($dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword);
+
$db = new mysqli($dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName);
mysql_select_db($dnetClientsDBName,$db);
 
  
$result = mysql_query("select S.description as s_description, S.sectionid, count(*)  
+
$result = $db->query("select S.description as s_description, S.sectionid, count(*)  
 
       from sections S, proxies C  
 
       from sections S, proxies C  
 
       where C.sectionid=S.sectionid and C.visible='true'  
 
       where C.sectionid=S.sectionid and C.visible='true'  
 
       group by S.description, S.sectionid
 
       group by S.description, S.sectionid
       order by S.description asc",$db);
+
       order by S.description asc");
  
 
print '<p align="center">';
 
print '<p align="center">';
  
while ($proxiesrow = mysql_fetch_array($result)) {
+
while ($proxiesrow = $result->fetch_array()) {
 
     printf('[<a href="#%s">%s</a>] ',
 
     printf('[<a href="#%s">%s</a>] ',
 
           $proxiesrow['sectionid'],  
 
           $proxiesrow['sectionid'],  
 
           str_replace(" ", "&nbsp;", $proxiesrow['s_description']) );  
 
           str_replace(" ", "&nbsp;", $proxiesrow['s_description']) );  
 
}
 
}
 +
$result->free();
 +
$db->close();
  
 
print "</p>";
 
print "</p>";
  
 
// </pre>
 
// </pre>

Latest revision as of 22:29, 4 February 2020

//


global $dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName;
$db = new mysqli($dnetClientsDBHostname, $dnetClientsDBUsername, $dnetClientsDBPassword, $dnetClientsDBName);

$result = $db->query("select S.description as s_description, S.sectionid, count(*) 
      from sections S, proxies C 
      where C.sectionid=S.sectionid and C.visible='true' 
      group by S.description, S.sectionid
      order by S.description asc");

print '<p align="center">';

while ($proxiesrow = $result->fetch_array()) {
    printf('[<a href="#%s">%s</a>] ',
          $proxiesrow['sectionid'], 
          str_replace(" ", " ", $proxiesrow['s_description']) ); 
}
$result->free();
$db->close();

print "</p>";

//