function user_to_peasant($down_floor_gb, $minratio) { global $lang_cleanup_target; global $deletepeasant_account; $length = $deletepeasant_account * 86400; // warn users until xxx days $until = date("Y-m-d H:i:s", TIMENOW + $length); $downlimit_floor = $down_floor_gb * 1024 * 1024 * 1024; $res = sql_query("SELECT id FROM users WHERE class = 1 AND downloaded > {$downlimit_floor} AND uploaded / downloaded < {$minratio}") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) { $dt = sqlesc(date("Y-m-d H:i:s")); while ($arr = mysql_fetch_assoc($res)) { $subject = $lang_cleanup_target[get_user_lang($arr[id])]['msg_demoted_to'] . get_user_class_name(UC_PEASANT, false, false, false); $msg = $lang_cleanup_target[get_user_lang($arr[id])]['msg_must_fix_ratio_within'] . $deletepeasant_account . $lang_cleanup_target[get_user_lang($arr[id])]['msg_days_or_get_banned']; writecomment($arr[id], "Leech Warned by System - Low Ratio."); sql_query("UPDATE users SET class = 0 , leechwarn = 'yes', leechwarnuntil = " . sqlesc($until) . " WHERE id = {$arr['id']}") or sqlerr(__FILE__, __LINE__); sql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES(0, {$arr['id']}, {$dt}, " . sqlesc($subject) . ", " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__); } } }
**/ function writecomment($user, $coment) { echo '<div class="comment"> <h5><b>' . htmlspecialchars($user) . ' Says:</b></h5> <p style="text-indent:40px;text-align:justify">' . htmlspecialchars($coment) . '</p> </div>'; } if (isset($_SESSION['usrid'])) { if (isset($_POST['comment']) && isset($_POST['idvideo'])) { if ($_POST['comment'] != "") { if (insertcomment($_SESSION['usrid'], $_POST['idvideo'], $_POST['comment'], date('Y/m/d'))) { if ($lastcomments = getcomments(20, $_POST['idvideo'])) { echo 'posted '; while ($row = pg_fetch_array($lastcomments)) { writecomment($row['username'], $row['coment']); } } else { echo 'noposted'; } } else { echo 'noposted'; } } else { echo 'nocomment'; } } else { echo 'notdata'; } } else { echo 'nolog';