Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Torrent Trader
Reply
  #1  
Old 2nd October 2021, 22:34
leech24's Avatar
leech24 leech24 is offline
Member
 
Join Date: Feb 2015
Posts: 6
Default black jack [mod]
i make some search about mod black jack game

any one founded plz put it
Reply With Quote
  #2  
Old 4th October 2021, 02:49
MicroMonkey's Avatar
MicroMonkey MicroMonkey is offline
Senior Member
 
Join Date: Jun 2016
P2P
Posts: 40
Default
https://sourceforge.net/projects/tt-...s%20or%20mods/
__________________
More torrenttrader stuff at https://torrenttrader.uk
Reply With Quote
The Following User Says Thank You to MicroMonkey For This Useful Post:
papad (4th October 2021)
  #3  
Old 4th October 2021, 23:05
leech24's Avatar
leech24 leech24 is offline
Member
 
Join Date: Feb 2015
Posts: 6
Default
thanks micro

CREATE TABLE `blackjack`( `userid` INT(11) NOT NULL DEFAULT '0', `points` INT(11) NOT NULL DEFAULT '0', `status` ENUM('playing', 'waiting') NOT NULL DEFAULT 'playing', `cards` TEXT NOT NULL, `date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY(`userid`)) ENGINE = MyISAM;


i use mysql 5.7

Bump: i found some error
in my web


Quote:
Database Error in account-signup.php on line 126: Incorrect datetime value: '0000-00-00 00:00:00' for column 'last_login' at row 1. Query was: INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES ('adminl24','a8e9600c3c5d0e4edc767c2b39608996c2eb0 347','pPfm5HsVdpr72OIzzduu','A@AA.com','pending',' 2021-10-04 21:27:06','2021-10-04 21:27:06',25,84,'Male','',1,1,1,'142.247.196.199', 0).

in account signup ,line126
Quote:
SQL_Query_exec("INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES (" .
implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $email, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip(), 0.0))).")");

$id = mysqli_insert_id($GLOBALS["DBconnector"]);

$psecret = md5($secret);
$thishost = $_SERVER["HTTP_HOST"];
$thisdomain = preg_replace('/^www\./is', "", $thishost);
Bump: i found some error
in my web


Quote:
Database Error in account-signup.php on line 126: Incorrect datetime value: '0000-00-00 00:00:00' for column 'last_login' at row 1. Query was: INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES ('adminl24','a8e9600c3c5d0e4edc767c2b39608996c2eb0 347','pPfm5HsVdpr72OIzzduu','A@AA.com','pending',' 2021-10-04 21:27:06','2021-10-04 21:27:06',25,84,'Male','',1,1,1,'142.247.196.199', 0).

in account signup ,line126
Quote:
SQL_Query_exec("INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES (" .
implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $email, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip(), 0.0))).")");

$id = mysqli_insert_id($GLOBALS["DBconnector"]);

$psecret = md5($secret);
$thishost = $_SERVER["HTTP_HOST"];
$thisdomain = preg_replace('/^www\./is', "", $thishost);
Bump: i found some error
in my web


Quote:
Database Error in account-signup.php on line 126: Incorrect datetime value: '0000-00-00 00:00:00' for column 'last_login' at row 1. Query was: INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES ('adminl24','a8e9600c3c5d0e4edc767c2b39608996c2eb0 347','pPfm5HsVdpr72OIzzduu','A@AA.com','pending',' 2021-10-04 21:27:06','2021-10-04 21:27:06',25,84,'Male','',1,1,1,'142.247.196.199', 0).

in account signup ,line126
Quote:
SQL_Query_exec("INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES (" .
implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $email, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip(), 0.0))).")");

$id = mysqli_insert_id($GLOBALS["DBconnector"]);

$psecret = md5($secret);
$thishost = $_SERVER["HTTP_HOST"];
$thisdomain = preg_replace('/^www\./is', "", $thishost);
Bump: i found some error
in my web


Quote:
Database Error in account-signup.php on line 126: Incorrect datetime value: '0000-00-00 00:00:00' for column 'last_login' at row 1. Query was: INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES ('adminl24','a8e9600c3c5d0e4edc767c2b39608996c2eb0 347','pPfm5HsVdpr72OIzzduu','A@AA.com','pending',' 2021-10-04 21:27:06','2021-10-04 21:27:06',25,84,'Male','',1,1,1,'142.247.196.199', 0).

in account signup ,line126
Quote:
SQL_Query_exec("INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip, seedbonus) VALUES (" .
implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $email, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip(), 0.0))).")");

$id = mysqli_insert_id($GLOBALS["DBconnector"]);

$psecret = md5($secret);
$thishost = $_SERVER["HTTP_HOST"];
$thisdomain = preg_replace('/^www\./is', "", $thishost);
Reply With Quote
  #4  
Old 5th October 2021, 23:53
MicroMonkey's Avatar
MicroMonkey MicroMonkey is offline
Senior Member
 
Join Date: Jun 2016
P2P
Posts: 40
Default
disable mysql strict mode. maybe this will help you work it out https://www.phpkb.com/kb/article/how...mysql-163.html
__________________
More torrenttrader stuff at https://torrenttrader.uk
Reply With Quote
The Following User Says Thank You to MicroMonkey For This Useful Post:
leech24 (6th October 2021)
  #5  
Old 6th October 2021, 03:48
leech24's Avatar
leech24 leech24 is offline
Member
 
Join Date: Feb 2015
Posts: 6
Default
solved

Bump:
Quote:
CREATE TABLE `blackjack` (
`userid` int(11) NOT NULL default '0',
`points` int(11) NOT NULL default '0',
`status` enum('playing','waiting') NOT NULL default 'playing',
`cards` text NOT NULL,
`date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`userid`)
) ENGINE=MyISAM;

