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
[ADDON] Parked Accounts
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2013-05-31 21:07:37
Quote:
ALTER TABLE users ADD(parked enum ('yes','no') NOT NULL default 'no');
modified

Quote:
ALTER TABLE users ADD parked enum ('yes','no') NOT NULL default 'no';
Unknown User
2014-05-10 07:35:20
a little  of color  :P

in account


    print ("<tr><td align=right class=table_col2><b>Account Parked:</b> </td><td class=table_col2><input type=radio name=parked" . ($CURUSER["parked"] == "yes" ? " checked" : "") . " value=yes><font color=#FF0000><b>Yes</b></font> <input type=radio name=parked" .  ($CURUSER["parked"] == "no" ? " checked" : "") . " value=no><font color=#00FF00><b>No</b></font><br><i>You can park your account to prevent it from being deleted because of inactivity if you go away on for example a vacation. When the account has been parked limits are put on the account, for example you cannot use the tracker and browse some of the pages.</i></td></tr>");

2023-07-27 21:09:20
is it possible to automatically parked for example 90 days etc.?
I would need if you can help me😐
2023-07-27 22:15:56
there you go it is after 60 days, you can change that

$maxdt = sqlesc(get_date_time(gmtime() - 86400*60));

$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE parked='no' AND enabled ='yes'  AND last_access < $maxdt ");

if (mysqli_num_rows($res) > 0)

