Difference between revisions of "PHP:Proxies body"

From distributed.net
Jump to navigationJump to search
 
Line 8: Line 8:
  
 
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.ranking, S.description as s_description, C.releasedate,  
+
$result = $db->query("select S.ranking, S.description as s_description, C.releasedate,  
 
             C.build, C.description as c_description, C.urlpart, C.instruct, S.sectionid  
 
             C.build, C.description as c_description, C.urlpart, C.instruct, S.sectionid  
 
       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'  
       order by S.ranking, S.description, C.releasedate Desc, C.build",$db);
+
       order by S.ranking, S.description, C.releasedate Desc, C.build");
  
 
$lastsection = "";
 
$lastsection = "";
 
$instructions = array();
 
$instructions = array();
 
$nextnoteid = 1;
 
$nextnoteid = 1;
while ($clientrow = mysql_fetch_array($result))
+
while ($clientrow = $result->fetch_array())
 
{
 
{
 
   if ($clientrow['s_description'] != $lastsection) {
 
   if ($clientrow['s_description'] != $lastsection) {
Line 57: Line 56:
 
       htmlspecialchars($ftpurl . $clientrow['urlpart']) );
 
       htmlspecialchars($ftpurl . $clientrow['urlpart']) );
 
}
 
}
 +
$result->free();
 +
$db->close();
  
 
if (count($instructions)) {
 
if (count($instructions)) {

Latest revision as of 22:13, 4 February 2020

//


print '<table class="clients">';


$httpurl = "http://http.distributed.net/pub/dcti/proxyper/";
$ftpurl = "ftp://ftp.distributed.net/pub/dcti/proxyper/";

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

$result = $db->query("select S.ranking, S.description as s_description, C.releasedate, 
            C.build, C.description as c_description, C.urlpart, C.instruct, S.sectionid 
       from sections S, proxies C 
       where C.sectionid=S.sectionid and C.visible='true' 
       order by S.ranking, S.description, C.releasedate Desc, C.build");

$lastsection = "";
$instructions = array();
$nextnoteid = 1;
while ($clientrow = $result->fetch_array())
{
   if ($clientrow['s_description'] != $lastsection) {

      if (count($instructions)) {
         print '<tr><td class="notation" colspan="5"><small><em>';
         foreach ($instructions as $id => $text)
            printf("%d. %s<br />", $id, htmlspecialchars($text));
         print "</em></small></td></tr>";
      }

      printf('<tr><td colspan="5"><strong><a name="%s" id="%s">%s</a></strong></td></tr>',
           $clientrow['sectionid'], $clientrow['sectionid'], $clientrow['s_description']);
      $lastsection = $clientrow['s_description'];
      $instructions = array();
   }
   $footnote = " ";
   if ($clientrow['instruct'] != "") {
      $noteid = array_search($clientrow['instruct'], $instructions);
      if (!$noteid) {
        $noteid = $nextnoteid++;
        $instructions[$noteid] = $clientrow['instruct'];
      }
      $footnote = "<small><em>$noteid</em></small>";
   }
   printf("<tr><td>%s</td>" .
           "<td>%s</td>" .
           "<td><b>%s </b></td>" .
           '<td nowrap="true">%s </td>' .
           '<td class="notation"> <a href="%s" onclick="javascript:urchinTracker(\'/download/proxies-file\');">http</a> | <a href="%s" onclick="javascript:urchinTracker(\'/download/proxies-file\');">ftp</a> </td>' .
           "</tr>", 
       $footnote, htmlspecialchars($clientrow['c_description']),
       htmlspecialchars($clientrow['build']),
       $clientrow['releasedate'], 
       htmlspecialchars($httpurl . $clientrow['urlpart']), 
       htmlspecialchars($ftpurl . $clientrow['urlpart']) );
}
$result->free();
$db->close();

if (count($instructions)) {
    print '<tr><td class="notation" colspan="5"><small><em>';
    foreach ($instructions as $id => $text)
        printf("%d. %s<br />", $id, htmlspecialchars($text));
    print "</em></small></td></tr>";
}

print "</table>\n";

//