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
Cleanup - Ignoring column
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2020-08-06 12:32:49
I am trying to update this cleanup to instead of

UPDATE users SET enabled = 'no'

I use

UPDATE users SET limited = 'yes'

And refuses to update column no matter what I throw at it. I put this same query on index.php and it works without a hitch.

This field type is ENUM DEFAULT 'no'


       // Limit warned users
       $res = SQL_Query_exec("SELECT users.id, users.username, UNIX_TIMESTAMP(warnings.expiry) AS expiry FROM users INNER JOIN warnings ON users.id=warnings.userid WHERE type='Poor Ratio' AND active = 'yes' AND account_limited = 'no' AND class = 1 AND enabled='yes' AND warned = 'yes' AND uploaded / downloaded < $minratio AND downloaded >= $downloaded");
       if (mysql_num_rows($res) > 0) {
           $timenow = get_date_time();
           $expires = (86400 * $length);
           while ($arr = mysql_fetch_assoc($res)) {
               if (gmtime() - $arr["expiry"] >= 0) {
               
                   // Send to Shoutbox - Low Ratio user limited
                   $limiteduser = $arr["username"];
                   $event = $arr["username"] . " has been limited (Auto Leech warning).";
                   SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, '$limiteduser', '$event', NOW(), 0)");
                   SQL_Query_exec("UPDATE users SET account_limited = 'yes', warned = 'no' WHERE id='" . $arr["id"] . "'");
                   write_log("User <a href='/user/?id=" . $arr["id"] . "'>" . $arr["username"] . "</a> has been <b>limited</b> (Auto Leech warning).");
               }
           }
       }


I can't figure it out. Maybe someone has an idea of the voodoo going on here, rarely do I have these issues and usually have success on first attempt.
Logs and Shoutbox show nothing reflecting the code block above, nor does the table. As soon as I revert changes, immediately its banning people again (2500+). :mad:
2020-08-06 13:37:58
Limited or account_limited ?

Have you tried viewing output
$var = SQL_Query_exec(
dump_var($var);

Nevermind just noticed account_limited in other query
2020-08-06 13:44:39
it is now users.limited (limited). ENUM default 'no'.

Oh man your right, what am I doing. Long hours I think. var_dump is a staple in my work. Big thanks again.

I figured it out in this regard:

The issue (banning, whatever was originally there) is this condition

if (gmtime() - $arr["expiry"] >= 0) { .. }

Now what that tells me is if users timezone is less than their expiry time in users.warnings, then continue to query. I comment this out, and suddenly its working. Do you know if this condition is important? Im sure it is, but can I get past it safely?
2020-08-06 14:15:29
Not sure if gmtime is user timezone
It returns sql_timestamp_to_unix_timestamp($s) which i think is local (ini)
Had a few issues with dates myself I'll take a look for that line
2020-08-06 14:30:06
Oh good, its funny because my immediate thought was my php.ini - which had no value. I've made changes and will see what happens. I believe i was fighting with results I'm not supposed to see yet in terms of time.
Now the flood gates are open and I have message for them on homepage with ratio build opportunities etc.

Banning just makes no sense, I mean.. by nature it should provide the user incentive to work on their ratio (like a line of credit in the real world). I can see how this would greatly reduce an active user table. Thanks bud!
2020-08-06 16:28:01
Fixed. Seems to work without the condition in place. However it worked fine before.. I'll monitor it for a day or two.
2020-08-07 16:01:00
while were on dates/times heres a note i made a while back, been playing with datetime immutable which i would extend to

class MYDatetime extends /DatetimeImmutable (which then itself extends datetime intereface) see php manual
or
make just a little helper with functions settimezone / setusertimezone / add / diff / modify

this is the way forward but not really started, heres the current time & date functions

mkprettytime = 4 results in code, 0 in date functions
gmtime = 28 results in code, 3 in date functions, [color=rgb(247, 218, 100)]get_elapsed_time, utc_to_tz, utc_to_tz_time[/color]
sql_timestamp_to_unix_timestamp = 13 results in code, 5 in date functions, [color=rgb(247, 218, 100)]gmtime, time_ago, utc_to_tz_time, utc_to_tz, datediff[/color]
get_elapsed_time = 1 results in code, 1 in date functions,[color=rgb(247, 218, 100)] time_ago[/color]
time_ago = 1 results in code, 0 in date functions
get_date_time = 67 results in code, 3 in date functions, [color=rgb(247, 218, 100)]gmtime, utc_to_tz_time, utc_to_tz[/color]
utc_to_tz = 49 results in code, 0 in date functions
utc_to_tz_time = 11 results in code, 0 in date functions
DateDiff = 2 results in code, 0 in date functions


[color=rgb(247, 218, 100)]mkprettytime[/color] = mkprettytime($timestamp) Function that calculates the Hours Minutes Seconds of a Timestamp

[color=rgb(247, 218, 100)]gmtime [/color]= gmtime() Time to Time Conversion Function With Time Zone

[color=rgb(247, 218, 100)]sql_timestamp_to_unix_timestamp[/color] = sql_timestamp_to_unix_timestamp($s) Function That Returns The UNIX Timestamp Of A Date

[color=rgb(247, 218, 100)]get_elapsed_time[/color] = get_elapsed_time($ts) Obtaining past function (Week Day Hour Minute Second) According to a Timestamp

[color=rgb(247, 218, 100)]time_ago[/color] = time_ago($timestamp) function Week Day Hour Minute Second According to Timestamp

[color=rgb(247, 218, 100)]get_date_time[/color] = get_date_time($timestamp = 0) covert to date/time (both date & timestamp)

[color=rgb(247, 218, 100)]utc_to_tz = [/color][color=rgb(239, 239, 239)]utc_to_tz($timestamp = 0)[/color][color=rgb(247, 218, 100)] [/color]Function which returns a date according to the members time zone

[color=rgb(247, 218, 100)]utc_to_tz_time [/color]= utc_to_tz_time($timestamp = 0) Function That Returns A Timestamp According To The Members Time Zone

[color=rgb(247, 218, 100)]DateDiff[/color] = DateDiff($start, $end) Function To Make The Time Interval Between 2 Dates
2020-08-07 21:44:12
Nice thanks man! That’s great stuff, I will save that into my cheat file.
I think what happened was I truncated the warnings table, which effectively reset their date stamp , so as I made the change to cleanup.php I saw no effect at all. Well, I realized it’s because my config.php has a 14 day before ban provided they have warnings.

basically I have to wait 2 weeks to see it working. Because I nuked the warning expiry dates ?

I havent modified any date functions except reading tables using time_ago() - now I have the same for jquery so that handles Ajax., time zone dates are bonded into to general TT date functions looks like, I was on php.net docs for a hour about this even thought about replacing functions with a date class php5+ lol
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