{

$dt = sqlesc(get_date_time());


while ($arr = mysqli_fetch_assoc($res))

{
        $modcomment = $row['modcomment'];

      $modcomment3 = gmdate("Y-m-d") . " Account auto parked .";

      $modcomment = $modcomment3 . "n" . $modcomment;

      $modcom = sqlesc($modcomment);



SQL_Query_exec("UPDATE users SET parked = 'yes' , modcomment = $modcom WHERE id = $arr[id]");
    write_log("<a href=account-details.php?id=$arr[id]><b>$arr[username]</b></a> Account auto parked.");
 


}

Last edited by djlive on 2023-07-27 22:33:42
2023-07-29 12:16:28
not works ....
2023-07-30 06:46:02

try this
$maxdt = sqlesc(get_date_time(gmtime() - 86400*60));

$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE parked='no' AND enabled ='yes'  AND last_access != '0000-00-00 00:00:00' AND last_access < $maxdt ");

if (mysqli_num_rows($res) > 0)

{

$dt = sqlesc(get_date_time());


while ($arr = mysqli_fetch_assoc($res))

{
        $modcomment = $row['modcomment'];

      $modcomment3 = gmdate("Y-m-d") . " Account auto parked .";

      $modcomment = $modcomment3 . "n" . $modcomment;

      $modcom = sqlesc($modcomment);



SQL_Query_exec("UPDATE users SET parked = 'yes' , modcomment = $modcom WHERE id = $arr[id]");
    write_log("<a href=account-details.php?id=$arr[id]><b>$arr[username]</b></a> Account auto parked.");
 


}
Last edited by djlive on 2023-07-30 06:47:31
2023-07-30 07:46:08
For me it does not work at all from the beginning. I get it to clash with the date of birth somehow don't know why.
The attempt to implement it in many ways without having succeeded


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2023-07-30 10:23:13
@Botanicar i can try and help you how i did it
ALTER TABLE users ADD parked enum ('yes','no') NOT NULL default 'no';


in announce.php:
find
$userfields = "u.id, u.class, u.uploaded, u.downloaded, u.ip, u.passkey,

after add
parked


still iun announce litle bit down find:
if (!$user)
err("Cannot locate a user with that passkey!");

add
if ($user["parked"] == "yes")
err("Error, your account is parked! Please read the FAQ!");


in account.php where ever you want to show add:
print ("<TR><TD align=right class=table_col2><B>Account Parked:</B> </td><td class=table_col2><input type=radio name=parked" . ($CURUSER["parked"] == "yes" ? " checked" : "") . " value=yes><B>Yes</B> <input type=radio name=parked" .  ($CURUSER["parked"] == "no" ? " checked" : "") . " value=no><B>No</B><br><i>You can park your account to prevent it from being deleted because of inactivity if you go away on for example a vacation. When the account has been parked limits are put on the account, for example you cannot use the tracker and browse some of the pages.</i></td></tr>");

still account find
$acceptpms = $_POST["acceptpms"];

add after
$parked = $_POST["parked"];

find:
$updateset[] = "title = ".sqlesc($title);

add after:
$updateset[] = "parked = " . sqlesc($parked);

Save.

in admincp.php add
<td align=center><a href=admincp.php?action=parked><img src=images/admin/confirmaccounts.gif border=0 width=32 height=32><br><center><b>Parked<BR>Users</center></b></a><BR></td>


still in admin cp just before last ?>
   #======================================================================#

#   Parked users

#======================================================================#



if ($action == "parked") {

if ($CURUSER["class"] < "9"){

show_error_msg("Error","Sorry you do not have the rights to view this page!",1);

}

stdhead("Parked Users Management");

navmenu();





$res2 = SQL_Query_exec("SELECT COUNT(*) FROM users WHERE parked='yes'");

$row = mysqli_fetch_array($res2);

$count = $row[0];



$perpage = 50;



list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "admincp.php?action=parked&");



begin_frame("Parked Users Management");



echo $pagertop;

?>

<CENTER><table align=center cellpadding="0" cellspacing="0" class="table_table" width="100%" border="1">

<tr>

<td class=table_head align=center>Username</td>

<td class=table_head align=center>Added</td>

<td class=table_head align=center>Last Visit</td>

<td class=table_head align=center>Uploaded</td>

<td class=table_head align=center>Downloaded</td>

<td class=table_head align=center>Edit?</td>

</tr>

<?



$rqq = "SELECT id, username, last_access, added, uploaded, downloaded FROM users WHERE parked='yes' ORDER BY username $limit ";

$resqq = SQL_Query_exec($rqq);



while ($row = mysqli_fetch_array($resqq)){

extract ($row);



echo "<tr><td class=table_col1><a href=account-details.php?id=$row[id]>$row[username]</a></td><td class=table_col2>".utc_to_tz($row['added'])."</td><td class=table_col1>$row[last_access]</td><td class=table_col2>".mksize($row["uploaded"])."</td><td class=table_col1>".mksize($row["downloaded"])."</td><td class=table_col2><a href=account-details.php?id=$row[id]>EDIT</a></td></tr>\n";

}



echo "</table></CENTER>\n";



print($pagerbottom);



end_frame();

stdfoot();

}

#======================================================================#

#  End Parked users

#======================================================================#


in function.php before last ?> add

function parked() {

 global $CURUSER;

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

show_error_msg("Error", "your account is parked.", 1);

}



in torrents.php, torrent-search.php, and all the pages you want to add the parked just add after loggedinonly();
parked();


Additional if they are parked and you dont want to get warn or not to be autodisable add in cleanup.php

AND parked = 'no'

in query

Add image in images/admin

Hope i didnt forget anything

confirmaccounts.gif
confirmaccounts.gif
Last edited by djlive on 2023-07-30 10:29:26
2023-07-30 15:16:13
I replaced with the one in the initial post

ALTER TABLE users ADD parked enum ('yes','no') NOT NULL default 'no';

we corrected some codes here
//start parked
$parked1 = sqlesc(get_date_time(gmtime() - 86400*364));  // 364 - 52 weeks
$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE parked='no' AND enabled ='yes'  AND last_access < $parked1 ");
if (mysqli_num_rows($res) > 0)
 
$dt = sqlesc(get_date_time());
{
while ($arr = mysqli_fetch_assoc($res))
     {
     $modcomment = $arr['modcomment'];
     $modcomment3 = gmdate("Y-m-d") . " Account auto parked .";
     $modcomment = $modcomment3 . "n" . $modcomment;
     $modcom = sqlesc($modcomment);
   SQL_Query_exec("UPDATE users SET parked = 'yes' , modcomment = $modcom WHERE id = $arr[id]");
   write_log("<b><font color=red>Inactive account:</font> <a href=account-details.php?id=$arr[id]><font color=green><b>$arr[username]</b></font></a> Account auto parked.</b>");
    }
}
//end parked



and here I've changed minor things

#======================================================================#
#   Parked users
#======================================================================#
if ($action == "parked") {
if ($CURUSER["class"] < "9"){
show_error_msg("Error","Sorry you do not have the rights to view this page!",1);
}

stdhead("Parked Users Management");

$res2 = SQL_Query_exec("SELECT COUNT(*) FROM users WHERE parked='yes'");

$row = mysqli_fetch_array($res2);

$count = $row[0];

$perpage = 50;



list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "staffpanel.php?action=parked&");



begin_frame("Parked Users Management");



echo $pagertop;

?>

<center><table align=center cellpadding="0" cellspacing="0" class="table_table" width="100%" border="1">

<tr>

<td class=table_head align=center>Username</td>

<td class=table_head align=center>Joined</td>

<td class=table_head align=center>Last Visit</td>

<td class=table_head align=center>Uploaded</td>

<td class=table_head align=center>Downloaded</td>

<td class=table_head align=center>Edit?</td>

</tr>

<?



$rqq = "SELECT id, username, last_access, added, uploaded, downloaded FROM users WHERE parked='yes' ORDER BY username $limit ";

$resqq = SQL_Query_exec($rqq);


while ($row = mysqli_fetch_array($resqq)){

extract ($row);

echo "<tr><td class=table_col1><center><b><a href=account-details.php?id=$row[id]>$row[username]</b></a> <img src=pic/parked.png></center></td><td class=table_col2><center><font color=lime>".utc_to_tz($row['added'])."</font></center></td><td class=table_col1><center><font color=red>$row[last_access]</font>  </center></td><td class=table_col2><center><font color=lime>".mksize($row["uploaded"])."</center></td><td class=table_col1><center><font color=red>".mksize($row["downloaded"])."</center></font></td><td class=table_col2><a href=account-details.php?id=$row[id]><center><img src=images/edit.png></center></a></td></tr>\n";

}
echo "</table></center>\n";

print($pagerbottom);
end_frame();
navmenu();
stdfoot();
}
#======================================================================#
#  End Parked users
#======================================================================#


