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
cookie settings that may work for TTv3.8.4
Controls ·  Search New posts · Mark unread

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

2025-04-26 20:23:58
backend/functions.php find and replace.
function logincookie($id, $password, $secret, $updatedb = true, $expires = null) {
   if ($expires === null) {
       $expires = time() + (30 * 24 * 60 * 60); // Extend 30 days from now on each visit
   }

   $hash = sha1($id . $secret . $password . getip() . $secret);
   
   // Set secure cookies with a rolling expiration
   setcookie("pass", $hash, $expires, "/", "", true, true);
   setcookie("uid", $id, $expires, "/", "", true, true);

   if ($updatedb) {
       $stmt = $GLOBALS["DBconnector"]->prepare("UPDATE users SET last_login = ? WHERE id = ?");
       $stmt->bind_param("si", get_date_time(), $id);
       $stmt->execute();
       $stmt->close();
   }
}

function logoutcookie() {
setcookie("pass", "", time() - 3600, "/", "", true, true);
setcookie("uid", "", time() - 3600, "/", "", true, true);

}

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 2025-04-26 20:28:29
2025-04-27 16:14:09
Big thanks MicroMonkey  πŸ‘  πŸ˜‰

// Login Cookie 2025 by MicroMonkey
Last edited by spiritblue on 2025-04-27 16:14:44
2025-04-27 16:39:03
@coco, here is my functions file. Again, this is only testing so I cant guarantee anything. I havent had any time lately to keep working on this, so backup your files.
functions.rar
Download

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 2025-04-27 16:39:53
2025-05-10 05:03:25
I have tested both @coco functions.php & @MicroMonkey versions both have the same errors
errors :
Warning: Trying to access array offset on null in /home/public_html/backend/functions.php on line 122

Warning: Trying to access array offset on null in /home/public_html/backend/functions.php on line 125

Warning: require_once(/home/public_html/languages): Failed to open stream: Success in /home/public_html/backend/functions.php on line 127

Fatal error: Uncaught Error: Failed opening required 'languages/' (include_path='.:/usr/local/lsws/lsphp83/share/pear:/usr/local/lsws/lsphp83/share/php:/usr/share/pear:/usr/share/php') in /home/public_html/backend/functions.php:127 Stack trace: #0 /home/public_html/index.php(7): dbconn() #1 {main} thrown in /home/public_html/backend/functions.php on line 127
2025-05-14 07:57:00
// Get language and theme
$CURUSER = $GLOBALS["CURUSER"] ?? [];

// Query to get the user's theme or the default theme
$ss_a = mysqli_fetch_assoc(SQL_Query_exec("select uri from stylesheets where id='" .
   ($CURUSER ? $CURUSER['stylesheet'] : $site_config['default_theme']) . "'"));
$THEME = $ss_a["uri"] ?? ''; // Ensure $THEME is not null

// Query to get the user's language or the default language
$lng_a = mysqli_fetch_assoc(SQL_Query_exec("select uri from languages where id='" .
   ($CURUSER ? $CURUSER['language'] : $site_config['default_language']) . "'"));
$LANGUAGE = $lng_a["uri"] ?? ''; // Ensure $LANGUAGE is not null

// Load the language file if available
if (!empty($LANGUAGE)) {
   require_once("languages/$LANGUAGE");
}

Last edited by coco on 2025-05-14 08:14:59
2025-05-14 08:41:32
function logincookie($id, $password, $secret, $updatedb = true, $expires = null) {
   // Convert to integer to ensure it is a valid number
   $id = (int)$id;

   // Set cookie expiration to 30 days if not provided
   if ($expires === null) {
       $expires = time() + (30 * 24 * 60 * 60); // 30 days
   }

   // Hash the password with SHA-1
   $hash = sha1($id . $secret . $password . getip() . $secret);

   // Set secure cookies with the expiration date
   setcookie("pass", $hash, $expires, "/", "", true, true);
   setcookie("uid", $id, $expires, "/", "", true, true);

   // Update the database if required
   if ($updatedb) {
       // Prepare the SQL statement
       $stmt = $GLOBALS["DBconnector"]->prepare("UPDATE users SET last_login = ? WHERE id = ?");
       // Bind the parameters
       $stmt->bind_param("si", get_date_time(), $id);
       // Execute the statement
       $stmt->execute();
       // Close the statement
       $stmt->close();
   }
}

function logoutcookie() {
   // Delete the cookies by setting the expiration to the past
   setcookie("pass", "", time() - 3600, "/", "", true, true);
   setcookie("uid", "", time() - 3600, "/", "", true, true);
}

2025-10-12 17:32:21
function logincookie($id, $password, $secret, $updatedb = true, $expires = null) {
   if ($expires === null) {
       $expires = time() + (30 * 24 * 60 * 60); // 30 Π΄Π½ΠΈ
   }

   // ΠžΡΡ‚Π°Π²ΡΠΌΠ΅ sha1 Π·Π° ΡΡŠΠ²ΠΌΠ΅ΡΡ‚ΠΈΠΌΠΎΡΡ‚
   $hash = sha1($id . $secret . $password . getip() . $secret);

   // Π‘Π΅Ρ‚Π²Π°ΠΌΠ΅ cookies с новия синтаксис ΠΈ Ρ„Π»Π°Π³ΠΎΠ²Π΅
   setcookie("pass", $hash, [
       'expires'  => $expires,
       'path'     => '/',
       'secure'   => true,      // само ΠΏΠΎ HTTPS
       'httponly' => true,      // JS Π½Π΅ ΠΌΠΎΠΆΠ΅ Π΄Π° Π³ΠΎ Ρ‡Π΅Ρ‚Π΅
       'samesite' => 'Lax'      // ΠΈΠ»ΠΈ 'Strict' спорСд Π½ΡƒΠΆΠ΄ΠΈΡ‚Π΅
   ]);

   setcookie("uid", $id, [
       'expires'  => $expires,
       'path'     => '/',
       'secure'   => true,
       'httponly' => true,
       'samesite' => 'Lax'
   ]);

   if ($updatedb) {
       $stmt = $GLOBALS["DBconnector"]->prepare("UPDATE users SET last_login = ? WHERE id = ?");
       $stmt->bind_param("si", get_date_time(), $id);
       $stmt->execute();
       $stmt->close();
   }
}

function logoutcookie() {
   // Π˜Π·Ρ‚Ρ€ΠΈΠ²Π°ΠΌΠ΅ cookies със ΡΡŠΡ‰ΠΈΡ‚Π΅ Ρ„Π»Π°Π³ΠΎΠ²Π΅
   setcookie("pass", "", [
       'expires'  => time() - 3600,
       'path'     => '/',
       'secure'   => true,
       'httponly' => true,
       'samesite' => 'Lax'
   ]);

   setcookie("uid", "", [
       'expires'  => time() - 3600,
       'path'     => '/',
       'secure'   => true,
       'httponly' => true,
       'samesite' => 'Lax'
   ]);
}

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