From 804d3fa3268dc1191cfd6689a8dcfd1222863821 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 May 2026 19:44:49 -0700 Subject: [PATCH] Added a section to send recomended sites Signed-off-by: Bob --- index.php | 110 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 86 insertions(+), 24 deletions(-) diff --git a/index.php b/index.php index cbdb9a3..d95c16c 100644 --- a/index.php +++ b/index.php @@ -1,36 +1,41 @@ (round($pagesindexed/10,0,PHP_ROUND_HALF_DOWN)+1) or $pp<0){ echo "".$pp."
"; +// $send="Line ".__LINE__." Possible DoS attack. ?pp=".$pp." from ".$_SERVER['HTTP_USER_AGENT']; +// send_group("TidyWeb","system@lobby.mpaq.org",$send,"mpaq.org"); header("Refresh:0; url=/bot_trap/?pp=".$pp); exit; } }else{$pp=1;} if (isset($_GET['qq'])){ $quary=$qq=trim($_GET['qq']); -// $quary=strtolower($qq); -// $quary=trim(htmlentities($quary,ENT_QUOTES|ENT_HTML5,'UTF-8',true)); + $quary=trim(htmlentities($quary,ENT_QUOTES|ENT_HTML5,'UTF-8',true)); } $pages=paging('/',$pp,$pagesindexed,$qq,$offset); $sql="SELECT * FROM tidysearch.sites WHERE sites.hits>0;"; $ret=pg_query($con,$sql); -while($row=pg_fetch_array($ret)){if (isset($row['hits'])){$THits=$THits+$row['hits'];}} +while($row=pg_fetch_array($ret)){ + if (isset($row['hits'])){ + $THits=$THits+$row['hits']; + } +} $Websites=pg_num_rows(pg_query($con,$sql)); $SITE="TidySearch"; $keywords="Fediverse, Decentralized, Federated, Search, Engine, MPAQ, ".$SITE.""; @@ -43,7 +48,7 @@ echo " - + @@ -128,11 +133,6 @@ if (is_null($quary)){ $tmp2=trim(str_ireplace(' ','%20',$tmp2)); $tmp2=str_ireplace('\'',''',$tmp2); if (isset($tmp1) and isset($data['link'])){ -/* -This is a share button for the Fediverse and can be found at: -https://github.com/ArmandPhilippot/mastodon-sharing-button but seems to not be active -If needed, disable/comment out this secton -*/ $data['share']=" @@ -142,11 +142,33 @@ If needed, disable/comment out this secton "; $found++; }else{$data['share']=NULL;} + if ($_SERVER['SERVER_NAME']==="192.168.4.250" or $_SERVER['SERVER_NAME']==="localhost"){ + if (!is_null($data['lan_code'])){ + $Mcon=pg_connect("host=".$dbro['host']." dbname=movie_system user=".$dbro['user']." password=".$dbro['passw']); + $tmp=trim(str_ireplace('a/','',$data['lan_code'])); + $aa="SELECT * FROM movie_system.active WHERE active.yts=".$tmp; + $ab=pg_fetch_array(pg_query($Mcon,$aa)); + if (isset($ab['yts'])){ + $data['Star']=" + + + + + "; + }else{ + $data['Star']=" + + + + + "; + } + } + } display($data);unset($tmp1,$tmp2,$data); memory_get_usage(); } }else{ -/* Database searching takes place here but still needs work */ $LINE=0; if (isset($pp)){$offset=$pp*10;}else{$offset=0;} $sql="select * from tidysearch.pages where kwords ilike '% ".$quary." %' ORDER BY pages.date DESC, pages.idex DESC LIMIT 10 OFFSET ".$offset.";"; @@ -178,6 +200,7 @@ $LINE=__LINE__; $LINE=__LINE__; } if ($test==true){ +//echo "Line: ".$LINE." ".$sql."

"; $ret=pg_query($con,$sql); }else{ echo "

Nothing found

";exit; @@ -195,7 +218,7 @@ $LINE=__LINE__; $data['BotID']=$row['botid']; $data['lan_code']=$row['lan_code']; $data['HostID']=$row['hostid']; - $aa="SELECT * FROM ".$db['database'].".sites WHERE sites.index=".$data['SiteID'].";"; + $aa="SELECT * FROM ".$dbro['database'].".sites WHERE sites.index=".$data['SiteID'].";"; $ab=pg_fetch_array(pg_query($con,$aa)); $data['SiteName']=$ab['name']; $data['lang']=lang($ab['_lang']); @@ -207,11 +230,6 @@ $LINE=__LINE__; $tmp2=trim(str_ireplace(' ','%20',$tmp2)); $tmp2=str_ireplace('\'',''',$tmp2); if (isset($tmp1) and isset($data['link'])){ -/* -This is a share button for the Fediverse and can be found at: -https://github.com/ArmandPhilippot/mastodon-sharing-button but seems to not be active -If needed, disable/comment out this secton -*/ $data['share']=" @@ -221,13 +239,38 @@ If needed, disable/comment out this secton "; $found++; }else{$data['share']=NULL;} + if ($_SERVER['SERVER_NAME']==="192.168.4.250" or $_SERVER['SERVER_NAME']==="localhost"){ + if (!is_null($data['lan_code'])){ + $Mcon=pg_connect("host=".$dbro['host']." dbname=movie_system user=".$dbro['user']." password=".$dbro['passw']); + $tmp=trim(str_ireplace('a/','',$data['lan_code'])); + $aa="SELECT * FROM movie_system.active WHERE active.yts=".$tmp; + $ab=pg_fetch_array(pg_query($Mcon,$aa)); + if (isset($ab['yts'])){ + $data['Star']=" + + + + + "; + }else{ + $data['Star']=" + + + + + "; + } + } + } $data['title']=highlightStr($data['title'],$quary,"blue"); $data['description']=highlightStr($data['description'],$quary,"red"); display($data);unset($tmp1,$tmp2,$data); memory_get_usage(); } } -$botZero="
Help us #TakeTheInternetBack,
join the TidySearch network.
TidySearch has indexed ".number_format($pagesindexed)." pages."; +include('/media/10T/ADMIN/.TS_config_Web.php'); +include('/media/10T/ADMIN/.tidysearch.php'); +$botZero="
Help us #TakeTheInternetBack,
join the TidySearch network.
TidySearch has indexed ".number_format($Tpages)." pages on ".number_format($Websites)." sites."; echo "
".$pages[0]."

@@ -243,9 +286,28 @@ echo "
".$pages[0]." About the Author : MPAQ Team
+
+
+ Make a recommendation to our list.
The more you can tell us,
the easier it will be to include: +
+
+
+
+
+
+ +
+
+
"; -memory_get_usage(); /* Fource PHP cache cleanup */ +memory_get_usage(); +if ($_SERVER['SERVER_NAME']==="192.168.4.250" or $_SERVER['SERVER_NAME']==="localhost"){ + echo "
Hits: ".$THits."
".$sql."
Mem: ".memory_get_usage()."
Proc: ".time_check($StartTime)."
"; +} +// CREATE UNIQUE INDEX dex ON tidysearch.sites (index); + ?> +