-
Notifications
You must be signed in to change notification settings - Fork 45
/
withdrawal.php
156 lines (131 loc) · 4.95 KB
/
withdrawal.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
<?php
error_reporting(E_ALL & ~ E_NOTICE); ini_set('display_errors', 1);
require_once "header.php";
require_once "maincore.php";
require_once "includes/dbconnector.class.php";
$db=new DbConnector;
if( isset($_POST['currency'] ) ){
if (isset($_POST['address'])) {
$address = $_POST['address'];
$prepare=$db->mysqli->prepare("select user_id from tbl_user where address=?");
$prepare->bind_param('s',$address);
$prepare->execute();
$prepare->store_result();
$ucount=$prepare->num_rows;
$prepare->close();
if(!$ucount){
$prepare=$db->mysqli->prepare("update tbl_user set address = ? where user_id = ? ");
$prepare->bind_param('si',$address,$uid);
$prepare->execute();
$prepare->close();
} else {
$_SESSION['error']['addressexist']=true;
return;
}
}
$db->queryres("SELECT * from tbl_config where header='currency'");
$curtype = $db->res['value'];
$amount=$_POST['amount'];
/*Bitcoin : Transfer all payment in one transaction without fees | mBTCLitecoin : 1% + 1 mLTCDogecoin : 1% + 1.0 DogePeercoin : 1% + 10 mPPCDarkcoin : 1% + 1 mDRK */
switch ($curtype)
{
case "BTC" : $fees = $amount; break;
case "mBTC" : $fees = $amount; break;
case "Satoshi" : $fees = $amount; break;
case "LTC" : $fees = $amount - (($amount/100.0) + 0.001); break;
case "mLTC" : $fees = $amount - (($amount/100.0) + 1); break;
case "DOGE" : $fees = $amount - (($amount/100.0) + 1); break;
case "mDOGE" : $fees = $amount - (($amount/100.0) + 1000); break;
case "PPC" : $fees = $amount - (($amount/100.0) + 0.01); break;
case "mPPC" : $fees = $amount - (($amount/100.0) + 10); break;
case "DRK" : $fees = $amount - (($amount/100.0) + 0.001); break;
case "mDRK" : $fees = $amount - (($amount/100.0) + 1); break;
}
$db->queryres("SELECT * FROM tbl_config where header='currencymin' ");
if($amount>=$db->res['value']){
if($userdet['credit']>=$amount){
$prepare=$db->mysqli->prepare("insert into tbl_withdrawal (user_id,amount,type) values (?,?,1) ");
$prepare->bind_param('id',$uid,$fees);
$prepare->execute();
$prepare->close();
$db->query("update tbl_user set credit=credit-'$amount' where user_id='$uid'");
header('Location:withdrawal.php');
}else
$_SESSION['error']['over']=true;
}else
$_SESSION['error']['less']=true;
header('Location:withdrawal.php');
}elseif( isset($_POST['asmoney'] ) ){
if (isset($_POST['wallet'])) {
$ausername = $_POST['wallet'];
$prepare=$db->mysqli->prepare("select user_id from tbl_user where ausername=?");
$prepare->bind_param('s',$ausername);
$prepare->execute();
$prepare->store_result();
$ucount=$prepare->num_rows;
$prepare->close();
if(!$ucount){
$prepare=$db->mysqli->prepare("update tbl_user set ausername = ? where user_id = ? ");
$prepare->bind_param('si',$ausername,$uid);
$prepare->execute();
$prepare->close();
}
else {
$_SESSION['error']['accountexist']=true;
return;
}
}
$amount=$_POST['amount'];
$db->queryres("SELECT * FROM tbl_config where header='asmoneymin' ");
if($amount>=$db->res['value']){
if($userdet['credit']>=$amount){
$prepare=$db->mysqli->prepare("insert into tbl_withdrawal (user_id,amount,type) values (?,?,0) ");
$prepare->bind_param('id',$uid,$amount);
$prepare->execute();
$prepare->close();
$db->query("update tbl_user set credit=credit-'$amount' where user_id='$uid'");
header('Location:withdrawal.php');
}else
$_SESSION['error']['over']=true;
}else
$_SESSION['error']['less']=true;
header('Location:withdrawal.php');
}else{
$with=array();
$db->query("select * from tbl_withdrawal where user_id='$uid' order by date desc");
while($res=$db->fetchArray()){
$ar=array('amount'=>$res['amount'],'date'=>($res['date'])? date('Y/m/d',$res['date']) : '','status'=>$res['status'],'type'=>$res['type']);
array_push($with,$ar);
}
$db->queryres("select * from tbl_config where header='currency'");
$smarty->assign('curency',$db->res['value']);
$smarty->assign('credit',$userdet['credit']);
$smarty->assign('with',$with);
if(isset($_SESSION['error']['addressexist'])){
$smarty->assign('addressexist',true);
unset($_SESSION['error']);
}
if(isset($_SESSION['error']['accountexist'])){
$smarty->assign('accountexist',true);
unset($_SESSION['error']);
}
if(isset($_SESSION['error']['less'])){
$smarty->assign('less',true);
unset($_SESSION['error']);
}
$db->queryres("SELECT * FROM tbl_config where header='currencymin' ");
$smarty->assign('cur_min',$db->res['value']);
$db->queryres("SELECT * FROM tbl_config where header='asmoneymin' ");
$smarty->assign('as_min',$db->res['value']);
$db->queryres("SELECT * FROM tbl_user where user_id='$uid' ");
$asmoneyacc = $db->res['ausername'];
$cryptoaddress = $db->res['address'];
if ($asmoneyacc != NULL) {
$smarty->assign('asmoneyexist',$asmoneyacc);
}
if ($cryptoaddress != NULL) {
$smarty->assign('cryptoexist',$cryptoaddress);
}
$smarty->display('template/withdrawal.tpl');
}
?>