Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
IRC Search
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2011-04-11 08:57:48
ircsearch.php:

<?

header("Content-Type: text/plain");

require_once("backend/functions.php");

require_once("languages/english.lang");

dbconn(false);



function sqlwildcardesc($x){

return str_replace(array("%","_"), array("\\%","\\_"), mysql_real_escape_string($x));

}

$searchstr = unesc($_GET["search"]);

$cleansearchstr = searchfield($searchstr);

$char1 = 50; //cut length

$char1 = 50; //cut length

$shortname = CutName(htmlspecialchars($row["name"]), $char1);



if (!$_GET["orderby"])

$orderby = "ORDER BY torrents.id DESC";

else

$orderby = "ORDER BY ".$_GET["orderby"];



$wherea = array();

$wherea[] = "banned != 'yes'";



switch ($_GET["incldead"] ) {

case 1:

break;

case 2:

$wherea[] = "visible = 'no'";

default:

$wherea[] = "visible = 'yes'";

}

if (!$_GET["limit"])

$limit = "LIMIT 3";

else

$limit = "LIMIT {$_GET['limit']}";



if ($_GET["cat"] > 0) {

$wherea[] = "category = " . sqlesc($_GET["cat"]);

}

$wherebase = $wherea;

if (isset($cleansearchstr)) {

$wherea[] = "MATCH (torrents.name) AGAINST ('".mysql_real_escape_string($searchstr)."' IN BOOLEAN MODE)"; }

$where = implode(" AND ", $wherea);

if ($where != "")

$where = "WHERE $where";



$res = mysql_query("SELECT COUNT(*) FROM torrents $where $limit") or die(mysql_error());

$count = $row[0];



if (!$count && isset($cleansearchstr)) {

$wherea = $wherebase;

$searcha = explode(" ", $cleansearchstr);

$sc = 0;

foreach ($searcha as $searchss) {

if (strlen($searchss) <= 1)

continue;

$sc++;

if ($sc > 5)

break;

$ssa = array();

foreach (array("torrents.name") as $sss)

$ssa[] = "$sss LIKE '%" . sqlwildcardesc($searchss) . "%'";

$wherea[] = "(" . implode(" OR ", $ssa) . ")";

}

if ($sc) {

$where = implode(" AND ", $wherea);

if ($where != "")

$where = "WHERE $where";

$res = mysql_query("SELECT COUNT(*) FROM torrents $where") or die(mysql_error());

$row = mysql_fetch_array($res);

$count = $row[0];

}

}



if ($count) {



$query = "SELECT torrents.id, torrents.category, torrents.leechers, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.numfiles,torrents.filename,torrents.owner," .

"categories.name AS cat_name, users.username, users.privacy FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit";



$res = mysql_query($query) or die(mysql_error());

}

else

unset($res);



if ($count) {

while ($row=mysql_fetch_array($res)) {

echo chr(3)."9".chr(2)." $site_config[SITENAME] ".chr(2).chr(3)."10 ".chr(3)."13Name: ".chr(3)."10(".chr(3)."4 {$row['name']} ".chr(3)."10) ".chr(3)."13Size: ".chr(3)."10( ".chr(3)."09".mksize($row['size']).chr(3)."10 )".chr(3)."13 Category: ".chr(3)."10(".chr(3)."4 $row[cat_name] ".chr(3)."10) ".chr(3)."13Uploader: ".chr(3)."10(".chr(3)."04 $row[username] ".chr(3)."10)".chr(3)."13 Seeders: ".chr(3)."10(".chr(3)."09 $row[seeders] ".chr(3)."10)".chr(3)."13 Leechers: ".chr(3)."10(".chr(3)."04 $row[leechers] ".chr(3)."10) ".chr(3)."13Link: ".chr(3)."10(".chr(3)."15 $site_config[SITEURL]/torrents-details.php?id=$row[id]".chr(3)."10 )\n";

}

}

else {

if (!isset($cleansearchstr)) {

die(NO_UPLOADS);

}

else {

die(NO_RESULTS);

}

}

?>
ircsearch.tcl:


package require http



bind pub - !search search



proc search {n u h c a} {

if {[string tolower $c]==[string tolower "#channel"]} {

if {$a!=""} {

set a [::http::mapReply $a]

putquick "PRIVMSG $c :Searching... Please Wait..."

set data [::http::geturl http://yoursite.com/ircsearch.php?search=$a]

putquick "PRIVMSG $c :Search Results:"

foreach line [split [::http::data $data] \n] {

putquick "PRIVMSG $c :$line"

}



} else { putquick "PRIVMSG $c :Use: !search Search terms" }

}

}





if you want it to PM the results to the user, use this tcl instead:





package require http



bind pub - !search search



proc search {n u h c a} {

if {[string tolower $c]==[string tolower "#channel"]} {

if {$a!=""} {

set a [::http::mapReply $a]

putquick "PRIVMSG $n :Searching... Please Wait..."

set data [::http::geturl http://yoursite.com/ircsearch.php?search=$a]

putquick "PRIVMSG $n :Search Results:"

foreach line [split [::http::data $data] \n] {

putquick "PRIVMSG $n :$line"

}



} else { putquick "PRIVMSG $n :Use: !search Search terms" }

}

}



Replace yoursite.com with your site url, #channel with your channel.



all creds to TS all i did was change the ircsearch.php to work with v2.05
Unknown User
2013-02-25 06:25:06
can i get this mod works on V2.8 thanks
Unknown User
2013-02-25 08:08:17
just change all mysql_query for SQL_Query_exec wil do the job ;)
Unknown User
2013-03-17 16:44:14
i don't have

languages/english.lang on V2.8
Unknown User
2013-03-17 19:03:46
then delete

require_once("languages/english.lang");

I personally dont like this style.. anyone with an little coding experience can make there bot use someone elses search:( due to the fact it has no protection in it.. I been debating an idea on my site to secure this stuff via an sub dir then .htaccess that dir to only allow my site and my bots ips.
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728