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
Daily Login Bonus
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

Unknown User
2019-07-27 12:57:28
This will add 1 GB to users who login daily credits to (ERvD and Arcticwolf for the sys comment code)

ok first off lets add the SQL


CREATE TABLE IF NOT EXISTS `dailys` (

 `id` int(10) NOT NULL AUTO_INCREMENT,

 `userid` int(10) NOT NULL DEFAULT '0',

 `added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

 `expiry` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

 PRIMARY KEY (`id`)

) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;


now the users SQL


ALTER TABLE `users` ADD `daily` enum('yes','no') NOT NULL DEFAULT 'no';
ALTER TABLE `users` ADD `syscomment` TEXT NOT NULL;


Now open up index.php and find


printf(T_("SHOUTBOX_REFRESH"), 5)."<br />";
   end_frame();
}


Add under


//RESET EVERY 24H DAILY BONUS

if ($CURUSER["daily"] == "yes")

{

$today = get_date_time();

$userid = $CURUSER["id"];

$dres = SQL_Query_exec("SELECT userid, expiry FROM dailys WHERE userid='$userid'");

$daily = mysqli_fetch_assoc($dres);

 if ($CURUSER["id"] == $daily["userid"] && $today >= $daily["expiry"])

 {

  $ddel = SQL_Query_exec("DELETE FROM dailys WHERE userid='$userid'");

  $dup = SQL_Query_exec("UPDATE users SET daily='no' WHERE id='$userid'");

 }

}



//ADD DAILY BONUS

if ($CURUSER['daily'] == "no")

{

$userid = $CURUSER["id"];

$expiry = (int)1;

//1 = 1 one day

$timenow = get_date_time();

$expiretime = get_date_time(gmtime() + (86400 * $expiry));

//86400 = 24H

$dadd = SQL_Query_exec("INSERT INTO dailys (userid, added, expiry) VALUES ('$userid','$timenow','$expiretime')");

$syscomment = $CURUSER["syscomment"];

$syscomment = gmdate("Y-m-d h:i:s A") . " - has been credited his/her daily 1Gb bonus by -System.n <br />". $syscomment;

$syscomment = sqlesc($syscomment);

$dadd = SQL_Query_exec("UPDATE users SET uploaded = uploaded+1073741824,syscomment=$syscomment WHERE id='$userid'");
//1073741824 = 1GB

$dadd = SQL_Query_exec("UPDATE users SET daily='yes' WHERE id='$userid'");

$msg = sqlesc("Your Next Daily Login Bonus Of 1 GB Will Be In: ".$expiretime."");

$added = sqlesc(get_date_time());

@SQL_Query_exec("INSERT INTO messages (sender, receiver, msg, added) VALUES(0, $userid, $msg, $added)");

} else
{ }


save and close

open up account-details.php find



$modcomment = htmlspecialchars($user["modcomment"]);


under add


$syscomment = htmlspecialchars($user["syscomment"]);


find


print("<tr><td>".T_("MOD_COMMENT").": </td><td align='left'><textarea cols='50' rows='10' name='modcomment'>$modcomment</textarea></td></tr>\n");


under add


print("<tr><td>".T_("SYS_COMMENT").": </td><td align='left'><textarea cols='50' rows='10' name='modcomment'>$syscomment</textarea></td></tr>\n");


open up languages/english.php and add


$LANG["SYS_COMMENT"] = "Sys Comment";
2022-07-28 14:02:37
to appear in the chat who received it can be done??  thank you 👍
2022-07-29 14:58:41
You just wrap this in a function and call it if cookie is stored (success) and user of is not 0 or not a INT, push it further and do a SELECT and validate user row against the User Id before proceeding to grant login bonus. I can clean this up a bit on Saturday as I want to use this too (so it needs a light update)
2022-07-29 15:00:08
As for shoutbox, execute a INSERT query on success to the previous checks.
2022-07-29 15:19:21
find
  $ddel = SQL_Query_exec("DELETE FROM dailys WHERE userid='$userid'");
 $dup = SQL_Query_exec("UPDATE users SET daily='no' WHERE id='$userid'");


below add
$msg_shout = "daily login to ".$CURUSER["username"]." ";
SQL_Query_exec("INSERT INTO shoutbox (userid, date, user, message) VALUES(".$userid.", NOW(), ".$CURUSER["username"]." ,".$msg_shout.")");


that should work if i read the code correct.
Last edited by M-jay warn on 2022-07-29 15:20:14
2022-07-29 21:05:32
Wouldnt you wanna change those sql queries to
`added` datetime NOT NULL,
`expiry` datetime NOT NULL,

to avoid that zero date issue? I remember something like that being a problem a little bit
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2022-07-29 21:09:00
2022-07-30 06:47:10
MicroMonkey:
Wouldnt you wanna change those sql queries to
`added` datetime NOT NULL,`expiry` datetime NOT NULL,
to avoid that zero date issue? I remember something like that being a problem a little bit


There is 3 ways of covering that

- add a default field value
- add IFNULL / NOT NULL in query
- handle is_null / != null on PHP side

Either of those work, but doing this on the database side is advised (earlier POC). Null checks on PHP are better used on object state & function return handling imho but it works on database fields all the same.
2022-08-06 13:46:33
it doesn't work it gives me a time error

SQL_Query_exec("INSERT INTO shoutbox (userid, date, user, message) VALUES(".$userid.", NOW(), ".$CURUSER["username"]." ,".$msg_shout.")");


(userid, ///date,///// user, message)
2022-08-06 21:22:16
inline change
NOW()
With
".get_date_time()."
2022-08-10 21:00:17
error no longer gives
but nothing happens when I get pm that I received in chat
2022-08-11 02:21:41
Why did the SQL_Exec() function never get  prepared parameters? I think part of the issue is the complexity when dealing with external calls inline with the query string itself.

I know, myself looking at that just feels overly complicated and confusing even though I know PHP.  Just a side note.

There’s still time to do this to that class.

Last edited by STorrents2020 on 2022-08-11 02:22:40
2022-08-12 16:01:43
this doesn't get enough attention from v3 users https://torrenttrader.uk/post?id=10390

although the class is still used (& working) the querys should be updated to prepared, time consuming but simple modernisation

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