CREATE TABLE `cards` (
`id` int(11) NOT NULL auto_increment,
`points` int(11) NOT NULL default '0',
`pic` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;


INSERT INTO `cards` VALUES (1, 2, '2p.bmp');
INSERT INTO `cards` VALUES (2, 3, '3p.bmp');
INSERT INTO `cards` VALUES (3, 4, '4p.bmp');
INSERT INTO `cards` VALUES (4, 5, '5p.bmp');
INSERT INTO `cards` VALUES (5, 6, '6p.bmp');
INSERT INTO `cards` VALUES (6, 7, '7p.bmp');
INSERT INTO `cards` VALUES (7, 8, '8p.bmp');
INSERT INTO `cards` VALUES (8, 9, '9p.bmp');
INSERT INTO `cards` VALUES (9, 10, '10p.bmp');
INSERT INTO `cards` VALUES (10, 10, 'vp.bmp');
INSERT INTO `cards` VALUES (11, 10, 'dp.bmp');
INSERT INTO `cards` VALUES (12, 10, 'kp.bmp');
INSERT INTO `cards` VALUES (13, 1, 'tp.bmp');
INSERT INTO `cards` VALUES (14, 2, '2b.bmp');
INSERT INTO `cards` VALUES (15, 3, '3b.bmp');
INSERT INTO `cards` VALUES (16, 4, '4b.bmp');
INSERT INTO `cards` VALUES (17, 5, '5b.bmp');
INSERT INTO `cards` VALUES (18, 6, '6b.bmp');
INSERT INTO `cards` VALUES (19, 7, '7b.bmp');
INSERT INTO `cards` VALUES (20, 8, '8b.bmp');
INSERT INTO `cards` VALUES (21, 9, '9b.bmp');
INSERT INTO `cards` VALUES (22, 10, '10b.bmp');
INSERT INTO `cards` VALUES (23, 10, 'vb.bmp');
INSERT INTO `cards` VALUES (24, 10, 'db.bmp');
INSERT INTO `cards` VALUES (25, 10, 'kb.bmp');
INSERT INTO `cards` VALUES (26, 1, 'tb.bmp');
INSERT INTO `cards` VALUES (27, 2, '2k.bmp');
INSERT INTO `cards` VALUES (28, 3, '3k.bmp');
INSERT INTO `cards` VALUES (29, 4, '4k.bmp');
INSERT INTO `cards` VALUES (30, 5, '5k.bmp');
INSERT INTO `cards` VALUES (31, 6, '6k.bmp');
INSERT INTO `cards` VALUES (32, 7, '7k.bmp');
INSERT INTO `cards` VALUES (33, 8, '8k.bmp');
INSERT INTO `cards` VALUES (34, 9, '9k.bmp');
INSERT INTO `cards` VALUES (35, 10, '10k.bmp');
INSERT INTO `cards` VALUES (36, 10, 'vk.bmp');
INSERT INTO `cards` VALUES (37, 10, 'dk.bmp');
INSERT INTO `cards` VALUES (38, 10, 'kk.bmp');
INSERT INTO `cards` VALUES (39, 1, 'tk.bmp');
INSERT INTO `cards` VALUES (40, 2, '2c.bmp');
INSERT INTO `cards` VALUES (41, 3, '3c.bmp');
INSERT INTO `cards` VALUES (42, 4, '4c.bmp');
INSERT INTO `cards` VALUES (43, 5, '5c.bmp');
INSERT INTO `cards` VALUES (44, 6, '6c.bmp');
INSERT INTO `cards` VALUES (45, 7, '7c.bmp');
INSERT INTO `cards` VALUES (46, 8, '8c.bmp');
INSERT INTO `cards` VALUES (47, 9, '9c.bmp');
INSERT INTO `cards` VALUES (48, 10, '10c.bmp');
INSERT INTO `cards` VALUES (49, 10, 'vc.bmp');
INSERT INTO `cards` VALUES (50, 10, 'dc.bmp');
INSERT INTO `cards` VALUES (51, 10, 'kc.bmp');
INSERT INTO `cards` VALUES (52, 1, 'tc.bmp');
ALTER TABLE `users` ADD `bjwins` int(10) NOT NULL default '0';
ALTER TABLE `users` ADD `bjlosses` int(10) NOT NULL default '0';

sloved fir signup
but sql blacljack i think some thing wrong

Bump: it came blank page

tell me its play By ratio or seed bouns?
Reply With Quote
  #6  
Old 6th October 2021, 23:21
MicroMonkey's Avatar
MicroMonkey MicroMonkey is offline
Senior Member
 
Join Date: Jun 2016
P2P
Posts: 40
Default
are you using mysqli? If so, here ya go
bjstats.php
Quote:
<?php
require_once("backend/functions.php");
require_once("backend/config.php");

dbconn(false);
loggedinonly();
if ($CURUSER["class"] < "1") {
show_error_msg("Sorry...", "You must be a Crazy Seeder or above to play Blackjack.");
}

$mingames = 2;
stdhead("Blackjack Stats");
begin_frame("Blackjack Stats");
print("<center><h1>Blackjack Stats</h1></center>");

//print("<br />");

print("<center>Stats are cached and updated every 30 minutes. You need to play at least $mingames games to be included.</center>");

print("<br />");

// BEGIN CACHE ///////////////////////////////////////////////////////////

$cachefile = "" . $site_config["cache_dir"] . "/bjstats.txt";
$cachetime = 60 * 30; // 30 minutes
// Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) {
include($cachefile);
print("<p align=center><font class=small>This page last updated " . date('Y-m-d H:i:s', filemtime($cachefile)) . ". </font></p>");

end_frame();
stdfoot();

exit;
}
ob_start(); // start the output buffer

