* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ if($_SERVER['REQUEST_METHOD']==='HEAD'){ exit; // ignore headers, no further processing needed } include('common_config.php'); try{ $db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME, DBUSER, DBPASS, [PDO::ATTR_ERRMODE=>PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT=>PERSISTENT]); }catch(PDOException $e){ } date_default_timezone_set('UTC'); //select output format if(!isset($_REQUEST['format'])){ send_html(); }elseif($_REQUEST['format']==='text'){ send_text(); }elseif($_REQUEST['format']==='json'){ send_json(); }else{ send_html(); } function send_html(){ global $I, $categories, $db, $language; header('Content-Type: text/html; charset=UTF-8'); asort($categories); //sql for special categories $special=[ $I['all']=>"address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff<604800', $I['lastadded']=>"address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing)', $I['offline']=>"address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff>604800' ]; if(!isSet($_REQUEST['pg'])){ $_REQUEST['pg']=1; }else{ settype($_REQUEST['pg'], 'int'); } if($_REQUEST['pg']>0){ $_REQUEST['newpg']=1; }else{ $_REQUEST['newpg']=0; } echo ''; echo "$I[title]"; echo ''; echo ''; echo ''; echo "

$I[title]

"; print_langs(); echo "
$I[format]: Text JSON"; if(!isSet($db)){ echo "

$I[error]: $I[nodb]

"; echo ''; exit; } echo '

I\'m not responsible for any content of websites linked here. Be careful and use your brain.

Do you want your address to be highlighted and featured at the top of the results? Send Bitcoins to 1CHvjeMJum2Zfd3JEdb35RUEdz1jjQvdPT and then tell me your transaction ID and which address(es) you want to be highlighted. 0.025 BTC equals 10 days for one address. Any other amount can be calculated thereof.

'; //update onions description form echo ""; //search from echo ""; echo '
"; echo ""; echo ""; echo "

$I[addonion]:

'; echo "

$I[adddesc]:

'; if(isSet($_REQUEST['cat']) && $_REQUEST['cat']<(count($categories)+count($special)+1) && $_REQUEST['cat']>=0){ settype($_REQUEST['cat'], 'int'); $category=$_REQUEST['cat']; } if(!isSet($category)){ $category=count($categories); } echo "

$I[category]:

'; echo "
"; echo ""; echo ""; echo "

$I[search]:

'; echo "

'; //List special categories echo "

"; //List normal categories echo "

'; if($_SERVER['REQUEST_METHOD']==='POST' && !empty($_REQUEST['addr'])){ if(!preg_match('~(^(https?://)?([a-z0-9]*\.)?([a-z2-7]{16})(\.onion(/.*)?)?$)~i', trim($_REQUEST['addr']), $addr)){ echo "

$I[invalonion]

"; echo "

$I[valid]: http://tt3j2x4k5ycaa5zt.onion

"; }else{ $addr=strtolower($addr[4]); $md5=md5($addr, true); $stmt=$db->prepare('SELECT locked FROM ' . PREFIX . 'onions WHERE md5sum=?;'); $stmt->execute(array($md5)); $stmt->bindColumn(1, $locked); if($category==count($categories)){ $category=0; } if(!isSet($_POST['desc'])){ $desc=''; }else{ $desc=trim($_POST['desc']); $desc=htmlspecialchars($desc); $desc=preg_replace("/(\r?\n|\r\n?)/", '
', $desc); } if(!$stmt->fetch(PDO::FETCH_BOUND)){//new link, add to database $stmt=$db->prepare('INSERT INTO ' . PREFIX . 'onions (address, description, md5sum, category) VALUES (?, ?, ?, ?);'); $stmt->execute(array($addr, $desc, $md5, $category)); echo "

$I[succadd]

"; }elseif($locked==1){//locked, not editable echo "

$I[faillocked]

"; }elseif($desc!==''){//update description $stmt=$db->prepare('UPDATE ' . PREFIX . 'onions SET description=?, category=? WHERE md5sum=?;'); $stmt->execute(array($desc, $category, $md5)); echo "

$I[succupddesc]

"; }elseif($category!=0){//update category only $stmt=$db->prepare('UPDATE ' . PREFIX . 'onions SET category=? WHERE md5sum=?;'); $stmt->execute(array($category, $md5)); echo "

$I[succupdcat]

"; }else{//nothing changed and already known echo "

$I[alreadyknown]

"; } } } if($pages>1 && empty($_REQUEST['q'])){ $pagination=get_pagination($category, $pages); echo $pagination; }else{ $pagination=''; } if(!empty($_REQUEST['q'])){//run search query $stmt=$db->prepare('SELECT address, lasttest, lastup, timeadded, description, locked, special FROM ' . PREFIX . "onions WHERE address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND (description LIKE ? OR address LIKE ?) ORDER BY address;'); $query=htmlspecialchars($_REQUEST['q']); $query="%$query%"; $stmt->execute(array($query, $query)); $table=get_table($stmt, $numrows); printf("

$I[searchresult]

", $_REQUEST['q'], $numrows); echo $table; }elseif($category>=count($categories)+count($special)){//show phishing clones print_phishing_table(); }elseif($category>=count($categories)){//show special categories $tmp=$category-count($categories); foreach($special as $name=>$query){ if($tmp===0) break; --$tmp; } if($category-count($categories)===1){ $query.=' ORDER BY id DESC LIMIT 100'; }else{ $query.=' ORDER BY address'; if($_REQUEST['pg']>0){ $offset=100*($_REQUEST['pg']-1); $query.=" LIMIT 100 OFFSET $offset"; } } $stmt=$db->query('SELECT address, lasttest, lastup, timeadded, description, locked, special FROM ' . PREFIX . "onions WHERE $query;"); echo get_table($stmt, $numrows, true); }else{//show normal categories if($_REQUEST['pg']>0){ $offset=100*($_REQUEST['pg']-1); $offsetquery=" LIMIT 100 OFFSET $offset"; }else{ $offsetquery=''; } $stmt=$db->prepare('SELECT address, lasttest, lastup, timeadded, description, locked, special FROM ' . PREFIX . "onions WHERE address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . "phishing) AND category=? AND timediff<604800 ORDER BY address$offsetquery;"); $stmt->execute(array($category)); echo get_table($stmt, $numrows, true); } echo '
'; echo $pagination; echo '

Onion Link List - ' . VERSION . '

'; echo ''; } function get_table($stmt, &$numrows=0, $promoted=false){ global $I, $db, $language; $time=time(); ob_start(); echo ""; if($promoted){//print promoted links at the top $time=time(); $promo=$db->prepare('SELECT address, lasttest, lastup, timeadded, description, locked, special FROM ' . PREFIX . "onions WHERE special>? AND address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff<604800 ORDER BY address;'); $promo->execute(array($time)); while($link=$promo->fetch(PDO::FETCH_ASSOC)){ if($link['lastup']===$link['lasttest']){ $class='up'; }else{ $class='down'; } if($link['lastup']==0){ $lastup=$I['never']; }else{ $lastup=date('Y-m-d H:i:s', $link['lastup']); } if($link['lasttest']==0){ $lasttest=$I['never']; }else{ $lasttest=date('Y-m-d H:i:s', $link['lasttest']); } $timeadded=date('Y-m-d H:i:s', $link['timeadded']); echo ""; } } while($link=$stmt->fetch(PDO::FETCH_ASSOC)){ if($link['lastup']===$link['lasttest']){ $class='up'; }else{ $class='down'; } if($link['lastup']==0){ $lastup=$I['never']; }else{ $lastup=date('Y-m-d H:i:s', $link['lastup']); } if($link['lasttest']==0){ $lasttest=$I['never']; $class=''; }else{ $lasttest=date('Y-m-d H:i:s', $link['lasttest']); } $timeadded=date('Y-m-d H:i:s', $link['timeadded']); if($link['special']>$time){ $class.=' promo'; } if($link['locked']==1){ $edit='-'; }else{ $edit=""; } echo ""; ++$numrows; } echo '
$I[link]$I[description]$I[editdesc]$I[lasttested]$I[lastup]$I[timeadded]$I[testnow]
$link[address].onion$link[description]-$lasttest$lastup$timeadded
$link[address].onion$link[description]$edit$lasttest$lastup$timeadded
'; return ob_get_clean(); } function print_phishing_table(){ global $I, $db; echo ""; $stmt=$db->query('SELECT address, original, lasttest, lastup FROM ' . PREFIX . 'onions, ' . PREFIX . 'phishing WHERE ' . PREFIX . "onions.id=onion_id AND address!='' ORDER BY onions.address;"); while($link=$stmt->fetch(PDO::FETCH_ASSOC)){ if($link['lastup']===$link['lasttest']){ $class='up'; }else{ $class='down'; } if($link['lastup']==0){ $lastup=$I['never']; }else{ $lastup=date('Y-m-d H:i:s', $link['lastup']); } if($link['original']!==''){ $orig="$link[original].onion"; }else{ $orig=$I['unknown']; } echo ""; } echo '
$I[link]$I[cloneof]$I[lastup]
$link[address].onion$orig$lastup
'; } function send_text(){ global $db; if(!isSet($db)){ die("$I[error]: $I[nodb]"); } header('Content-Type: text/plain; charset=UTF-8'); $stmt=$db->query('SELECT address FROM ' . PREFIX . "onions WHERE address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff<604800 ORDER BY address;'); while($tmp=$stmt->fetch(PDO::FETCH_NUM)){ echo "$tmp[0].onion\n"; } } function send_json(){ global $db, $categories; if(!isSet($db)){ die("$I[error]: $I[nodb]"); } header('Content-Type: application/json;'); $data=['categories'=>$categories]; $stmt=$db->query('SELECT address, category, description, locked, lastup, lasttest, timeadded FROM ' . PREFIX . "onions WHERE address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff<604800 ORDER BY address;'); $data['onions']=$stmt->fetchALL(PDO::FETCH_ASSOC); $stmt=$db->query('SELECT md5sum FROM ' . PREFIX . "onions WHERE address='';"); while($tmp=$stmt->fetch(PDO::FETCH_ASSOC)){ $data['removed'][]=bin2hex($tmp['md5sum']); } $stmt=$db->query('SELECT address, original FROM ' . PREFIX . 'onions, ' . PREFIX . 'phishing WHERE onion_id=' . PREFIX . "onions.id AND address!='' AND timediff<604800 ORDER BY address;"); $data['phishing']=$stmt->fetchALL(PDO::FETCH_ASSOC); echo json_encode($data); } function get_pagination($category, $pages){ global $I, $language; ob_start(); echo "

"; return ob_get_clean(); } ?>