-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwithdraw.php
161 lines (141 loc) · 4.76 KB
/
withdraw.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
require_once 'common.php';
validate_session();
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--<meta http-equiv="refresh" content="3" /> uncoment this for auto refresh-->
<meta name="keywords" content="blackjack, bitcoin" />
<meta name="description" content="BitJack21 - Bitcoin Blackjack - Withdraw" />
<link rel="Shortcut Icon" href="images/favicon.ico">
<title>BitJack21 - Bitcoin Blackjack - Withdraw</title>
<base target="_self" />
<!--Stylesheets-->
<link href="css/layout.css" rel="stylesheet" type="text/css" media="screen" />
<!--Javascript-->
<!--[if IE]>
<script src="js/html5.js"></script>
<![endif]-->
<?php
if(!isset($_SESSION['username']))
{
echo <<<DONE
<title>Logging Out</title>
<meta http-equiv="REFRESH" content="1;url=index"></HEAD>
<BODY>
Your session has ended, logging out...
</BODY>
</HTML>
DONE;
exit();
}
?>
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery.backgroundPosition.js_6.js"></script>
<script type="text/javascript" src="js/menu.js"></script>
<script type="text/javascript">
$(function() {
$('#sendcoins').click(function() {
$('#sendcoins').hide();
$('#result').empty();
$.post("wd", { "password":$('#pw').val(), "amount":$('#amt').val(), "wallet":$('#wallet').val()}, updateState,"json");
});
});
function updateState(data)
{
if(data.error == 0)
{
$('#result').css('font-size','160%').css('color','rgb(255,0,0)').html("Coins sent!<br>Transaction ID: "+data.txid);
$('#bal').fadeOut('fast').html('Refresh to see').fadeIn('fast');
$('#sendcoins').show();
}
else if(data.error == 1)
{
$('#result').css('font-size','160%').css('color','rgb(255,0,0)').html("Your withdrawl has been queued and will complete within 24 hours.<br><br>Most withdrawals are immediate, but due to security reasons only a limited number of bitcoins are kept on the server. The amount of your withdrawal exceeds the number of bitcoins currently available on the server. Your transaction will be manually processed within 24 hours. Thank you.");
$('#bal').fadeOut('fast').html('Refresh to see').fadeIn('fast');
$('#sendcoins').show();
}
else if(data.error == 2)
{
$('#result').css('font-size','160%').css('color','rgb(255,0,0)').html("Password incorrect.");
$('#sendcoins').show();
setTimeout(function(){
$('#result').empty();
}, 1300);
}
else
{
$('#result').css('font-size','160%').css('color','rgb(255,0,0)').html(data.error);
$('#sendcoins').show();
}
}
</script>
</head>
<body>
<div id="wrapper">
<div id="header"></div>
<div id="menubar"><?php drawmenu(); ?></div>
<div id="singlecolumn">
<?php
$fail = 0;
$con = connectDB();
if (!$con)
{
$fail = 1;
}
$result = mysql_query("SELECT * from users where username = '".$_SESSION['username']."'", $con);
if(mysql_num_rows($result) == 1)
{
$myuser = mysql_fetch_array($result);
}
else
{
$fail = 1;
}
if($fail == 1)
{
echo <<<DONE
Temporary error: Database is down (-494)
</div>
</div>
</BODY>
</HTML>
DONE;
exit();
}
else
{
$mybal = getBTCBalance();
if(is_null($mybal))
{
echo <<<DONE2
Temporary error: bitcoin daemon is down (-4943)
</div>
</div>
</body>
</html>
DONE2;
}
echo '<br><br><p style="text-align:center">To deposit bitcoins, send them to your deposit address listed below. One confirmation is required before the bitcoins will appear in your account.</p>';
echo '<table border="1" style="text-align:left;margin-left:auto;margin-right:auto;">';
echo '<tr><td>Username</td><td>'.$myuser['username'].'</td></tr>';
echo '<tr><td>Balance (BTC)</td><td id="bal">'.$mybal.'</td></tr>';
echo '<tr><td>Deposit Address</td><td>'.$myuser['deposit'].'</td></tr></table><br><br><br>';
}
?>
<p>Withdraw bitcoins:</p>
<p>NOTE: There is a 0.01 BTC transaction fee for all withdraws.</p>
<table style="text-align:left;margin-left:auto;margin-right:auto;">
<tr><td>Password:</td><td><input id="pw" type="password" size="40" name="password"></td></tr>
<tr><td>Amount to withdraw (BTC):</td><td><input id="amt" type="text" size="40" name="btcamount"></td></tr>
<tr><td>Bitcoin address to send coins to:</td><td><input id="wallet" type="text" size="40" name="btcaddress"></td></tr>
</table>
<p style="font-size:70%">NOTE: This field accepts 8-decimal precision. Some older bitcoin clients do not properly handle transactions where the amount has more than 2 decimal places. We take no responsibility for lost BTC if you use more than 2 decimal places!</p>
<div style="text-align: center;"><br><button id="sendcoins" type="button">Send Coins</button><br><br>
<span id="result" ></span></div>
</div>
</div>
</body>
</html>