/////////////////////////////////////////////////////////////////////////

function bjtable($res, $frame_caption)
{
begin_frame($frame_caption, true);
begin_table();
?>
<tr>
<td class=colhead>Rank</td>
<td class=colhead align=left>User</td>
<td class=colhead align=right>Wins</td>
<td class=colhead align=right>Losses</td>
<td class=colhead align=right>Games</td>
<td class=colhead align=right>Percentage</td>
<td class=colhead align=right>Win/Loss</td>
</tr>
<?php
$num = 0;
while ($a = mysqli_fetch_assoc($res)) {
++$num;

//Calculate Win %
$win_perc = number_format(($a['wins'] / $a['games']) * 100, 1);

// Add a user's +/- statistic
$plus_minus = $a['wins'] - $a['losses'];
if ($plus_minus >= 0) {
$plus_minus = mksize(($a['wins'] - $a['losses']) * 1024 * 1024 * 1024);
} else {
$plus_minus = "-";
$plus_minus .= mksize(($a['losses'] - $a['wins']) * 1024 * 1024 * 1024);
}

print("<tr><td>$num</td><td align=left><table border=0 class=main cellspacing=0 cellpadding=0><tr><td class=embedded>" . "<b><a href=userdetails.php?id=" . $a['id'] . ">" . $a['username'] . "</a></b></td>" . "</tr></table></td><td align=right>" . number_format($a['wins'], 0) . "</td>" . "</td><td align=right>" . number_format($a['losses'], 0) . "</td>" . "</td><td align=right>" . number_format($a['games'], 0) . "</td>" . "</td><td align=right>$win_perc</td>" . "</td><td align=right>$plus_minus</td>" . "</tr>\n");
}
end_table();
end_frame();
}

// Most Games Played
$res = SQL_Query_exec("SELECT id, username, bjwins AS wins, bjlosses AS losses, bjwins + bjlosses AS games FROM users WHERE bjwins + bjlosses > $mingames ORDER BY games DESC LIMIT 10");

