View Single Post
  #4  
Old 6th January 2013, 16:32
sharpie sharpie is offline
Senior Member
 
Join Date: Apr 2012
United Kingdom
Posts: 17
Default
yup that works then i add this code in but to clear the new tags but not working it used to work before i updated the browse.php to ajax
Code:
if ($_GET['clear_new']){
mysql_query("UPDATE users SET last_browse=".gmtime()." where id=".$CURUSER['id']);
header("Location: browse.php");
}
<center><p><b>Click <a href="?clear_new=1"><strong>HERE</strong></a> to Clear <b><font color="blue">NEW!</font></b> tags

so in my first post is browse.class.php

and this is the borwse.php

Code:
<?php
//ini_set("display_errors","2");
//ERROR_REPORTING(E_ALL);
// == If not working, uncomment above for debugging.

/*
+------------------------------------------------
|   TBDev.net BitTorrent Tracker PHP
|   =============================================
|   by CoLdFuSiOn
|   (c) 2003 - 2009 TBDev.Net
|   http://www.tbdev.net
|   =============================================
|   svn: http://sourceforge.net/projects/tbdevnet/
|   Licence Info: GPL
+------------------------------------------------
|   $Date$
|   $Revision$
|   $Author$
|   $URL$
+------------------------------------------------
				= Ajax Browse by TheHippy 2010 
*/
ob_start("ob_gzhandler");

require_once("include/bittorrent.php");
include("class/db.class.php");
include("class/browse.class.php");
dbconn(false);

loggedinorreturn();
getpage();
parked();
if ($_GET['clear_new']){
mysql_query("UPDATE users SET last_browse=".gmtime()." where id=".$CURUSER['id']);
header("Location: browse.php");
}
$torrents = array();
	$res = mysql_query("SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder");
	while ($row = mysql_fetch_assoc($res)) {
		if ($row["seeder"] == "yes")
			$key = "seeders";
		else
			$key = "leechers";
		$torrents[$row["torrent"]][$key] = $row["c"];
	}

	$res = mysql_query("SELECT torrent, COUNT(*) AS c FROM comments GROUP BY torrent");
	while ($row = mysql_fetch_assoc($res)) {
		$torrents[$row["torrent"]]["comments"] = $row["c"];
	}

	$fields = explode(":", "comments:leechers:seeders");
	$res = mysql_query("SELECT id, seeders, leechers, comments FROM torrents");
	while ($row = mysql_fetch_assoc($res)) {
		$id = $row["id"];
		$torr = $torrents[$id];
		foreach ($fields as $field) {
			if (!isset($torr[$field]))
				$torr[$field] = 0;
		}
		$update = array();
		foreach ($fields as $field) {
			if ($torr[$field] != $row[$field])
				$update[] = "$field = " . $torr[$field];
		}
		if (count($update))
			mysql_query("UPDATE torrents SET " . implode(",", $update) . " WHERE id = $id");
}
       $deadtime = deadtime();
       mysql_query("DELETE FROM peers WHERE last_action < FROM_UNIXTIME($deadtime)");

        $deadtime -= $max_dead_torrent_time;
        mysql_query("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime)");
//--- Added by Wilba --------------------------------
//mysql_query("UPDATE users SET last_browse=".gmtime()." where id=".$CURUSER['id']);
//---------------------------------------------------
mysql_query("UPDATE torrents SET free = 'yes' WHERE free = 'no' AND seeders>='3'")or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE torrents SET free = 'no' WHERE free = 'yes' AND seeders<'10'") or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE torrents SET free = 'yes' WHERE size > '1073741824' AND seeders>='1'") or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE torrents SET free = 'no' WHERE size > '1073741824' AND seeders<'10'") or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE torrents SET free = 'yes' WHERE size > '1073741824'") or sqlerr(__FILE__, __LINE__);
//mysql_query ("UPDATE torrents SET request = 'yes' WHERE request = ''") or sqlerr(__FILE__, __LINE__);
//mysql_query ("UPDATE torrents SET request = 'yes' WHERE request = 'no'") or sqlerr(__FILE__, __LINE__);

