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
Blank coment
Controls ·  Search New posts · Mark unread

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

2022-05-29 23:48:42
Hi M-jay, I want to ask you how I can change the code of the site so that users can not leave blank comments

Thanks in advance bro
2022-05-30 13:36:00
For comments just add strlen

Find in comments.php
$body = $_POST['body'];


Below add
if (strlen($body)  < 3) { 
     autolink($_SERVER['HTTP_REFERER'], 'Body too short');
}
2022-05-30 15:24:13
I think the best approach would be:


$body = trim($body);
if (empty($body)) {
   // Handle error here...
}


Because hitting spacebar a few times would bypass strlen check.
2022-05-30 16:45:46
Thank you very much guys
2022-05-30 17:43:51
Happy to help, empty would work but a comment like ? or p would still be inserted if your happy for a comment just with a smiley strlen < 2 would allow that in v3 I believe
2022-05-30 22:22:39
thanks you M-jay   👍
2022-05-30 22:29:06
mostvotedplayer:

I think the best approach would be:
$body = trim($body);if (empty($body)) {    // Handle error here...}

Because hitting spacebar a few times would bypass strlen check.


I typically use this scenario, takes care of empty variable case: no default column value / fatal error -
$body = !empty($body) ? trim($body) : 'No body description.';
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