bjtable($res, "<center>Most Games Played</center>", "Users");

print("<br /><br />");
// /Most Games Played

// Highest Win %
$res = SQL_Query_exec("SELECT id, username, bjwins AS wins, bjlosses AS losses, bjwins + bjlosses AS games, bjwins / (bjwins + bjlosses) AS winperc FROM users WHERE bjwins + bjlosses > $mingames ORDER BY winperc DESC LIMIT 10");

bjtable($res, "<center>Highest Win Percentage</center>", "Users");

print("<br /><br />");
// /Highest Win %

// Most Credit Won
$res = SQL_Query_exec("SELECT id, username, bjwins AS wins, bjlosses AS losses, bjwins + bjlosses AS games, bjwins - bjlosses AS winnings FROM users WHERE bjwins + bjlosses > $mingames ORDER BY winnings DESC LIMIT 10");

bjtable($res, "<center>Most Credit Won</center>", "Users");

print("<br /><br />");
// /Most Credit Won

// Most Credit Lost
$res = SQL_Query_exec("SELECT id, username, bjwins AS wins, bjlosses AS losses, bjwins + bjlosses AS games, bjlosses - bjwins AS losings FROM users WHERE bjwins + bjlosses > $mingames ORDER BY losings DESC LIMIT 10");

bjtable($res, "<center>Most Credit Lost</center>", "Users");

// /Most Credit Lost

// CACHE END ////////////////////////////////////////////////////////////

// open the cache file for writing
$fp = fopen($cachefile, 'w');
// save the contents of output buffer to the file
fwrite($fp, ob_get_contents());
// close the file
fclose($fp);
// Send the output to the browser
ob_end_flush();

/////////////////////////////////////////////////////////////////////////

print("<br /><br />");
end_frame();
stdfoot();
?>
blackjack.php
Quote:
<?php
require_once("backend/functions.php");
dbconn(false);

if ($CURUSER["class"] < "1") {
show_error_msg("Sorry...", "You must be a Crazy Seeder or above to play Blackjack.", 1);
}

if (!function_exists('get_user_name')) {
function get_user_name($userid)
{
$r = SQL_Query_exec("select username from users where id=$userid");
$a = mysqli_fetch_array($r);
return "$a[username]";
}
}
// Bet size
$mb = $site_config['betsize']*1024*1024*1024; //bet size. Edit config.php to change the value
$now = sqlesc(get_date_time());

// Pull the user's statisctics
$r = SQL_Query_exec("SELECT bjwins, bjlosses FROM users WHERE id=$CURUSER[id]");
$a = mysqli_fetch_array($r);
$tot_wins = $a['bjwins'];
$tot_losses = $a['bjlosses'];
$tot_games = $tot_wins + $tot_losses;

// If this gets through there is an error somewhere!
$win_perc = "<a href="/sendmessage.php?receiver=1">Error!</a>";

// Calculate user's win percentage
if ($tot_losses == 0) {
if ($tot_wins > 0) // 0 losses, > 0 wins = 100%
$win_perc = "100%";
if ($tot_wins == 0) // 0 losses, 0 wins = "---"
$win_perc = "---";
} else if ($tot_losses > 0) {
if ($tot_wins == 0) // > 0 losses, 0 wins = 0%
$win_perc = "0";
if ($tot_wins > 0) // > 0 losses, > 0 wins = return win % rounded to nearest tenth
$win_perc = number_format(($tot_wins / $tot_games) * 100, 1);
$win_perc .= "%";
}

// Add a user's +/- statistic
$plus_minus = $tot_wins - $tot_losses;
if ($plus_minus >= 0) {
$plus_minus = mksize(($tot_wins - $tot_losses) * $mb);
} else {
$plus_minus = "-";
$plus_minus .= mksize(($tot_losses - $tot_wins) * $mb);
}

