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
[REQ] Member of the month for 2.08+!
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2012-12-21 21:25:41
DELETE WHAT EVER YOU HAD FROM THE OLD ADDON FOR MEMBER OF THE MONTH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DONT COME CRYING IF DONT WORK CAUSE YOU USING PARTS OF BOTH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
i take no credit for this mod, its from http://www.torrentt...er-of-the-month
and i just modified it to be useable in 2.08 and fixed alot of querys within querys.

1st database

DROP TABLE IF EXISTS `motm`;
CREATE TABLE IF NOT EXISTS `motm` (
`id` varchar(10) NOT NULL,
`points` decimal(10,1) NOT NULL DEFAULT '0.0',
`month` tinyint(2) NOT NULL,
`year` tinyint(4) NOT NULL,
`last_winner` varchar(10) NOT NULL,
`last_winner_points` varchar(10) NOT NULL,
`win_month` tinyint(2) NOT NULL,
`credit` enum('yes','no') NOT NULL DEFAULT 'no',
UNIQUE KEY `id_month_year` (`id`,`month`,`year`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
if you have my old motd db info from before 02/01/2013
then

ALTER TABLE `motm` ADD `credit` enum('yes','no') NOT NULL default 'no';
in config file add

//====motm
$site_config["maxmotm"] = 4; //max class for motm current set to uploader

New Cleanup Code 02/01/2013
in cleanup add before

//OPTIMIZE TABLES


//== Start member of the month
$debug = 0;
$motmdateget = SQL_Query_exec("SELECT win_month,year,credit from motm WHERE last_winner ='1'");
$motmdategot = mysql_fetch_array($motmdateget);
$motmdate = (int) $motmdategot[0];
$motmyear = $motmdategot[1];
$mdate = date("m");
$myear = date("y");
if ($motmdate == 12 && $mdate > 1)
$motmdate = 1;
if ($motmdate == 0 || $motmdate == '')
$motmdate = (date("m") - 1);

$mdate1 = (date("m") - 1);
if ($motmdate < $mdate) {
$motmdateget1 = SQL_Query_exec("SELECT win_month,year,credit from motm WHERE win_month = '$mdate'");
$motmdategot1 = mysql_fetch_array($motmdateget1);
$motcredit = $motmdategot1[2];
$sql32 = "SELECT id, points FROM motm WHERE points > '0' && year =" . $myear . " && month =" . $motmdate . " ORDER BY points DESC LIMIT 1";
$mysql_result_motm = SQL_Query_exec($sql32);
while ($row_motm = mysql_fetch_array($mysql_result_motm)) {
$nextmonth = (date(m) + 1);
$id_motm = $row_motm['id'];
$pos = $row_motm["points"];
$motmdateget3 = SQL_Query_exec("SELECT win_month from motm WHERE last_winner ='1'");
$motmdategot3 = mysql_fetch_array($motmdateget3);
$motmdate3 = $motmdategot3[0];
if ($motmdate3 == 12 && $mdate > 1)
$motmdate3 = 1;
if ($motmdate3 == 0 || $motmdate3 == '')
$motmdate3 = (date("m") - 1);
if ($motcredit != 'yes') {
SQL_Query_exec("UPDATE motm SET last_winner = '0' WHERE last_winner = '1'");
SQL_Query_exec("UPDATE motm SET win_month = '$mdate', last_winner_points = '$pos', last_winner = '1', credit='yes' WHERE id = '$id_motm' && month = $motmdate && year = " . $myear . "");
SQL_Query_exec("UPDATE users SET seedbonus = seedbonus+300 WHERE id = '$id_motm'");
// SQL_Query_exec("UPDATE motm SET points = '0' where month!='$mdate'");
SQL_Query_exec("UPDATE motm SET last_winner_points = '0' WHERE last_winner != '1'");
} //$motcredit != 'yes'
} //$row_motm = mysql_fetch_array($mysql_result_motm)
} //$motmdate < $mdate
//== End member of the month

[size=18px]UPDATED:::[/size]

to make it easier to extend to other things I have made the adding part for the motm an function
in backend/functions.php before the very last

?>
add

function motmadd($id,$v,$class,$maxmotm) {
if ($class <= $maxmotm) {
SQL_Query_exec("INSERT INTO motm (id, points, month, year) VALUES (" . sqlesc($id) . ", " . sqlesc($v) . ", " . sqlesc(date("m")) . ", " . sqlesc(date("y")) . ") ON DUPLICATE key UPDATE points = points+" . $v);
} //$class <= $maxmotm
}
in index where u want it to show

// Display Code
begin_frame("Member of the Month");
echo '<table border="0" cellspacing="0" cellpadding="0" class="forumline" align="left" width=400><tr><td>';
echo "<div align='left'><b><font color=red>Last Months Winner Was</font></b> <br /></div>";
$lastmotmget = SQL_Query_exec("SELECT motm.id, motm.last_winner_points, users.username, users.class FROM motm LEFT JOIN users ON motm.id = users.id WHERE last_winner ='1' && year = " . date("y"));
if (mysql_num_rows($lastmotmget) > 0) {
$lastmotmgot = mysql_fetch_array($lastmotmget);
$lastmotm = $lastmotmgot[0];
$usrwp = $lastmotmgot['last_winner_points'];
// $username_motm = class_user($lastmotmgot['username']); // <-- Use this if you have class_user function
// $username_motm = "<font color='" . get_class_color($lastmotmgot['class']) . "'>" . $lastmotmgot[username] . "</font>"; // Use this if have get_class_color function
$username_motm = $lastmotmgot['username']; // use this if totally stock:(
echo "<div align='left'><a href=account-details.php?id=" . $lastmotmgot[id] . ">" . $username_motm . "</a> with <font color=yellow>" . $usrwp . "</font> points.<br />and won 300 Seed points.<br /> <br /></div>"; // edit this line to reflect your bonus
} //mysql_num_rows($res) > 0
else {
echo "<div align='left'><b><font color='DarkGoldenRod'>There was no Last Months Winner</font></b> <br /></div>";
}
//////////////////////////////////

///// Member of the Month Hack by Biglad //////
/////// Show Current Top 5 ///////
echo "<b><font color=red>Top 5 for ";
echo date(F);
echo "<br /></b></font>";
$sql32 = "SELECT motm.id, motm.points, users.username, users.class FROM motm LEFT JOIN users ON motm.id = users.id WHERE points > '0' && month = " . date("m") . " && year = " . date("y") . " ORDER BY points DESC LIMIT 5";
$mysql_result_motm = SQL_Query_exec($sql32);
if (mysql_num_rows($mysql_result_motm) > 0) {
echo '<table class="ftable" border="0" cellspacing="0" cellpadding="0">';
while ($row_motm = mysql_fetch_array($mysql_result_motm)) {
$id_motm = $row_motm['id'];
$pos = $row_motm["points"];
$usrname = $row_motm['username'];
// $username_motm = class_user($usrname); // <-- Use this if you have class_user function
// $username_motm = "<font color='" . get_class_color($row_motm['class']) . "'>" . $lastmotmgot[username] . "</font>"; // Use this if have get_class_color function
$username_motm = $usrname; // use this if totally stock:(
echo "<div align='left'><tr>";
echo "<td><a href=account-details.php?id=$id_motm>" . $username_motm . "</a></td><td width='70'> - Points <font color='DarkMagenta'>" . $pos . "</font></td>";
echo "</tr></div>";
//echo "<strong><div align='left'><a href=account-details.php?id=$id_motm>".$usrname."</a> - POINTS ".$pos."</strong><br />";
} //$row_motm = mysql_fetch_array($mysql_result_motm)
echo "</table>";
} //mysql_num_rows($mysql_result_motm) > 0
echo '</td></tr></table>';
end_frame();
in torrents-details

find

//take comment add
if ($_GET["takecomment"] == 'yes'){
loggedinonly();
$commentbody = $_POST['body'];

if (!$commentbody)
show_error_msg("Error","You did not enter anything!",1);

mysql_query("UPDATE torrents SET comments = comments + 1 WHERE id = $id") or die(mysql_error());

add after

$motm_value = 3;
motmadd($CURUSER["id"],$motm_value,$CURUSER['class'],$site_config['maxmotm']);
still in torrent details

find

//take rating
if ($_GET["takerating"] == 'yes'){
$rating = (int)$_POST['rating'];

if ($rating <= 0 || $rating > 5)
show_error_msg("Rating Error", "Invalid rating",1);

add after

$motm_value = 1;
motmadd($CURUSER["id"],$motm_value,$CURUSER['class'],$site_config['maxmotm']);
open shoutbox.php

find

$query = "INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, '".$CURUSER['username']."', ".$_POST['message'].", '".get_date_time()."', '".$CURUSER['id']."')";
SQL_Query_exec($query);
after add

$motm_value = 1;
motmadd($CURUSER["id"],$motm_value,$CURUSER['class'],$site_config['maxmotm']);
comments.php

find

SQL_Query_exec("INSERT INTO comments (user, ".$type.", added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " . sqlesc($body).")");
after add

$motm_value = 1;
motmadd($CURUSER["id"],$motm_value,$CURUSER['class'],$site_config['maxmotm']);stock 2.08 forums.php

find

SQL_Query_exec("INSERT INTO forum_topics (userid, forumid, subject) VALUES($userid, $forumid, $subject)");
$topicid = mysql_insert_id() or showerror(T_("FORUM_ERROR"),"No topic ID returned");
after add

$motm_value = 2;
motmadd($userid,$motm_value,$CURUSER['class'],$site_config['maxmotm']);
then find

SQL_Query_exec("INSERT INTO forum_posts (topicid, userid, added, body) VALUES($topicid, $userid, $added, $body)");
$postid = mysql_insert_id() or showerror(T_("FORUM_ERROR"),"Post id n/a");
after add

$motm_value = 1;
motmadd($userid,$motm_value,$CURUSER['class'],$site_config['maxmotm']);
your members get member of the month points for talking in the shoutbox , rating a torrent , commenting on a torrent, making a new forum topic (if you have stock forums), making a new forum post (again if you have stock forums)

im sure it can be implemented into other things aswell

have fun

I guess tech you could take the display part and make it into an block.. But I dont like blocks with too many querys in them.. slows down loading the whole site:(
ps: I cant find the orginal thanks.php my guess its no longer in 2.08 or was an addon, its not too hard to extend this to other pages, just post what page and I will try and help you if it have it aka its in 2.08 stock LOL..
ps: I dont know if the monthly thing works LOL!! I did not figure you wanted me waiting around to find out LOL!! before releasing it.

Edit 12/25/2012: I have added an block if people wants it, it uses an cache and should help on load issues with the querys.
FIXED: [url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6422"]motm_block.php[/url]

If you want to use the block i have attached motm_block.php just upload it to blocks then add and activate it in normal admincp.php part.

ajax-shout.. in thory this might work.. dont really know ... rofl or care about versions lower then 2.08.. this is an 2.08 addon!!!!
in sendshout.php

replace

# adds new data to the database
function addData($name,$text,$uid) {
require_once("backend/functions.php"); # getting table prefix
$now = get_date_time();
$sql = "INSERT INTO ajshoutbox (date,name,text,uid) VALUES ('".$now."','".$name."','".$text."','".$uid."')";
$conn = getDBConnection();
$results = mysql_query($sql, $conn);
if (!$results || empty($results)) {
# echo 'There was an error creating the entry';
end;
}
}
with

# adds new data to the database
function addData($name,$text,$uid) {
require_once("backend/functions.php"); # getting table prefix
global $CURUSER,$site_config;
$now = get_date_time();
$sql = "INSERT INTO ajshoutbox (date,name,text,uid) VALUES ('".$now."','".$name."','".$text."','".$uid."')";
$conn = getDBConnection();
$results = mysql_query($sql, $conn);
if (!$results || empty($results)) {
# echo 'There was an error creating the entry';
end;
}
$motm_value = 1;
motmadd$uid,$motm_value,$CURUSER['class'],$site_config['maxmotm']);
}




This part is only if your servers os or something dont support the DUPLICATE key part.. Its kind of lame LOL 3 querys to do the same thing as 1 DUPLICATE key......
This part is for the people that dont have DUPLICATE key option in there os... Its highly untested cause well I have an real os and not winblows or something.....
but in backend/functions.php before the very last

?>
replace

function motmadd($id,$v,$class,$maxmotm) {
if ($class <= $maxmotm) {
SQL_Query_exec("INSERT INTO motm (id, points, month, year) VALUES (" . sqlesc($id) . ", " . sqlesc($v) . ", " . sqlesc(date("m")) . ", " . sqlesc(date("y")) . ") ON DUPLICATE key UPDATE points = points+" . $v);
} //$class <= $maxmotm
}
with


function motmadd($id,$v,$class,$maxmotm) {
if ($class < $maxmotm)
{
$query = mysql_fetch_row(SQL_Query_exec("SELECT COUNT(*) FROM `motm` WHERE `id` = '{$id}' AND month = ".sqlesc(date("m"))." AND year = ".sqlesc(date("y"))));
if ($query[0] == 0)
{
SQL_Query_exec("INSERT INTO `motm` (`id`, `month`, `year`, `points') VALUES ('" . $id . "', ".sqlesc(date("m")).", ".sqlesc(date("y")).", ".sqlesc($v).")");
} else {
SQL_Query_exec("UPDATE `motm` SET `points` = `points` + 1 WHERE `id` = '" . $CURUSER["id"] . "'' AND month = ".sqlesc(date("m"))." AND year = ".sqlesc(date("m")));
}
}
}
2012-12-29_0022.png
2012-12-29_0022.png
motm_block.php
Download
Unknown User
2012-12-26 13:39:05
I am using colly's Ajax shoutbox. So what will be the code and where to put it please.

Thanks in advance
Unknown User
2012-12-26 19:52:47
Thanx artic but cant see Nickname before -points =(



/////// Show Current Top 5 ///////

echo "<b><font color=red>Top 5 for ";

echo date(F);

echo "<br /></b></font>";

$sql32 = "SELECT motm.id, motm.points, users.username, users.class FROM motm LEFT JOIN users ON motm.id = users.id WHERE points > '0' && month = " . date("m") . " && year = " . date("y") . " ORDER BY points DESC LIMIT 5";

$mysql_result_motm = SQL_Query_exec($sql32);

if (mysql_num_rows($mysql_result_motm) > 0) {

echo '<table class="ftable" border="0" cellspacing="0" cellpadding="0">';

while ($row_motm = mysql_fetch_array($mysql_result_motm)) {

$id_motm = $row_motm['id'];

$pos = $row_motm["points"];

$usrname = $row_motm['username'];

// $username_motm = class_user($usrname); // <-- Use this if you have class_user function

// $username_motm = "<font color='" . get_class_color($row_motm['class']) . "'>" . $lastmotmgot[username] . "</font>"; // Use this if have get_class_color function

$username_motm = $usrname; // use this if totally stock:(

echo "<div align='left'><tr>";

echo "<td><a href=account-details.php?id=$id_motm>" . $username_motm . "</a></td><td width='70'> - Points <font color='DarkMagenta'>" . $pos . "</font></td>";

echo "</tr></div>";

//echo "<strong><div align='left'><a href=account-details.php?id=$id_motm>".$usrname."</a> - POINTS ".$pos."</strong><br />";

} //$row_motm = mysql_fetch_array($mysql_result_motm)

echo "</table>";

} //mysql_num_rows($mysql_result_motm) > 0

end_frame();




echo "<td><a href=account-details.php?id=$id_motm>" . $username_motm . "</a></td><td width='70'> - Points <font color='DarkMagenta'>" . $pos . "</font></td>";

Unknown User
2012-12-26 20:43:42
not really sure what you mean "cant see".. if the person dont have any points of course they not listed.... Amagine an list on a big site LOL if everyone listed... 4000000 people.... ROFL!!!!!
Unknown User
2012-12-26 21:06:00
http://bildr.no/view/1351881
Unknown User
2012-12-26 21:45:39
i dont get it.. you using 2.08?? if not call someone else that cares:)

you could try.. dont know why that would make an difference thought maybe you using winblows or something...

change

echo "<td><a href=account-details.php?id=$id_motm>" . $username_motm . "</a></td><td width='70'> - Points <font color='DarkMagenta'>" . $pos . "</font></td>";
to


echo "<td><a href=account-details.php?id=".$row_motm['id'].">" . $row_motm['username'] . "</a></td><td width='70'> - Points <font color='DarkMagenta'>" . $pos . "</font></td>";



my other guess is you did not drop the old table if had it



DROP TABLE IF EXISTS `motm`;


table totally changed!!! the old way he had it before was lame due to not tracking year...

I tried my original version on every theme I got and its fine!!!
Unknown User
2012-12-26 22:50:44
still same, its a server with CentOS tt 2.08

i have dropped, but havent installed the old mod
Unknown User
2012-12-27 01:26:30
my guess you got some weird mysql version that dont allow joins... good luck using true 2.08+ stuff...

having 200000000000 querys just to do the same thing as 1 join is so lame and old and bad on server load!!!!

either that or you messed up some place in the adding to the db and its adding an 0 for the id number or something.. GOD knows!!!
Unknown User
2012-12-27 01:49:37
thats true, its to many mods, from different versions
Unknown User
2012-12-28 07:42:04
thanks you
Unknown User
2012-12-29 03:51:49
its works fine but my theme on the bottom goes crazy

before I put code in index.php



after I have put code in index.php



I have added the motm_block.php  and its the same. any way to fix it and thanks.
Unknown User
2012-12-29 07:13:24
could be something to do with your theme.. dont know I cant find that theme test with .. Oh i see now its an paid theme.. oh well..
Unknown User
2012-12-29 07:34:19
you could try this in index:

// Display Code
begin_frame("Member of the Month");
echo '<table border="0" cellspacing="0" cellpadding="0" class="forumline" align="left" width=400><tr><td>';
echo "<div align='left'><b><font color=red>Last Months Winner Was</font></b> <br /></div>";
$lastmotmget = SQL_Query_exec("SELECT motm.id, motm.last_winner_points, users.username, users.class FROM motm LEFT JOIN users ON motm.id = users.id WHERE last_winner ='1' && year = " . date("y"));
if (mysql_num_rows($lastmotmget) > 0) {
$lastmotmgot = mysql_fetch_array($lastmotmget);
$lastmotm = $lastmotmgot[0];
$usrwp = $lastmotmgot['last_winner_points'];
// $username_motm = class_user($lastmotmgot['username']); // <-- Use this if you have class_user function
// $username_motm = "<font color='" . get_class_color($lastmotmgot['class']) . "'>" . $lastmotmgot[username] . "</font>"; // Use this if have get_class_color function
$username_motm = $lastmotmgot['username']; // use this if totally stock:(
echo "<div align='left'><a href=account-details.php?id=" . $lastmotmgot[id] . ">" . $username_motm . "</a> with <font color=yellow>" . $usrwp . "</font> points.<br />and won 300 Seed points.<br /> <br /></div>"; // edit this line to reflect your bonus
} //mysql_num_rows($res) > 0
else {
echo "<div align='left'><b><font color='DarkGoldenRod'>There was no Last Months Winner</font></b> <br /></div>";
}
//////////////////////////////////

///// Member of the Month Hack by Biglad //////
/////// Show Current Top 5 ///////
echo "<b><font color=red>Top 5 for ";
echo date(F);
echo "<br /></b></font>";
$sql32 = "SELECT motm.id, motm.points, users.username, users.class FROM motm LEFT JOIN users ON motm.id = users.id WHERE points > '0' && month = " . date("m") . " && year = " . date("y") . " ORDER BY points DESC LIMIT 5";
$mysql_result_motm = SQL_Query_exec($sql32);
if (mysql_num_rows($mysql_result_motm) > 0) {
echo '<table class="ftable" border="0" cellspacing="0" cellpadding="0">';
while ($row_motm = mysql_fetch_array($mysql_result_motm)) {
$id_motm = $row_motm['id'];
$pos = $row_motm["points"];
$usrname = $row_motm['username'];
// $username_motm = class_user($usrname); // <-- Use this if you have class_user function
// $username_motm = "<font color='" . get_class_color($row_motm['class']) . "'>" . $lastmotmgot[username] . "</font>"; // Use this if have get_class_color function
$username_motm = $usrname; // use this if totally stock:(
echo "<div align='left'><tr>";
echo "<td><a href=account-details.php?id=$id_motm>" . $username_motm . "</a></td><td width='70'> - Points <font color='DarkMagenta'>" . $pos . "</font></td>";
echo "</tr></div>";
//echo "<strong><div align='left'><a href=account-details.php?id=$id_motm>".$usrname."</a> - POINTS ".$pos."</strong><br />";
} //$row_motm = mysql_fetch_array($mysql_result_motm)
echo "</table>";
} //mysql_num_rows($mysql_result_motm) > 0
echo '</td></tr></table>';
end_frame();

or code it yourself...
I know works fine on the themes I have and I have close to 90 themes...
just an few shot.. i dont feel like going there all 90.................

Unknown User
2012-12-29 09:48:21
The bottom of the page is good but the top is wrong, and the top was ok before



[size=18px]The Block was good and works Thank you so much[/size]
Unknown User
2013-01-31 20:37:50
Hi!

THANKS for this it counts very well but when it comes to declaring last month winner

I get - there was no last month winner

THANKS!
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: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728