UPDATE users SET uploaded <?php
require_once("backend/functions.php");
dbconn();
if ($CURUSER["class"] < "2"){
show_error_msg("Sorry...", "You must be a Crazy Seeder or above to play Chance Ace.");
}
$playprice = 100*1024*1024;
$minorprize = 50*1024*1024;
$clubsmb = 200*1024*1024;
$diamondsmb = 350*1024*1024;
$heartsmb = 500*1024*1024;
$spadesmb = 1000*1024*1024;
if ($_POST["bet"]){
if ($CURUSER["uploaded"] < "$playprice")
show_error_msg("Sorry ".$CURUSER["username"],"You haven't uploaded ".mksize($playprice)." yet.");
stdhead("Chance Ace");
begin_frame("Chance Ace");
print("<center><h1><img src=/images/chanceace/chanceace.gif></h1></center>\n");
print("<center><h2>Welcome, <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>!</h2></center>\n");
$aceofclubs .= "<img src=images/chanceace/aceofclubs.gif> ";
$aceofdiamonds .= "<img src=images/chanceace/aceofdiamonds.gif> ";
$aceofhearts .= "<img src=images/chanceace/aceofhearts.gif> ";
$aceofspades .= "<img src=images/chanceace/aceofspades.gif> ";
$frstspot = "";
$scndspot = "";
$thrdspot = "";
// Random
$frstno = rand (1, 50);
$scndno = rand (1, 50);
$thrdno = rand (1, 50);
// Image results
// FIRST
if (($frstno >= 1) && ($frstno <= 20)){
$frstspot = $aceofclubs;
$aceofclubscount++;
}
if (($frstno >= 21) && ($frstno <= 35)){
$frstspot = $aceofdiamonds;
$aceofdiamondscount++;
}
if (($frstno >= 36) && ($frstno <= 45)){
$frstspot = $aceofhearts;
$aceofheartscount++;
}
if (($frstno >= 46) && ($frstno <= 50)){
$frstspot = $aceofspades;
$starcount++;
}
// SECOND
if (($scndno >= 1) && ($scndno <= 20)){
$scndspot = $aceofclubs;
$aceofclubscount++;
}
if (($scndno >= 21) && ($scndno <= 35)){
$scndspot = $aceofdiamonds;
$aceofdiamondscount++;
}
if (($scndno >= 36) && ($scndno <= 45)){
$scndspot = $aceofhearts;
$aceofheartscount++;
}
if (($scndno >= 46) && ($scndno <= 50)){
$scndspot = $aceofspades;
$starcount++;
}
// THIRD
if (($thrdno >= 1) && ($thrdno <= 20)){
$thrdspot = $aceofclubs;
$aceofclubscount++;
}
if (($thrdno >= 21) && ($thrdno <= 35)){
$thrdspot = $aceofdiamonds;
$aceofdiamondscount++;
}
if (($thrdno >= 36) && ($thrdno <= 45)){
$thrdspot = $aceofhearts;
$aceofheartscount++;
}
if (($thrdno >= 46) && ($thrdno <= 50)){
$thrdspot = $aceofspades;
$starcount++;
}
// END Image results
// Adds to the pool for every play.
if ($aceofclubscount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of clubs in a row. You won " .mksize($clubsmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $clubsmb WHERE id=$CURUSER[id]");
}else{
if ($aceofdiamondscount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of diamonds in a row. You won " .mksize($diamondsmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $diamondsmb WHERE id=$CURUSER[id]");
}else{
if ($aceofheartscount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of hearts in a row. You won " .mksize($heartsmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $heartsmb WHERE id=$CURUSER[id]");
}else{
if ($aceofspadescount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of spades in a row. You won " .mksize($spadesmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $spadesmb WHERE id=$CURUSER[id]");
}else{
if ($minorprize != 0){
if (($aceofclubscount == 2) || ($aceofdiamondscount == 2) || ($aceofheartscount == 2) || ($starcount == 2));
$rslt = "<br><center><b>Well, you didnt match them all but you got 2 of the same suit, so I will give you " .mksize($minorprize);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $minorprize - $playprice WHERE id=$CURUSER[id]");
}else{
if (($aceofclubscount == 4) || ($aceofdiamondscount == 4) || ($aceofheartscount == 4) || ($starcount == 4));{
$rslt = "<center><b>Sorry, you didnt win. You missed them all</b></center>";
SQL_Query_exec("UPDATE users SET uploaded = uploaded - $playprice WHERE id=$CURUSER[id]");
}
}
}
}
}
}
// Show table
print("<br><div align=center>\n");
print("<table class=forumline width=300><tr>\n");
print("<td width=33%><center>$frstspot $scndspot $thrdspot</center></td></tr>\n");
print("</table></center></div>\n");
print("<div align=center><table class=forumline width=300><tr><td class=Catbottom width=100%>$rslt</td>\n");
print("</tr></table></center></div><br>\n");
print("<br><div align=center>\n");
print("<table class=forumline width=300>\n");
print("<tr><td class=row1 width=100%><br><center><form method=POST><input type=submit value=Play ChanceAce name=bet class=button></form></center><br></td></tr>\n");
print("</table>\n");
end_frame();
stdfoot();
}else{
// Start screen - Not currently playing a game
stdhead("Chance Ace");
begin_frame("Chance Ace");
print("<h1><center><img src=/images/chanceace/chanceace.gif></center></h1>\n");
print("<br>\n");
print("<center><img src=images/chanceace/aces1.jpg width=114 height=95 border=0></center>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofclubs.gif width=50 height=50 border=0> = 200MB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofdiamonds.gif width=50 height=50 border=0> = 350MB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofhearts.gif width=50 height=50 border=0> = 500MB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofspades.gif width=50 height=50 border=0> = 1GB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>Two of the same suit gives you 50MB</center></font>\n");
print("<br>\n");
print("<br>\n");
print("<center><b>NOTE:</b> By playing Chance Ace, you are betting 100 MB of upload credit!</center>\n");
print("<br>\n");
print("<center><form name=form method=post action=$phpself><input type=hidden name=bet value=bet><input type=submit class=btn value='Start!'></a></center>\n");
end_frame();
stdfoot();
}
?> torrents.size, // If username is somehow taken, keep trying
while (mysqli_errno($GLOBALS["DBconnector"]) == 1062) {
$username = "invite_".mksecret(20);
// $ret = SQL_Query_exec("INSERT INTO users (username, secret, email, status, invited_by, added, stylesheet, language) VALUES (".
// implode(",", array_map("sqlesc", array($username, $secret, $email, 'pending', $CURUSER["id"]))) . ",'" . get_date_time() . "', $site_config[default_theme], $site_config[default_language])");
$ret = SQL_Query_exec("INSERT INTO users (username, secret, email, status, invited_by, added, stylesheet, uploaded, downloaded, language, invites) VALUES (".
implode(",", array_map("sqlesc", array($username, $secret, $email, 'pending', $CURUSER["id"]))) . ",'" . get_date_time() . "', $site_config[default_theme], $site_config[new_member_upload_ratio], 0, $site_config[default_language], $site_config[new_member_invites])");
}
show_error_msg(T_("ERROR"), T_("DATABASE_ERROR"), 1);
} $id = mysql_insert_id();$id = mysqli_insert_id($GLOBALS["DBconnector"]);if (mysql_errno() == 1062)if (mysqli_errno($GLOBALS["DBconnector"]) == 1062)<?php
require_once("backend/functions.php");
dbconn();
if ($CURUSER["class"] < "2"){
show_error_msg("Sorry...", "You must be a Crazy Seeder or above to play Chance Ace.");
}
$playprice = 100*1024*1024;
$minorprize = 50*1024*1024;
$clubsmb = 200*1024*1024;
$diamondsmb = 350*1024*1024;
$heartsmb = 500*1024*1024;
$spadesmb = 1000*1024*1024;
if ($_POST["bet"]){
if ($CURUSER["uploaded"] < "$playprice")
show_error_msg("Sorry ".$CURUSER["username"],"You haven't uploaded ".mksize($playprice)." yet.");
stdhead("Chance Ace");
begin_frame("Chance Ace");
print("<center><h1><img src=/images/chanceace/chanceace.gif></h1></center>\n");
print("<center><h2>Welcome, <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>!</h2></center>\n");
$aceofclubs .= "<img src=images/chanceace/aceofclubs.gif> ";
$aceofdiamonds .= "<img src=images/chanceace/aceofdiamonds.gif> ";
$aceofhearts .= "<img src=images/chanceace/aceofhearts.gif> ";
$aceofspades .= "<img src=images/chanceace/aceofspades.gif> ";
$frstspot = "";
$scndspot = "";
$thrdspot = "";
// Random
$frstno = rand (1, 50);
$scndno = rand (1, 50);
$thrdno = rand (1, 50);
// Image results
// FIRST
if (($frstno >= 1) && ($frstno <= 20)){
$frstspot = $aceofclubs;
$aceofclubscount++;
}
if (($frstno >= 21) && ($frstno <= 35)){
$frstspot = $aceofdiamonds;
$aceofdiamondscount++;
}
if (($frstno >= 36) && ($frstno <= 45)){
$frstspot = $aceofhearts;
$aceofheartscount++;
}
if (($frstno >= 46) && ($frstno <= 50)){
$frstspot = $aceofspades;
$starcount++;
}
// SECOND
if (($scndno >= 1) && ($scndno <= 20)){
$scndspot = $aceofclubs;
$aceofclubscount++;
}
if (($scndno >= 21) && ($scndno <= 35)){
$scndspot = $aceofdiamonds;
$aceofdiamondscount++;
}
if (($scndno >= 36) && ($scndno <= 45)){
$scndspot = $aceofhearts;
$aceofheartscount++;
}
if (($scndno >= 46) && ($scndno <= 50)){
$scndspot = $aceofspades;
$starcount++;
}
// THIRD
if (($thrdno >= 1) && ($thrdno <= 20)){
$thrdspot = $aceofclubs;
$aceofclubscount++;
}
if (($thrdno >= 21) && ($thrdno <= 35)){
$thrdspot = $aceofdiamonds;
$aceofdiamondscount++;
}
if (($thrdno >= 36) && ($thrdno <= 45)){
$thrdspot = $aceofhearts;
$aceofheartscount++;
}
if (($thrdno >= 46) && ($thrdno <= 50)){
$thrdspot = $aceofspades;
$starcount++;
}
// END Image results
// Adds to the pool for every play.
if ($aceofclubscount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of clubs in a row. You won " .mksize($clubsmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $clubsmb WHERE id=$CURUSER[id]");
}else{
if ($aceofdiamondscount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of diamonds in a row. You won " .mksize($diamondsmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $diamondsmb WHERE id=$CURUSER[id]");
}else{
if ($aceofheartscount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of hearts in a row. You won " .mksize($heartsmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $heartsmb WHERE id=$CURUSER[id]");
}else{
if ($aceofspadescount == 3){
$rslt = "<br><center><b>Congratulations! You hit 3 Ace of spades in a row. You won " .mksize($spadesmb);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $spadesmb WHERE id=$CURUSER[id]");
}else{
if ($minorprize != 0){
if (($aceofclubscount == 2) || ($aceofdiamondscount == 2) || ($aceofheartscount == 2) || ($starcount == 2));
$rslt = "<br><center><b>Well, you didnt match them all but you got 2 of the same suit, so I will give you " .mksize($minorprize);
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $minorprize - $playprice WHERE id=$CURUSER[id]");
}else{
if (($aceofclubscount == 4) || ($aceofdiamondscount == 4) || ($aceofheartscount == 4) || ($starcount == 4));{
$rslt = "<center><b>Sorry, you didnt win. You missed them all</b></center>";
SQL_Query_exec("UPDATE users SET uploaded = uploaded - $playprice WHERE id=$CURUSER[id]");
}
}
}
}
}
}
// Show table
print("<br><div align=center>\n");
print("<table class=forumline width=300><tr>\n");
print("<td width=33%><center>$frstspot $scndspot $thrdspot</center></td></tr>\n");
print("</table></center></div>\n");
print("<div align=center><table class=forumline width=300><tr><td class=Catbottom width=100%>$rslt</td>\n");
print("</tr></table></center></div><br>\n");
print("<br><div align=center>\n");
print("<table class=forumline width=300>\n");
print("<tr><td class=row1 width=100%><br><center><form method=POST><input type=submit value=Play ChanceAce name=bet class=button></form></center><br></td></tr>\n");
print("</table>\n");
end_frame();
stdfoot();
}else{
// Start screen - Not currently playing a game
stdhead("Chance Ace");
begin_frame("Chance Ace");
print("<h1><center><img src=/images/chanceace/chanceace.gif></center></h1>\n");
print("<br>\n");
print("<center><img src=images/chanceace/aces1.jpg width=114 height=95 border=0></center>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofclubs.gif width=50 height=50 border=0> = 200MB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofdiamonds.gif width=50 height=50 border=0> = 350MB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofhearts.gif width=50 height=50 border=0> = 500MB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>3 x <img src=images/chanceace/aceofspades.gif width=50 height=50 border=0> = 1GB</center></font>\n");
print("<br>\n");
print("<center><font color=red size=4>Two of the same suit gives you 50MB</center></font>\n");
print("<br>\n");
print("<br>\n");
print("<center><b>NOTE:</b> By playing Chance Ace, you are betting 100 MB of upload credit!</center>\n");
print("<br>\n");
print("<center><form name=form method=post action=$phpself><input type=hidden name=bet value=bet><input type=submit class=btn value='Start!'></a></center>\n");
end_frame();
stdfoot();
}
?> <td align="center"><a href="admincp.php?action=viewlogsunconnectable"><img src="images/admin/connectable.png" border="0" width="118" height="80" alt="" /><br /><?php echo T_("NOT_CONNECT"); ?><br /></a></td>////////////////////////////////////UNCONNECTABLE////////////////
if ($_GET['action'] == "listunconnectable") {
$res2 = SQL_Query_exec("SELECT userid, seeder, torrent, client FROM peers WHERE connectable='no' ORDER BY userid DESC") or sqlerr();
stdhead("Peers that are unconnectable");
begin_frame("Unconnectable");
print("<br/><a href=admincp.php?action=sendpmunconnectable>Send all not connectable users a PM</a>");
print("<br/><a href=admincp.php?action=viewlogsunconnectable>View the Log (Check this before PMing users)</a>");
print("<br/>Peers that are Not Connectable");
print("<br/>This is only users that are active on the torrents right now.");
print("<br/><font color=red>*</font> means the user is seeding.<p>");
$result = SQL_Query_exec("SELECT DISTINCT userid FROM peers WHERE connectable = 'no'");
$count = mysqli_num_rows($result);
print ("$count unique users that are not connectable ");
$result2 = SQL_Query_exec("SELECT DISTINCT torrent FROM peers WHERE connectable = 'no'");
$count2 = mysqli_num_rows($result2);
print ("on $count2 torrents.");
@mysqli_free_result($result);
if (mysqli_num_rows($res2) == 0)
print("<p align=center><b>All Peers Are Connectable! </b></p>\n");
else {
print("<table border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead>UserName</td><td class=colhead>Torrent</td><td class=colhead>Client</td></tr>\n");
while($arr2 = mysqli_fetch_assoc($res2)){
$r2 = SQL_Query_exec("SELECT username FROM users WHERE id=$arr2[userid]") or sqlerr();
$a2 = mysqli_fetch_assoc($r2);
print("<tr><td><a href=account-details.php?id=$arr2[userid]>$a2[username]</a></td><td align=left><a href=torrents-details.php?id=$arr2[torrent]&dllist=1#seeders>$arr2[torrent]");
if ($arr2['seeder'] == 'yes')
print("<font color=red>*</font>");
print("</a></td><td align=left>$arr2[client]</td></tr>\n");
}
print("</table>\n");
}
end_frame();
navmenu();
stdfoot();
}
if ($_GET['action'] == "sendpmunconnectable") {
stdhead("Peers that are unconnectable");
begin_frame("Send PM");
?>
<table class="main" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="embedded"><div align="center"><h1>Mass Message to All Non Connectable Users</a></h1>
<form method="post" action="admincp.php?action=viewlogsunconnectable">
<?php
if (isset($_GET["returnto"]) || isset($_SERVER["HTTP_REFERER"])) {
?>
<input type="hidden" name="returnto" value=<?php echo $_GET["returnto"] ? $_GET["returnto"] : $_SERVER["HTTP_REFERER"] ?> />
<?php
}
//default message
$body = "The tracker has determined that you are firewalled or NATed and cannot accept incoming connections. This means that other peers in the swarm will be unable to connect to you, only you to them. Even worse, if two peers are both in this state they will not be able to connect at all. This has obviously a detrimental effect on the overall speed. The way to solve the problem involves opening the ports used for incoming connections (the same range you defined in your client) on the firewall and/or configuring your NAT server to use a basic form of NAT for that range instead of NAPT (the actual process differs widely between different router models. Check your router documentation and/or support forum. You will also find lots of information on the subject at PortForward). Also if you need help please post in the forums or shoutbox your problems and we will try and figure it out. Thank You";
?>
<table cellspacing="0" cellpadding="5">
<tr>
<td>Send Mass Message To All Non Connectable Users<br>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td border="0"> </td>
<td border="0"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td><textarea name="msg" cols="120" rows="15"><?php echo $body?></textarea></td>
</tr>
<tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Send the PM!" class="btn"></td>
</tr>
</table>
<input type="hidden" name="receiver" value=<?php echo $receiver?> />
</form>
</div>
</td>
</tr>
</table>
<br>NOTE: Have fun
<?php
// if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$dt = sqlesc(get_date_time());
$msg = $_POST['msg'];
if (!$msg)
show_error_msg("Error", "Please Type In Some Text.", 1);
$query = SQL_Query_exec("SELECT distinct userid FROM peers WHERE connectable='no'");
while($dat=mysqli_fetch_assoc($query)){
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES (0,$dat[userid] , '" . get_date_time() . "', " . sqlesc($msg) .", '0')") or sqlerr(__FILE__,__LINE__); }
SQL_Query_exec("INSERT INTO notconnectablepmlog ( user , date ) VALUES ( $CURUSER[id], $dt)") or sqlerr(__FILE__,__LINE__);
write_log("A PM was sent to unconnectable users by ($CURUSER[username])");
die();
}
end_frame();
navmenu();
stdfoot();
}
if ($_GET['action'] == "viewlogsunconnectable") {
stdhead("Unconnectable Peers Mass PM Log");
begin_frame("Unconnectable PM Logs");
$getlog = SQL_Query_exec("SELECT * FROM notconnectablepmlog LIMIT 10");
print("Unconnectable Peers Mass PM Log");
print("<br/><br/><a href=admincp.php?action=sendpmunconnectable> <b>* Send all not connectable users a PM</b></a>");
print("<br/><a href=admincp.php?action=listunconnectable> <b>* List Unconnectable Users</b></a>");
print("<br/><br/>Please dont use the mass PM too often. We dont want to spam the users, just let them know they are unconnectable.<br/>");
print("Every week would be ok.<br/><br/>");
print("<table border=1 cellspacing=0 cellpadding=5>\n");
print("<br/><tr><td class=colhead>By User</td><td class=colhead>Date</td><td class=colhead>elapsed</td></tr>");
while($arr2 = mysqli_fetch_assoc($getlog)){
$r2 = SQL_Query_exec("SELECT username FROM users WHERE id=$arr2[user]") or sqlerr();
$a2 = mysqli_fetch_assoc($r2);
$elapsed = get_elapsed_time(sql_timestamp_to_unix_timestamp($arr2[date]));
print("<tr><td class=colhead><a href=account-details.php?id=$arr2[user]>$a2[username]</a></td><td class=colhead>$arr2[date]</td><td>$elapsed ago</td></tr>");
print("</table>");
}
end_frame();
navmenu();
stdfoot();
}