// Game Mechanics
if ($_POST["game"]) {
$cardcountres = SQL_Query_exec("select count(id) from cards");
$cardcountarr = mysqli_fetch_array($cardcountres);
$cardcount = $cardcountarr[0];
if ($_POST["game"] == 'start') {
if ($CURUSER["uploaded"] < $mb)
show_error_msg("Sorry " . $CURUSER["username"], "You haven't uploaded " . mksize($mb) . " yet.", 1);
$required_ratio = 0.3;
if ($CURUSER["downloaded"] > 0)
$ratio = number_format($CURUSER["uploaded"] / $CURUSER["downloaded"], 2);
else if ($CURUSER["uploaded"] > 0)
$ratio = 999;
else
$ratio = 0;
if ($ratio < $required_ratio)
show_error_msg("Sorry " . $CURUSER["username"], "Your ratio is lower than the requirement of " . $required_ratio . "%.", 1);
$res = SQL_Query_exec("select count(*) from blackjack where userid=$CURUSER[id] and status='waiting'");
$arr = mysqli_fetch_array($res);
if ($arr[0] > 0) {
show_error_msg("" .T_("SORRY"). "", "" .T_("ERROR_YOU_LAST_GAME"). "<br /><br /><a href=blackjack.php>" .T_("BACK"). "</a>", 1);
} else {
$res = SQL_Query_exec("select count(*) from blackjack where userid=$CURUSER[id] and status='playing'");
$arr = mysqli_fetch_array($res);
if ($arr[0] > 0)
show_error_msg("" .T_("SORRY"). "", "" .T_("ERROR1"). " <form method=post name=form action=$phpself><input type=hidden name=game value=cont><center><input type=submit value=' " .T_("CONTINUE_OLD_GAME"). " '></center></form>", 1);
}
$cardid = rand(1, $cardcount);
$cardres = SQL_Query_exec("select * from cards where id=$cardid");
$cardarr = mysqli_fetch_array($cardres);
if ($cardarr['points'] == 1)
$cardarr[points] = 11;
SQL_Query_exec("insert into blackjack (userid, points, cards, date) values($CURUSER[id], $cardarr[points], $cardid, $now)");
stdhead("Blackjack");
begin_frame("Blackjack");
print("<h1>" .T_("WELCOME"). ", <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>!</h1>\n");
print("<table align=center cellspacing=0 cellpadding=3 width=600>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5 >");
print("<form name=blackjack method=post action=$phpself>");
print("<table class=message width=100% cellspacing=0 cellpadding=5 >\n");
print("<tr><td align=center><img src=images/cards/" . $cardarr["pic"] . " width=71 height=96 border=0></td></tr>");
print("<tr><td align=center><b>Points = $cardarr[points]</b></td></tr>");
print("<tr><td align=center><input type=hidden name=game value=cont><input type=submit value=' " .T_("HIT_ME"). " '></td></tr>");
print("</table>");
print("</form>");
print("</td></tr></table><br />");
end_frame("Blackjack");
stdfoot();
} elseif ($_POST["game"] == 'cont') {
$playeres = SQL_Query_exec("select * from blackjack where userid=$CURUSER[id]");
$playerarr = mysqli_fetch_array($playeres);
$showcards = "";
$aces = 0;
$points = 0;
$cards = $playerarr["cards"];
$usedcards = explode(" ", $cards);
$arr = array();
foreach ($usedcards as $array_list)
$arr[] = $array_list;
foreach ($arr as $card_id) {
$used_card = SQL_Query_exec("SELECT * FROM cards WHERE id='$card_id'");
$used_cards = mysqli_fetch_array($used_card);
$showcards .= "<img src=images/cards/" . $used_cards["pic"] . " width=71 height=96 border=0> ";
if ($used_cards["points"] > 1)
$points = $points + $used_cards['points'];
else
$aces = $aces + 1;
}
$cardid = rand(1, $cardcount);
while (in_array($cardid, $arr)) {
$cardid = rand(1, $cardcount);
}
$cardres = SQL_Query_exec("select * from cards where id=$cardid");
$cardarr = mysqli_fetch_array($cardres);
$showcards .= "<img src=images/cards/" . $cardarr["pic"] . " width=71 height=96 border=0> ";
if ($cardarr["points"] > 1)
$points = $points + $cardarr["points"];
else
$aces = $aces + 1;
for ($i = 0; $i < $aces; $i++) {
if ($points < 11 && $aces - $i == 1)
$points = $points + 11;
else
$points = $points + 1;
}

$mysqlcards = "$playerarr[cards] $cardid";
SQL_Query_exec("update blackjack set points=$points, cards='$mysqlcards' where userid=$CURUSER[id]");
if ($points == 21) {
$waitres = SQL_Query_exec("select count(*) from blackjack where status='waiting' and userid!=$CURUSER[id]");
$waitarr = mysqli_fetch_array($waitres);
stdhead("Blackjack");
begin_frame("Blackjack");
print("<h1>" .T_("GAME_OVER"). "</h1>\n");
print("<table align=center cellspacing=0 cellpadding=3 width=600>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5 />");
print("<table class=message width=100% cellspacing=0 cellpadding=5 >\n");
print("<tr><td align=center>$showcards</td></tr>");
print("<tr><td align=center><b>Points = $points</b></td></tr>");
if ($waitarr[0] > 0) {
$r = SQL_Query_exec("select * from blackjack where status='waiting' and userid!=$CURUSER[id] order by date asc LIMIT 1");
$a = mysqli_fetch_assoc($r);
if ($a["points"] != 21) {
$winorlose = "you won " . mksize($mb);
SQL_Query_exec("update users set uploaded = uploaded + $mb, bjwins = bjwins + 1 where id=$CURUSER[id]");
SQL_Query_exec("update users set uploaded = uploaded - $mb, bjlosses = bjlosses + 1 where id=$a[userid]");
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You lost to $CURUSER[username] (you got $a[points] points, and $CURUSER[username] got 21 points).\n\n ."/blackjack.php]Play again!");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
} else {
$winorlose = "nobody won";
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You tied with $CURUSER[username] (Both of you had $a[points] points).\n\n ."/blackjack.php]Play again!");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");

}
print("<tr><td align=center>" .T_("YOUR_OPPONENT_WAS"). " " . get_user_name($a["userid"]) . ", " .T_("THEY_HAD"). " $a[points] points, $winorlose.<br /><br /><center><b><a href=blackjack.php>" .T_("PLAY_AGAIN"). "</a></b></center></td></tr>");
} else {
SQL_Query_exec("update blackjack set status = 'waiting', date='" . get_date_time() . "' where userid = $CURUSER[id]");
print("<tr><td align=center>" .T_("ODTHER_PLAYERS1"). "<br />" .T_("ODTHER_PLAYERS2"). "<br /><br /><center><b><a href=blackjack.php>" .T_("BACK"). "</a></b><br /></center></td></tr>");
}
print("</table>");
print("</td></tr></table><br />");
end_frame();
stdfoot();
} elseif ($points > 21) {
$waitres = SQL_Query_exec("select count(*) from blackjack where status='waiting' and userid!=$CURUSER[id]");
$waitarr = mysqli_fetch_array($waitres);
stdhead("Blackjack");
begin_frame("Blackjack");
print("<h1>" .T_("GAME_OVER"). "</h1>\n");
print("<table align=center cellspacing=0 cellpadding=3 width=600>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5 />");
print("<table class=message width=100% cellspacing=0 cellpadding=5 >\n");
print("<tr><td align=center>$showcards</td></tr>");
print("<tr><td align=center><b>Points = $points</b></td></tr>");
if ($waitarr[0] > 0) {
$r = SQL_Query_exec("select * from blackjack where status='waiting' and userid!=$CURUSER[id] order by date asc LIMIT 1");
$a = mysqli_fetch_assoc($r);
if ($a["points"] > 21) {
$winorlose = "nobody won";
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("Your opponent was $CURUSER[username], Nobody won.\n\n ."/blackjack.php]" .T_("BACK"). "");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
} else {
$winorlose = "you lost " . mksize($mb);
SQL_Query_exec("update users set uploaded = uploaded - $mb, bjlosses = bjlosses + 1 where id=$CURUSER[id]");
SQL_Query_exec("update users set uploaded = uploaded + $mb, bjwins = bjwins + 1 where id=$a[userid]");
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You beat $CURUSER[username] (You had $a[points] points, $CURUSER[username] had $points points).\n\n ."/blackjack.php]" .T_("BACK"). "");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
}
print("<tr><td align=center>Your opponent was " . get_user_name($a["userid"]) . ", They had $a[points] points, $winorlose.<br /><br /><center><b><a href=blackjack.php>Play again</a></b></center></td></tr>");
} else {
SQL_Query_exec("update blackjack set status = 'waiting', date='" . get_date_time() . "' where userid = $CURUSER[id]");
print("<tr><td align=center>" .T_("ODTHER_PLAYERS1"). "<br />" .T_("ODTHER_PLAYERS2"). "<br /><br /><center><b><a href=blackjack.php>" .T_("BACK"). "</a></b><br /></center></td></tr>");
}
print("</table>");
print("</td></tr></table><br />");
end_frame();
stdfoot();
} else {
stdhead("Blackjack");
begin_frame("Blackjack");
print("<h1>" .T_("WELCOME"). ", <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>!</h1>\n");
print("<table align=center cellspacing=0 cellpadding=3 width=600>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5 />");
print("<table class=message width=100% cellspacing=0 cellpadding=5 >\n");
print("<tr><td align=center>$showcards</td></tr>");
print("<tr><td align=center><b>Points = $points</b></td></tr>");
print("<form name=blackjack method=post action=$phpself>");
print("<tr><td align=center><input type=hidden name=game value=cont><input type=submit value=' " .T_("HIT_ME"). " '></td></tr>");
print("</form>");
print("<form name=blackjack method=post action=$phpself>");
print("<tr><td align=center><input type=hidden name=game value=stop><input type=submit value=' " .T_("STAY"). " '></td></tr>");
print("</form>");
print("</table>");
print("</td></tr></table><br />");
end_frame();
stdfoot();
}
} elseif ($_POST["game"] == 'stop') {
$playeres = SQL_Query_exec("select * from blackjack where userid=$CURUSER[id]");
$playerarr = mysqli_fetch_array($playeres);
$showcards = "";
$cards = $playerarr["cards"];
$usedcards = explode(" ", $cards);
$arr = array();
foreach ($usedcards as $array_list)
$arr[] = $array_list;
foreach ($arr as $card_id) {
$used_card = SQL_Query_exec("SELECT * FROM cards WHERE id='$card_id'");
$used_cards = mysqli_fetch_array($used_card);
$showcards .= "<img src=images/cards/" . $used_cards["pic"] . " width=71 height=96 border=0> ";
}
$waitres = SQL_Query_exec("select count(*) from blackjack where status='waiting' and userid!=$CURUSER[id]");
$waitarr = mysqli_fetch_array($waitres);
stdhead("Blackjack");
begin_frame("Blackjack");
print("<h1>" .T_("GAME_OVER"). "</h1>\n");
print("<table align=center cellspacing=0 cellpadding=3 width=600>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5 />");
print("<table class=message width=100% cellspacing=0 cellpadding=5 >\n");
print("<tr><td align=center>$showcards</td></tr>");
print("<tr><td align=center><b>Points = $playerarr[points]</b></td></tr>");
if ($waitarr[0] > 0) {
$r = SQL_Query_exec("select * from blackjack where status='waiting' and userid!=$CURUSER[id] order by date asc LIMIT 1");
$a = mysqli_fetch_assoc($r);
if ($a["points"] == $playerarr['points']) {
$winorlose = "nobody won";
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("Your opponent was $CURUSER[username], you both had $a[points] points - it was a tie.\n\n ."/blackjack.php]Play Again");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
} elseif ($a["points"] < $playerarr['points'] && $a['points'] < 21) {
$winorlose = "you won " . mksize($mb);
SQL_Query_exec("update users set uploaded = uploaded + $mb, bjwins = bjwins + 1 where id=$CURUSER[id]");
SQL_Query_exec("update users set uploaded = uploaded - $mb, bjlosses = bjlosses + 1 where id=$a[userid]");
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You lost to $CURUSER[username] (You had $a[points] points, $CURUSER[username] had $playerarr[points] points).\n\n ."/blackjack.php]Play Again");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
} elseif ($a["points"] > $playerarr['points'] && $a['points'] < 21) {
$winorlose = "you lost " . mksize($mb);
SQL_Query_exec("update users set uploaded = uploaded - $mb, bjlosses = bjlosses + 1 where id=$CURUSER[id]");
SQL_Query_exec("update users set uploaded = uploaded + $mb, bjwins = bjwins + 1 where id=$a[userid]");
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You beat $CURUSER[username] (You had $a[points] points, $CURUSER[username] had $playerarr[points] points).\n\n ."/blackjack.php]Play Again");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
} elseif ($a["points"] == 21) {
$winorlose = "you lost " . mksize($mb);
SQL_Query_exec("update users set uploaded = uploaded - $mb, bjlosses = bjlosses + 1 where id=$CURUSER[id]");
SQL_Query_exec("update users set uploaded = uploaded + $mb, bjwins = bjwins + 1 where id=$a[userid]");
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You beat $CURUSER[username] (You had $a[points] points, $CURUSER[username] had $playerarr[points] points).\n\n ."/blackjack.php]Play Again");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
} elseif ($a["points"] < $playerarr['points'] && $a[points] > 21) {
$winorlose = "you lost " . mksize($mb);
SQL_Query_exec("update users set uploaded = uploaded - $mb, bjlosses = bjlosses + 1 where id=$CURUSER[id]");
SQL_Query_exec("update users set uploaded = uploaded + $mb, bjwins = bjwins + 1 where id=$a[userid]");
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You beat $CURUSER[username] (You had $a[points] points, $CURUSER[username] had $playerarr[points] points).\n\n ."/blackjack.php]Play Again");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
} elseif ($a["points"] > $playerarr['points'] && $a['points'] > 21) {
$winorlose = "you won " . mksize($mb);
SQL_Query_exec("update users set uploaded = uploaded + $mb, bjwins = bjwins + 1 where id=$CURUSER[id]");
SQL_Query_exec("update users set uploaded = uploaded - $mb, bjlosses = bjlosses + 1 where id=$a[userid]");
SQL_Query_exec("delete from blackjack where userid=$CURUSER[id]");
SQL_Query_exec("delete from blackjack where userid=$a[userid]");
$dt = sqlesc(get_date_time());
$msg = sqlesc("You lost to $CURUSER[username] (You had $a[points] points, $CURUSER[username] had $playerarr[points] points).\n\n ."/blackjack.php]Play Again");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $a[userid], $dt, $msg, 0)");
}
print("<tr><td align=center>Your opponent was " . get_user_name($a["userid"]) . ", they had $a[points] points, $winorlose.<br /><br /><center><b><a href=blackjack.php>Play again</a></b></center></td></tr>");
} else {
SQL_Query_exec("update blackjack set status = 'waiting', date='" . get_date_time() . "' where userid = $CURUSER[id]");
print("<tr><td align=center>" .T_("ODTHER_PLAYERS1"). "<br />" .T_("ODTHER_PLAYERS2"). "<br /><br /><center><b><a href=blackjack.php>" .T_("BACK"). "</a></b><br /></center></td></tr>");
}
print("</table>");
print("</td></tr></table><br />");
end_frame();
stdfoot();
}
} else {
// Start screen - Not currently playing a game
stdhead("Blackjack");
begin_frame("Blackjack");
$rulesmessage = sprintf( T_("BY_PLAYING"), mksize($mb));
print("<h1><center>Blackjack</center></h1>\n");
print("<center><table align=center cellspacing=0 cellpadding=3 width=400>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5 align=center>\n");
print("<table class=message width=100% cellspacing=0 cellpadding=10 >\n");
print("<tr><td align=center><img src=images/cards/tp.bmp width=71 height=96 border=0> <img src=images/cards/vp.bmp width=71 height=96 border=0> </td></tr>\n");
print("<tr><td align=left>" .T_("YOU_MUST_COLLECT_21"). "\n<a href=info_blackjack.html target=wclose
onclick=window.open('info_blackjack.html','wclose' ,'width=820','height=864','toolbar=yes','status=no ','left=30','top=20')><img border='0' src='images/INFO_UPLOAD.png' width='40' height='30' alt='Plus d'information!!' title='Plus d'information!!' /></a><br /><br />\n");
print("<b>" .T_("NOTE"). ":</b> " .$rulesmessage. "</td></tr>\n");
print("<tr><td align=center>\n");
print("<form name=form method=post action=$phpself><input type=hidden name=game value=start><input type=submit class=btn value=' " .T_("START"). " '>\n");
print("</td></tr></table>\n");
print("</td></tr></table>\n");

print("<br /><br /><br />\n");

print("<table align=center cellspacing=0 cellpadding=3 width=400>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5 align=center>\n");
print("<h1><center>" .T_("PERSONNAL_STATISTICS"). "</center></h1>\n");
print("<tr><td align=left><b>" .T_("WINS"). "</b></td><td align=center><b>$tot_wins</b></td></tr>\n");
print("<tr><td align=left><b>" .T_("LOSSES"). "</b></td><td align=center><b>$tot_losses</b></td></tr>\n");
print("<tr><td align=left><b>" .T_("GAMES_PLAYED"). "</b></td><td align=center><b>$tot_games</b></td></tr>\n");
print("<tr><td align=left><b>" .T_("WIN_PERCENTAGE"). "</b></td><td align=center><b>$win_perc</b></td></tr>\n");
print("<tr><td align=left><b>+/-</b></td><td align=center><b>$plus_minus</b></td></tr>\n");
print("<tr><a href=bjstats.php><center><h1>Click here to view all player stats</h1></center></a></tr>\n");
print("</td></tr></table></center>\n");
end_frame();
stdfoot();
}
?>
Bump: loaded it on github, have fun https://github.com/MicrosoulV3/Blackjack-for-TTv3

Bump: loaded it on github, have fun https://github.com/MicrosoulV3/Blackjack-for-TTv3
__________________
More torrenttrader stuff at https://torrenttrader.uk

Last edited by MicroMonkey; 7th October 2021 at 13:02.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 13:26. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2021, vBulletin Solutions Inc.