File size: 2.86Kb
<?php
/************************************
Script : Adnetwork
Website : http://facebook.com/pranto007
Script is created and provided by Pranto (http://facebook.com/pranto007)
**************************************/
include '../db.php';
include '../functions.php';
headtag("$SiteName - Deduct Main Balance");
if($adminlog==1){
$uid=formget("id");
$userd=mysql_fetch_array(mysql_query("SELECT * FROM userdata WHERE id='$uid'"));
$balance=$userd["pubalance"];
$mobile=$userd["verimobile"];
$user=$userd["username"];
if(isset($_POST["bal"]) AND isset($_POST["res"])){
$newbal=formpost("bal");
$res=formpost("res");
$newbals=($userd["pubalance"]-$newbal);
$doit=mysql_query("UPDATE userdata SET pubalance='$newbals' WHERE id='$uid'");
$arshad=mysql_query("INSERT INTO deductions (userid,amount,type,reason) VALUES ('$uid','$newbal','Main','$res')");
//sample php code
//this will collect data from form
//$mobile = $_POST['mobile'];
//$msg = "Hello $user ,
//We have deducted $newbal $ from your account.
//Reason-$res
//Thanks for using EarnBuzz.In
//";
//echo $mobile."<br/>".$msg;
//echo "<br/>";
//check whether user enter some data or not
//if(empty($mobile)){
//echo"enter mobile number";
//exit;
//}
//if(empty($msg)){
//echo"enter message";
//exit;
//}
//end of data input checking
//$msg = urlencode("$msg"); //IMPORTANT
//doing recharge now by hitting jolo api
//$ch = curl_init();
//$timeout = 0; // set to zero for no timeout
//$myurl = "http://bhashsms.com/api/sendmsg.php?user=9018242169&pass=arshad&sender=EarnBz&phone=$mobile&text=$msg&priority=ndnd&stype=normal";
//curl_setopt ($ch, CURLOPT_URL, $myurl);
//curl_setopt ($ch, CURLOPT_HEADER, 0);
//curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
//$file_contents = curl_exec($ch);
//curl_close($ch);
//echo"$file_contents";
//$to = $userd['email'];
//$subject = "We have deducted $newbal $ from your account-EarnBuzz.In";
//$message = 'Hello '.$user.'!
//We have deducted '.$newbal.' $ from your account.
//Reason-'.$res.'
//Thanks for using EarnBuzz.In';
//$from = "Support@EarnBuzz.In";
//$headers = "From:" . $from;
//mail($to,$subject,$message,$headers);
//mysql_query("INSERT INTO notifications (user, news , other, stat)
//VALUES ('$user', 'We Have Deducted ".$newbal." $ From Your Account.', 'none', 'none')");
if($doit AND $arshad){
echo '<div class="success">Main Balance Deducted Successfully!</div>';
}
else {
echo '<div class="error">Unknown Error!</div>';
}
}
echo '<div class="form"><form method="post">Fund in $.:<br/><input type="text" name="bal" value=""/><br/>Reason:<br/><input type="text" name="res" value=""/><br/><input type="submit" value="Deduct"/></form></div>';
echo '<a href="user.php?id='.$uid.'"><div class="ua">Go Back</div></a>';
include '../foot.php';
}
else {
header('Location:login.php');
}
?>