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
2013-01-31 22:48:32
not really sure LOL!! my server has not switched over to an new month yet..
Unknown User
2013-02-01 02:27:42
ok seems an bug in the crediting of new month:(

1st sql i fixed on my site so dont get credited over and over again...

in what ever you use to edit the db

ALTER TABLE `motm` ADD `credit` enum('yes','no') NOT NULL default 'no',



then

in cleanup.php replace



//== Start member of the month

$motmdateget = SQL_Query_exec("SELECT win_month,year from motm WHERE last_winner ='1'");

$motmdategot = mysql_fetch_array($motmdateget);

$motmdate = $motmdategot[0];

$motmyear = $motmdategot[1];

$mdate = date("m");

$myear = date("y");

if ($motmdate < $mdate) {

   $sql32 = "SELECT id, points FROM motm WHERE points > '0' && year =" . $myear . " 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"];

       $motmdateget = SQL_Query_exec("SELECT win_month from motm WHERE last_winner ='1'");

       $motmdategot = mysql_fetch_array($motmdateget);

       $motmdate = $motmdategot[0];

       SQL_Query_exec("UPDATE motm SET last_winner = '0' WHERE last_winner = '1'");

       SQL_Query_exec("UPDATE motm SET last_winner = '1' WHERE id = '$id_motm'");

       //to give seeder bonus

       SQL_Query_exec("UPDATE users SET seedbonus = seedbonus+300 WHERE id = '$id_motm'");

       SQL_Query_exec("UPDATE motm SET win_month = '$mdate', last_winner_points = '$pos' WHERE id = '$id_motm'");

       SQL_Query_exec("UPDATE motm SET points = '0'");

       SQL_Query_exec("UPDATE motm SET last_winner_points = '0' WHERE last_winner = '0'");

   } //$row_motm = mysql_fetch_array($mysql_result_motm)

} //$motmdate < $mdate && $motmyear == $myear

//== End member of the month

with




//== Start member of the month

$motmdateget = SQL_Query_exec("SELECT win_month,year,credit from motm WHERE last_winner ='1'");

$motmdategot = mysql_fetch_array($motmdateget);

$motmdate = $motmdategot[0];

$motmyear = $motmdategot[1];

$mdate = date("m");

$myear = date("y");

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 . " 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"];

       $motmdateget = SQL_Query_exec("SELECT win_month from motm WHERE last_winner ='1'");

       $motmdategot = mysql_fetch_array($motmdateget);

       $motmdate = $motmdategot[0];

       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'");

           SQL_Query_exec("UPDATE users SET seedbonus = seedbonus+300 WHERE id = '$id_motm'");

           SQL_Query_exec("UPDATE motm SET points = '0'");

           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



Once someone tests this and reports back it works... I will update the 1st post!
Unknown User
2013-02-01 09:17:31
OK i tried this way but nothing I still get: there was no last month winner

my db is:

CREATE TABLE `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;

I did add this to my cleanup.php


//== Start member of the month
$motmdateget = SQL_Query_exec("SELECT win_month,year,credit from motm WHERE last_winner ='1'");
$motmdategot = mysql_fetch_array($motmdateget);
$motmdate = $motmdategot[0];
$motmyear = $motmdategot[1];
$mdate = date("m");
$myear = date("y");
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 . " 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"];
$motmdateget = SQL_Query_exec("SELECT win_month from motm WHERE last_winner ='1'");
$motmdategot = mysql_fetch_array($motmdateget);
$motmdate = $motmdategot[0];
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'");
SQL_Query_exec("UPDATE users SET seedbonus = seedbonus+300 WHERE id = '$id_motm'");
SQL_Query_exec("UPDATE motm SET points = '0'");
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

and if this would help - when i start cleanup.php manual by typing it in browser www.mysite.com/backend/cleanup.php
i get this message .


Fatal error: Call to undefined function SQL_Query_exec() in /home/divxhunt/public_html/backend/cleanup.php on line 305

Line 305 is:


$motmdateget = SQL_Query_exec("SELECT win_month,year,credit from motm WHERE last_winner ='1'");

THANKS!
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6536"]cleanup.php[/url]

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6537"]index.php[/url]

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6538"]functions.php[/url]
cleanup.php
Download
index.php
Download
functions.php
Download
Unknown User
2013-02-01 15:21:54
that error is about right you should not be able to view cleanup. directly anyway... its called via another script LOL!!!

You added the new stuff in the wrong place in cleanup.php  :(  I have fixed that and added a php comment.

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6539"]cleanup.php[/url]

if you want to run cleanup without waiting the needed time for it to run auto then use siteurl/admincp.php?action=forceclean
cleanup.php
Download
Unknown User
2013-02-01 15:41:28
OK thanks for the fix and the comment I understand now ...

but still no last month winner ...  :(

and I have checked the MOD by first post and all but the cleanup.php seams to be at his place

Now, i got this script running and gathering points the whole month and they are stored in to db correctly so the code for the gathering part is correct...

THANKS
Unknown User
2013-02-01 19:50:26
not sure what to tell you... i guess I will play around with it on dev site.. my only guess you dont have anything in motm for last month or something LOL!!!
Unknown User
2013-02-01 20:39:38
anyway I know this works in cleanup...



//== 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 = $motmdategot[0];

$motmyear = $motmdategot[1];

$mdate = date("m");

$myear = date("y");

$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 . " 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"];

       $motmdateget = SQL_Query_exec("SELECT win_month from motm WHERE last_winner ='1'");

       $motmdategot = mysql_fetch_array($motmdateget);

       $motmdate = $motmdategot[0];

       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'");

           SQL_Query_exec("UPDATE users SET seedbonus = seedbonus+300 WHERE id = '$id_motm'");

           SQL_Query_exec("UPDATE motm SET points = '0'");

           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

Unknown User
2013-02-01 22:12:38
"ArcticWolf, post: 88585":
not sure what to tell you... i guess I will play around with it on dev site.. my only guess you dont have anything in motm for last month or something LOL!!!

no I have entries :

Table structure for table motm

|------
|Column|Type|Null|Default
|------
|//**id**//|varchar(10)|No|
|points|decimal(10,1)|No|0.0
|//**month**//|tinyint(2)|No|
|//**year**//|tinyint(4)|No|
|last_winner|varchar(10)|No|
|last_winner_points|varchar(10)|No|
|win_month|tinyint(2)|No|
|credit|enum('yes', 'no')|No|no
== Dumping data for table motm

|139|70.0|12|12|1|1.0|12|no
|322|3.0|12|12| | |0|no
|24|1.0|12|12| | |0|no
|317|1.0|12|12| | |0|no
|329|9.0|12|12| | |0|no
|38|6.0|12|12| | |0|no
|292|2.0|12|12| | |0|no
|347|1.0|12|12| | |0|no
|147|3.0|12|12| | |0|no
|178|1.0|12|12| | |0|no
|129|4.0|12|12| | |0|no
|2|28.0|12|12| | |0|no
|4|4.0|12|12| | |0|no
|275|3.0|1|13| | |0|no
|139|266.0|1|13| | |0|no
|147|76.0|1|13| | |0|no
|292|43.0|1|13| | |0|no
|24|3.0|1|13| | |0|no
|10|10.0|1|13| | |0|no
|408|1.0|1|13| | |0|no
|410|15.0|1|13| | |0|no
|57|43.0|1|13| | |0|no
|280|1.0|1|13| | |0|no
|355|11.0|1|13| | |0|no
|422|2.0|1|13| | |0|no
|489|3.0|1|13| | |0|no
|493|1.0|1|13| | |0|no
|524|1.0|1|13| | |0|no
|336|3.0|1|13| | |0|no
|544|3.0|1|13| | |0|no
|553|53.0|1|13| | |0|no
|546|6.0|1|13| | |0|no
|2|3.0|1|13| | |0|no
|38|6.0|1|13| | |0|no
|641|6.0|1|13| | |0|no
|292|10.0|2|13| | |0|no
|355|22.0|2|13| | |0|no
|139|50.0|2|13| | |0|no
|553|22.0|2|13| | |0|no
== Table structure for table motm

|------
|Column|Type|Null|Default
|------
|//**id**//|varchar(10)|No|
|points|decimal(10,1)|No|0.0
|//**month**//|tinyint(2)|No|
|//**year**//|tinyint(4)|No|
|last_winner|varchar(10)|No|
|last_winner_points|varchar(10)|No|
|win_month|tinyint(2)|No|
|credit|enum('yes', 'no')|No|no

P.S.

I added the above clean... code and still no result
Unknown User
2013-02-01 23:27:33
blah could you export your motd with data for me to try, it dont have any really identifying data in it other then userid and those change per site anyway.. once you export it copy/paste the info into sql or code boxes here [ sql ] what ever... [ /sql ] without well the spaces after [ and before ]
Unknown User
2013-02-01 23:57:45
here's my motm.sql

AW:Ty: Attachment removed for privacy issues
Unknown User
2013-02-02 01:28:13
ah i see.. in cleanup part, replace all the member of the month cleanup with



//== 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


I know this works.. I used your motd info hehehe.. I have an backup of mine anyway on dev site.
Unknown User
2013-02-02 09:22:47
Yes it does work perfect!

Thanks for your time and effort!
Unknown User
2013-02-16 02:26:23
I installed this mod from the first post and works perfectly. Thanks ArcticWolf
I think it would be necessary also a code in login_block.php so that each user can see how many points has receive in the current month.

Something like that:

$query = "SELECT * FROM motm WHERE id='$CURUSER[id]' && month = ".date("m")." && year = ".date("y")."";
$result = SQL_Query_exec($query);
$motm = mysql_fetch_array($result);
$points = $motm['points'];
echo "Activity Bonus: <b>$points</b>";

And maybe into account-details.php also, for the staff eyes.
Unknown User
2013-02-16 03:58:24
Thats kind of easy to do to.. In blocks/login_block

find

$privacylevel = T_($CURUSER["privacy"]);
or something close to it and after add


    $motm_current_query = @mysql_fetch_row(@SQL_Query_exec("SELECT motm.points FROM motm WHERE month = " . date("m") . " && year = " . date("y") . " && id = ".$CURUSER["id"]));

   $motm_current =  number_format(0+$motm_current_query[0],1);




now find something like

<br />" . T_("RATIO") .": $userratio



after add



<br />Current Member of the Month Points: ".$motm_current."





in account-details.php

find something like

$numcomments = get_row_count("comments", "WHERE user = $id");

and after add



$motm_current_query = @mysql_fetch_row(@SQL_Query_exec("SELECT motm.points FROM motm WHERE month = " . date("m") . " && year = " . date("y") . " && id = ".$user["id"]));

$motm_current =  number_format(0+$motm_current_query[0],1);




now farther down find something like

 <?php echo T_("RATIO"); ?>: <?php echo $ratio?><br />



or where ever you want to display it and add



 Current Member of the Month Points: <?php echo $motm_current?><br />





while at it in account-details i would change



<?php echo T_("RATIO"); ?>: <?php echo $ratio?><br />



to



<?php echo T_("RATIO"); ?>: <?php echo number_format($ratio,2)?><br />


basically sets it to 2 decimals after the number instead of unlimited like it was.. up to you thought I think looks better
Unknown User
2013-02-16 06:17:20
Thank you, both codes works properly  :)

Maybe you should update the first post, to be complete.
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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728