now everything works perfectly
thanks for code djlive
edit1.png
edit1.png
icon1.png
icon1.png
screen0.png
screen0.png
screen1.png
screen1.png
Last edited by crisphp on 2023-07-31 11:35:23
2023-07-30 15:27:26
Auto parked account i did it quiqly offcourse it can be done more good
Something like this.
Additionally, i cast the user ID to an integer using (int) to prevent SQL injection risks.

// Start parked
$parked1 = get_date_time(gmtime() - 86400 * 364);  // 364 - 52 weeks
$parked1 = sqlesc($parked1);
$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE parked='no' AND enabled='yes' AND last_access < $parked1");
if (mysqli_num_rows($res) > 0) {
   while ($arr = mysqli_fetch_assoc($res)) {
       $modcomment = $arr['modcomment'];
       $modcomment3 = gmdate("Y-m-d") . " Account auto parked .";
       $modcomment = $modcomment3 . "\n" . $modcomment; // Use "\n" for a new line
       $modcom = sqlesc($modcomment);


       $userId = (int)$arr['id']; // Cast to integer for safety
       $updateQuery = "UPDATE users SET parked='yes', modcomment=? WHERE id=?";
       $stmt = mysqli_prepare($dbconn, $updateQuery);
       mysqli_stmt_bind_param($stmt, "si", $modcom, $userId);
       mysqli_stmt_execute($stmt);


       $username = $arr['username'];
       write_log("<b><font color=red>Inactive account:</font> <a href=account-details.php?id=$userId><font color=green><b>$username</b></font></a> Account auto parked.</b>");
   }
}
// End parked
Last edited by djlive on 2023-07-30 17:03:05
2023-07-31 12:20:11
djlive There is still work to be done on it  has bugs in the code


