$mc1->delete_value('MyUser_' . $CURUSER['id']); $mc1->delete_value('user' . $CURUSER['id']); write_bonus_log($CURUSER["id"], $donation, $type = "halfdownload"); $msg = $CURUSER['username'] . " Donated " . $donation . " karma point" . ($donation > 1 ? 's' : '') . " into the half download contribution pot and has activated half download for 3 days " . $donation . "/" . $points . ''; autoshout($msg); header("Refresh: 0; url={$INSTALLER09['baseurl']}/mybonus.php?halfdown_success=1&norefund={$norefund}"); die; } else { // add to the pool $sql = "UPDATE bonus SET pointspool = pointspool + '{$donation}' WHERE id = '13' LIMIT 1"; sql_query($sql) or sqlerr(__FILE__, __LINE__); $bonuscomment = get_date(time(), 'DATE', 1) . " - " . $points . " Points contributed for halfdownload.\n " . $bonuscomment; sql_query("UPDATE users SET seedbonus = " . sqlesc($seedbonus) . ", bonuscomment = " . sqlesc($bonuscomment) . " WHERE id = " . sqlesc($userid) . "") or sqlerr(__FILE__, __LINE__); $mc1->delete_value('MyUser_' . $CURUSER['id']); $mc1->delete_value('user' . $CURUSER['id']); write_bonus_log($CURUSER["id"], $donation, $type = "halfdownload"); $Remaining = $points - $donation; $msg = $CURUSER['username'] . " Donated " . $donation . " karma point" . ($donation > 1 ? 's' : '') . " into the half download contribution pot ! * Only [b]" . $Remaining . "[/b] more karma point" . ($Remaining > 1 ? 's' : '') . " to go! * [color=green][b]Half download contribution:[/b][/color] [url={$INSTALLER09['baseurl']}/mybonus.php]" . $donation . "/" . $points . '[/url]'; autoshout($msg); header("Refresh: 0; url={$INSTALLER09['baseurl']}/mybonus.php?halfdown_success=2"); die; } die; break; case 'ratio': //=== trade for one torrent 1:1 ratio $torrent_number = 0 + $_POST['torrent_id']; $res_snatched = sql_query("SELECT s.uploaded, s.downloaded, t.name FROM snatched AS s LEFT JOIN torrents AS t ON t.id = s.torrentid WHERE s.userid = '{$userid}' AND torrentid = " . sqlesc($torrent_number) . " LIMIT 1") or sqlerr(__FILE__, __LINE__); $arr_snatched = mysql_fetch_assoc($res_snatched); if ($arr_snatched['name'] == '') { stderr("Error", "No torrent with that ID!<br />Back to your <a class='altlink' href='{$INSTALLER09['baseurl']}/mybonus.php'>Karma Bonus Point</a> page.");
$norefund = ($donation + $pointspool) % $points; sql_query($sql) or sqlerr(__FILE__, __LINE__); $bonuscomment = gmdate("Y-m-d") . " - " . $points . " Points contributed for freeleech.\n " . $bonuscomment; sql_query("UPDATE users SET seedbonus = '{$seedbonus}', bonuscomment = '{$bonuscomment}' WHERE id = '{$userid}'") or sqlerr(__FILE__, __LINE__); $sql2 = "UPDATE bonus SET pointspool = '{$norefund}' WHERE id = '21' LIMIT 1"; sql_query($sql2) or sqlerr(__FILE__, __LINE__); write_bonus_log($CURUSER["id"], $donation, $type = "freeleech"); header("Refresh: 0; url={$BASEURL}/mybonus.php?freeleech_success=1&norefund={$norefund}"); die; } else { // add to the pool $sql = "UPDATE bonus SET pointspool = pointspool + '{$donation}' WHERE id = '21' LIMIT 1"; sql_query($sql) or sqlerr(__FILE__, __LINE__); $bonuscomment = gmdate("Y-m-d") . " - " . $points . " Points contributed for freeleech.\n " . $bonuscomment; sql_query("UPDATE users SET seedbonus = '{$seedbonus}', bonuscomment = '{$bonuscomment}' WHERE id = '{$userid}'") or sqlerr(__FILE__, __LINE__); write_bonus_log($CURUSER["id"], $donation, $type = "freeleech"); header("Refresh: 0; url={$BASEURL}/mybonus.php?freeleech_success=2"); die; } die; break; case 'ratio': //=== trade for one torrent 1:1 ratio $torrent_number = 0 + $_POST['torrent_id']; $res_snatched = sql_query("SELECT s.uploaded, s.downloaded, t.name FROM snatched AS s LEFT JOIN torrents AS t ON t.id = s.torrentid WHERE s.userid = '{$userid}' AND torrentid = " . sqlesc($torrent_number) . " LIMIT 1") or sqlerr(__FILE__, __LINE__); $arr_snatched = mysql_fetch_assoc($res_snatched); if ($arr_snatched['name'] == '') { stderr("Error", "No torrent with that ID!<br>Back to your <a class=altlink href=mybonus.php>Karma Bonus Point</a> page."); } if ($arr_snatched['uploaded'] >= $arr_snatched['downloaded']) { stderr("Error", "Your ratio on that torrent is fine, you must have selected the wrong torrent ID.<br>Back to your <a class=altlink href=mybonus.php>Karma Bonus Point</a> page.");