Maybe this will work better? Just taking a guess
$ret = SQL_Query_exec("INSERT INTO peers (connectable, torrent, peer_id, ip, passkey, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, client) VALUES ('$connectable', $torrentid, '" . sqlesc($peer_id) . "', '" . sqlesc($ip) . "', '" . sqlesc($passkey) . "', $port, $uploaded, $downloaded, $left, '".get_date_time()."', '".get_date_time()."', '$seeder', '$userid', '" . sqlesc($agent) . "')");
function sqlesc($x) {
return mysqli_real_escape_string($GLOBALS["DBconnector"], $x);
}
just wrapping the query with the quotes at the time of sql excute. I havent checked to see if this would affect anything else tho that uses the sqlesc() function, just wondering. Also wondering why the data would be too long for the table, thats confusing. I guess you could try truncating it down to 25 chars before you insert it since it seems the client is what is causing your problem, I dunno, odd. Like something like
$maxlength = 25;
if (strlen($agent) > $maxlength) {
$agent = substr($agent, 0, $maxlength);
}
all of this is just experimental. I havent tested any of this
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 2023-07-24 21:23:33