$value) { if (strncmp($aver, $value, strlen($value)) == 0) if ($costa == 10000) $costa = $index; if (strncmp($bver, $value, strlen($value)) == 0) if ($costb == 10000) $costb = $index; } // If both are the same prefix (or no prefix), just strcmp. if ($costa == $costb) { return strcmp($aver, $bver); } return (($costa < $costb) ? -1 : 1); } $op = httpget('op'); if ($op==""){ $addy = httpget('addy'); $desc = httpget('desc'); $vers = httpget('version'); $admin = httpget('admin'); $count = httpget('c')*1; $lang = httpget('l'); if ($vers == "") $vers = "Unknown"; if ($admin == "" || $admin=="postmaster@localhost.com") $admin = "unknown"; // See if we know this server. $sql = "SELECT lastupdate,serverid,lastping,recentips FROM " . db_prefix("logdnet") . " WHERE address='$addy'"; $result = db_query($sql); $row = db_fetch_assoc($result); // Clean up the desc $desc = logdnet_sanitize($desc); $desc = soap($desc); // Limit descs to 75 characters. if (strlen($desc) > 75) $desc = substr($desc, 0, 75); $date = date("Y-m-d H:i:s"); if (db_num_rows($result)>0){ // This is an already known server. // Eric, this below code does NOT work and causes a server to NEVER // get updated.. I'm commenting it out until you rethink it! // the server addy doesn't *change* so by checking this we never // update // It seems as if you thought this was the IP of the user logging in. // Also, nothing ever expires the IP from this list. //$ips = array_flip(explode(",",$row['recentips'])); //if (isset($ips[$_SERVER['REMOTE_ADDR']])){ // //we've seen this user too recently. //}else{ // $ips = array_keys($ips); // if (!isset($ips[$_SERVER['REMOTE_ADDR']])) // array_push($ips,$_SERVER['REMOTE_ADDR']); // $ips = addslashes(join(',',$ips)); // TEMP hack for IPs $ips = $_SERVER['REMOTE_ADDR']; // Only one update per minute allowed. if (strtotime($row['lastping'])=2){ $currency = getsetting("paypalcurrency", "USD"); $info = array(); $info[''] = '
'; $info['image'] = join("",file("images/paypal1.gif")); $info['content-type'] = "image/gif"; echo base64_encode(serialize($info)); } }elseif ($op=="net"){ // Someone is requesting our list of servers, so give it to them. // I'm going to do a slightly niftier sort manually in a bit which always // pops the most recent 'official' versions to the top of the list. $sql = "SELECT address,description,version,admin,priority FROM " . db_prefix("logdnet") . " WHERE lastping > '".date("Y-m-d H:i:s",strtotime("-7 days"))."'"; $result=db_query($sql); $rows = array(); $number=db_num_rows($result); for ($i=0;$i<$number;$i++){ $rows[] = db_fetch_assoc($result); } $rows = apply_logdnet_bans($rows); usort($rows, "lotgdsort"); // Okay, they are now sorted, so output them for ($i = 0; $i < count($rows); $i++) { $row = serialize($rows[$i]); echo $row."\n"; } }else{ page_header("LoGD Net"); addnav("Login page","index.php"); output("`@Below are a list of other LoGD servers that have registered with the LoGD Net.`n"); output("`2It should be noted that this list is subject to editing and culling by the administrators of logdnet.logd.com. "); output("Normally this list is a comprehensive list of all servers that have elected to register with LoGDnet, but I'm making changes to that. "); output("Because this list is a free service provided by logdnet.logd.com, we reserve the right to remove those who we don't want in the list.`n"); output("Reasons we might remove a server:`n"); output("• Altering our copyright statement outside of the provisions we have provided within the code,`n", true); output("• Removing our PayPal link,`n", true); output("• Providing deceptive, inappropriate, or false information in the server listing,`n", true); output("• Not linking back to LoGDnet`n", true); output("Or really, any other reason that we want.`n"); output("If you've been banned already, chances are you know why, and chances are we've got no interest in removing the ban."); output("We provide this free of charge, at the expense of considerable bandwidth and server load, so if you've had the gall to abuse our charity, don't expect it to be won back very easily.`n`n"); output("If you are well behaved, we don't have an interest in blocking you from this listing. `0`n"); rawoutput(""); rawoutput(""); require_once("lib/pullurl.php"); $u = getsetting("logdnetserver", "http://logdnet.logd.com/"); if (!preg_match("/\\/$/", $u)) { $u = $u . "/"; savesetting("logdnetserver", $u); } $servers=pullurl($u."logdnet.php?op=net"); if (!$servers) $servers = array(); $i = 0; while (list($key,$val)=each($servers)){ $row=unserialize($val); // If we aren't given an address, continue on. if (substr($row['address'],0,7)!="http://" && substr($row['address'],0,8) != "https://") { continue; } // Give undescribed servers a boring descriptionn if (trim($row['description'])=="") $row['description']="Another boring and undescribed LotGD server"; // Strip out any embedded html. $row['description'] = preg_replace("|<[a-zA-Z0-9/ =]+>|", "", $row['description']); // Clean up the desc $row['description'] = logdnet_sanitize($row['description']); $row['description'] = soap($row['description']); // Limit descs to 75 characters. if (strlen($row['description']) > 75) $row['description'] = substr($row['description'], 0, 75); $row['description'] = htmlentities(stripslashes($row['description']), ENT_COMPAT, getsetting("charset", "ISO-8859-1")); $row['description'] = str_replace("`&", "`&", $row['description']); // Correct for old logdnet servers if ($row['version']=="") $row['version'] = translate_inline("Unknown"); // Output the information we have. rawoutput(""); rawoutput(""); $i++; } rawoutput("
"); output("Server"); rawoutput(""); output("Version"); rawoutput("
"); output_notl("`&%s`0",$row['description'], true); rawoutput(""); output_notl("`^%s`0", $row['version']); // so we are able to translate "`^Unknown`0" rawoutput("
"); page_footer(); } function apply_logdnet_bans($logdnet){ $sql = "SELECT * FROM ".db_prefix("logdnetbans"); $result = db_query($sql,"logdnetbans"); while ($row = db_fetch_assoc($result)){ reset($logdnet); while (list($i,$net)=each($logdnet)){ if (preg_match("/{$row['banvalue']}/i",$net[$row['bantype']])){ unset($logdnet[$i]); } } } return $logdnet; } ?>