<?php



function DisplayParticipants($csvfile) {
$resultcount=0;
$row = 1;
echo "<center><table>\n\n"; //begin html table formatting
if (($handle = fopen($csvfile, "r")) !== FALSE) {


    $oldcatname="";
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$data[0]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[0]);
		// PREVENT ALL MALICIOUS PHP PAYLOADS FROM BEING EXECUTED FROM CSV FILES!
        $data[0] = htmlspecialchars($data[0]);
        $data[1] = htmlspecialchars($data[1]);
        $data[2] = htmlspecialchars($data[2]);
        $data[3] = htmlspecialchars($data[3]);
        $data[4] = htmlspecialchars($data[4]);
        $data[5] = htmlspecialchars($data[5]);
        $data[6] = htmlspecialchars($data[6]);
        $data[7] = htmlspecialchars($data[7]);

        $data[1]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[1]);
        $data[2]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[2]);
        $data[3]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[3]);
        $data[4]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[4]);
        $data[5]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[5]);
        $data[6]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[6]);
        $data[7]=preg_replace("/[^a-zA-Z0-9:\/.\ -✔️❌]/", "", $data[7]);

        $num = count($data);
        //echo "<p>" . $data[1] . "</p>";
        //echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        //echo $row;

        if ( $row == "2") {
            echo "<p>";
        }else{
        if (str_contains(strtolower($data[3]), strtolower($query)) or str_contains(strtolower($data[2]), strtolower($query))  or str_contains(strtolower($data[1]), strtolower($query)) ) {
		
		// dont display your own instance
		if ( strtolower($data[1]) != strtolower($_SERVER['SERVER_NAME']) ){

        $resultcount++;
        for ($c=0; $c < $num; $c++) { // iterate over each row
			if ($c == "1"){

if (!preg_match("~^(?:f|ht)tps?://~i", $data[1])) {
        $webringp = "http://" . $data[1];
    }else{
        $webringp = $data[1];
	}

            echo  '<a href="' . $webringp . '/index.php?query=.&sensitive=1"><img src="participants/' . str_replace('http://', '', $data[1]) . '/banner.png"></a>'; // display the category as its the first row with this new category
			$url = '';
			}
            }
        }
        }
        }
		}
    echo "\n</p>";
    fclose($handle);
}
//echo "<p>" . $resultcount . " Result(s) found.</p>";

}


echo  '<a href="http://' . $instance .  '"><img src="' . $participantpath . 'banner.png"></a>';
?>
</br>
        <h3>Other Webring Participants:</h3>

<p>
<?php   

$webringcsvpath = $participantpath . "webring-participants.csv";
//echo $webringcsvpath;
DisplayParticipants($webringcsvpath);
?>


</p>

</br></br>
<p style="width: 80%;"><b><u>LEGAL DISCLAIMER:</u></b> <i>Across the entirety of all Darknet Lantern instances and all of the lists of links listed therein, <b>the sole purpose of providing the links to the mentionned darknet websites is strictly for informative and educative purposes.</b> The administrator(s) of this darknet lantern instance decline any and all responsibility regarding any physical, digital and psychological damage caused by any of the listed websites, as the responsibility of such acts remain with the perpetrating third-party. <b>By using this service, you permanently, irrevocably, and world-widely agree that the administrators of any darknet lantern instances aren't to be held responsible in any way for anything that another website ever did or will ever do, even if the link to that third-party website has been, is, or will ever be listed on any darknet lantern instance.</i></b></p>

</br><p><a href="http://blog.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/opsec/clearnetvsdarknet/index.html">The Darknet Context</a></p>
<p><a href="http://blog.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/opsec/darknetexploration/index.html">Why is this project important</a></p>
<p> <a href="http://blog.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/opsec/darknetlantern/index.html">How to setup your own instance</a> </p>
</br><p><i> Darknet Lantern - version 1.0.0 </i></p>
<p> <a href="https://simplex.chat/contact#/?v=2-7&smp=smp%3A%2F%2FBD4qkVq8lJUgjHt0kUaxeQBYsKaxDejeecxm6-2vOwI%3D%40b6geeakpwskovltbesvy3b6ah3ewxfmnhnshojndmpp7wcv2df7bnead.onion%2F4woLIDlpkvXRvZmaAiWA802OwiyxekdJ%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEAzIAoE-OWDqFJXMqgunIWHPpE_u7e52Wtu8TioPc1QwI%253D&data=%7B%22groupLinkId%22%3A%22Srr1_MNob7WfPTQIY-ug5Q%3D%3D%22%7D">SimpleX Chatroom</a> </p>

</center>
</body>
</html>