$userId = (int)$arr['id']; // Cast to integer for safety
      $updateQuery = "UPDATE users SET parked='yes', modcomment=? WHERE id=?";
      $stmt = mysqli_prepare($dbconn, $updateQuery);
      mysqli_stmt_bind_param($stmt, "si", $modcom, $userId);
      mysqli_stmt_execute($stmt);


///////////////////////////////////////////////////////////////////////////////
does not parked account
when I go into the log and refresh shows that it introduces it automatically
but it is not put in the user's account at all

seems to be the problem here

$updateQuery = "UPDATE users SET parked='yes', modcomment=? WHERE id=?";

and

mysqli_stmt_bind_param($stmt, "si", $modcom, $userId);


screen--.png
screen--.png
Last edited by crisphp on 2023-08-01 12:26:15
2023-07-31 13:30:38
Be more explicit what bugs?
If you reffer to this
modcomment=? WHERE id=?
it is not a bug. let me try to explain why is like this

The modcomment=? WHERE id=? part is a prepared statement that uses placeholders denoted by ?. The use of prepared statements and placeholders is a security measure to prevent SQL injection attacks.

The placeholders ? are used to indicate where the actual values will be inserted into the query. In this case, there are two placeholders: modcomment=? and WHERE id=?. :)

After preparing the query, the parameters (values) to be inserted into the query are "bound" to the placeholders. The line mysqli_stmt_bind_param($stmt, "si", $modcom, $userId); does this binding. The first argument "si" is a string that defines the types of the parameters: "s" for a string (modcomment) and "i" for an integer (userId). The subsequent arguments ($modcom and $userId) are the actual values that will be inserted into the query. The values are bound to the placeholders, and the prepared statement ensures that they are properly escaped and quoted as needed.

By using prepared statements with bound parameters, the code ensures that any user data used in the SQL query is treated as data rather than executable code, thus preventing SQL injection attacks. It is considered a best practice for interacting with databases in web applications to enhance security.

Hope i have been explicit enough

Last edited by djlive on 2023-07-31 17:27:14
2023-08-03 18:04:01
Hi and thanks to everyone involved in this MOD,
I can't get automatic parked code to work
have used bouth from posts of @djlive and @crisphp

$parked1 = sqlesc(get_date_time(gmtime() - 86400*92));  


tested to use for 3 months user inactivity

regards guys


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2023-08-04 06:59:40
can you try this?
//start parked
$parked1 = sqlesc(get_date_time(gmtime() - 86400*92));
$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE parked='no' AND enabled ='yes'  AND last_access < $parked1 ");
if (mysqli_num_rows($res) > 0) {
   $dt = sqlesc(get_date_time()); // Corrected placement of the curly brace
   
   while ($arr = mysqli_fetch_assoc($res)) {
       $modcomment = $arr['modcomment'];
       $modcomment3 = gmdate("Y-m-d") . " Account auto parked .";
       $modcomment = $modcomment3 . "\n" . $modcomment; // Changed "n" to "\n" for a new line
       $modcom = sqlesc($modcomment);
       SQL_Query_exec("UPDATE users SET parked = 'yes' , modcomment = $modcom WHERE id = $arr[id]");
       write_log("<b><font color=red>Inactive account:</font> <a href=account-details.php?id=$arr[id]><font color=green><b>$arr[username]</b></font></a> Account auto parked.</b>");
   }
}
//end parked
2023-08-04 15:20:59
Thanks @djlive,
It was my fault

Had forgotten that the date format was changed everywhere

I have date formats like "d M Y" instead of "Y M d" and none of it worked correctly.



www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
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