//=== remove donor status if time up AND set class back to power user... remember to set the class number for your system===//
$res = mysql_query("SELECT id, modcomment FROM users WHERE donor='yes' AND donoruntil < NOW() AND donoruntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
$dt = sqlesc(get_date_time());
$subject = sqlesc("Donor status removed by system.");
$msg = sqlesc("Your Donor status has timed out and has been auto-removed by the system, and your VIP status has been removed. We would like to thank you once again for your support to Gettorrents.org. If you wish to re-new your donation, you can do so by going to http://gettorrents.org/donate.php. Cheers!\n");
while ($arr = mysql_fetch_assoc($res))
{
///---AUTOSYSTEM MODCOMMENT---//
$modcomment = htmlspecialchars($arr["modcomment"]);
$modcomment = gmdate("d-m-Y") . " - Donor status removed by -System.\n". $modcomment;
$modcom = sqlesc($modcomment);
///---AUTOSYSTEM MODCOMMENT---//
mysql_query("UPDATE users SET class = '0', donor = 'no', donoruntil = '0000-00-00 00:00:00', modcomment = $modcom WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
mysql_query("INSERT INTO messages (sender, receiver, added, msg, subject, poster) VALUES(0, $arr[id], $dt, $msg, $subject, 0)") or sqlerr(__FILE__, __LINE__);
}
}
//===end===//

//=== remove donor status if time up AND set class back to power user... remember to set the class number for your system===//
$res = mysql_query("SELECT id, modcomment FROM users WHERE donor='no' AND donoruntil < NOW() AND donoruntil <> '0000-00-00 00:00:00'") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
$dt = sqlesc(get_date_time());
$subject = sqlesc("Donor status removed by system.");
$msg = sqlesc("Your Donor status has timed out and has been auto-removed by the system, and your VIP status has been removed. We would like to thank you once again for your support to Gettorrents.org. If you wish to re-new your donation, you can do so by going to http://gettorrents.org/donate.php. Cheers!\n");
while ($arr = mysql_fetch_assoc($res))
{
///---AUTOSYSTEM MODCOMMENT---//
$modcomment = htmlspecialchars($arr["modcomment"]);
$modcomment = gmdate("d-m-Y") . " - Donor status removed by -System.\n". $modcomment;
$modcom = sqlesc($modcomment);
///---AUTOSYSTEM MODCOMMENT---//
mysql_query("UPDATE users SET class = '0', donor = 'no', donoruntil = '0000-00-00 00:00:00', modcomment = $modcom WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);
mysql_query("INSERT INTO messages (sender, receiver, added, msg, subject, poster) VALUES(0, $arr[id], $dt, $msg, $subject, 0)") or sqlerr(__FILE__, __LINE__);
}
}
//===end===//

    //$HTMLOUT .= "<div id='view_cate_area' style='display:none;'>";
    //print out the tag cloud
    //require_once "include/sb_inc.php";
    //$HTMLOUT .= top5() . "</div><br /><br />";
    $cats = genrelist();
	$output	=	"";
	$cid	=	(isset($_GET['cat_id'])) ? $_GET['cat_id'] : "0";
	$aid	=	(isset($_GET['active'])) ? $_GET['active'] : "3";
	$pid	=	(isset($_GET['page'])) ? $_GET['page'] : "1";
	$stext	=	(isset($_GET['search'])) ? htmlspecialchars($_GET['search']) : "";
	
	$output.=	"<input type=\"hidden\" id=\"cater\" value=\"" . $cid . "\" />";
	$output.=	"<input type=\"hidden\" id=\"active\" value=\"" . $aid . "\" />";
	$output.=	"<input type=\"hidden\" id=\"page\" value=\"" . $pid . "\" />";

	$cattotal = count($cats);
	$i		=	2;
	$output.=	"<center><a href=\"javascript:view_cate('view_cate_area', 'view_cate_link');\"><font id=\"view_cate_link\"><img border='0' src=\"pic/plus2.gif?v=2\"/> Show categories</font></a><div id=\"view_cate_area\" style=\"display:none;\"><script type=\"text/javascript\"> if (readCookie('ViewCategoriesXz')) view_cate('view_cate_area', 'view_cate_link'); </script><br /><center><span class=\"ajaxclicker active\" id=\"actimg1\" onmousedown=\"document.getElementById('active').value='1'; doActBg('1','3');\" onclick=\"doBrowse();\"><span><font color='#ffffff'>Active Only</font></span></font></span>\n";
	$output.=	"<span class=\"ajaxclicker active\" id=\"actimg2\" onmousedown=\"document.getElementById('active').value='2'; doActBg('2','3');\" onclick=\"doBrowse();\"><span><font color='#ffffff'>Dead Only</span></font></span>\n";
	$output.=	"<span class=\"ajaxclicker active_on\" id=\"actimg3\" onmousedown=\"document.getElementById('active').value='3'; doActBg('3','3');\" onclick=\"doBrowse();\"><span><font color='#ffffff'>Active+Dead</span></font></span><br />\n";
	$output.=	"<span class=\"ajaxclicker categories_on\" id=\"catimg0\" onmousedown=\"document.getElementById('cater').value='0'; doCatBg('0','" . $cattotal . "');\" onclick=\"doBrowse();\"><span><font color='#ffffff'>All</span></font></span>\n";
       foreach($cats as $cat){
		$output	.=	"<span class=\"ajaxclicker categories\" id=\"catimg" . $cat['id'] . "\" onmousedown=\"document.getElementById('cater').value='" . $cat['id'] . "'; doCatBg('" . $cat['id'] . "','" . $cattotal . "');\" onclick=\"doBrowse();\"><span><font color='#ffffff' align='center'>" . $cat['name'] . "</font></span></span>\n";

		if($i	==8){
			$output.=	"<br />";

			$i = 1;
		} else {
			$i++;	
		}
	}
		$output.=	"</div><center><table class=row3 border=0 cellspacing=0 cellpadding=0><tr><td ><center><span><strong>Search: </strong><input x-webkit-speech type=\"text\" style=\"width: 240px;\" onkeyup=\"doBrowse();\" value=\"" . $stext . "\"  id=\"searchtors\" /></span>&nbsp;<span><a href=getrss.php><img src=/pic/rss.png width=24 height=24 alt=RSS Feed title=RSS Feed border=0 /></a></span><br /><br /><center><b>Can't find what you want? </b><a href=viewrequests.php?add_request=1><b>Request it Here!</b></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>Also check out </b><a href=seedersneeded.php><b>Torrents needing seeds</b></a><br></table>\n";

/////////////////////// HTML OUTPUT //////////////////////////////
    print stdhead();
      if ($CURUSER["class"] >= UC_USER)
  {
/** shoutbox display **/
if ($CURUSER['shoutbox'] == 'yes')
require_once("ajaxchat.php");
$shout_toggle = ($CURUSER['shoutbox'] === 'no' ? '<center><a href=\'shoutbox.php?shout=yes\'><b><font color=green>Turn Shoutbox on</b></font></a><p>' : '');
echo $shout_toggle;
}
//top5();
	print $output;
	$btors	=	new browseTorrents;
	print("<fieldset border=\"0\" id=\"browsecontent\">");
	print($btors->getTorrentList());
	print("</fieldset >");
	print("<script type=\"text/javascript\">doCatBg('" . $cid . "','" . $cattotal . "'); doActBg('" . $aid . "','3'); doBrowse();</script>");
	print stdfoot();

?>

Last edited by sharpie; 6th January 2013 at 17:34.
Reply With Quote