ajgkqsldxvkqsldkqs azelfkqsmkqsmlkdqsmld azmlekdqmskdmlqskd nkldsfkqsmldkqsmdmlskd decrypt($_GET['id']); $token = $mcrypt->decrypt($_GET['fid']); $message = ""; $success = 0; /* Fetch the information */ $con = db_connect(); $sql = session($con,$session); if(db_rows($con,$sql)>0){ /* fetch userid and create session token */ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $userid = $row['userid']; } $offer_cost = offer_cost(); /* check if offer is legible for activation */ $sql = "select * from offers where userid=".intval($userid)." and status=3 and token='".escape($con,$token)."'"; if(db_rows($con,$sql)>0){ /* check if user has enough cash in his wallet */ if(wallet_balance($con,$userid)<$offer_cost){ $message = "You don't have enough funds in your wallet to activate offer. Please upload more funds."; }else{ /* Activate offer */ $sql = "update offers set live=CURDATE(), status=1 where userid=".intval($userid)." and status=3 and token='".escape($con,$token)."'"; if(mysqli_query($con,$sql)){ $success = 1; /* Take the cash from the wallet */ $trans_id = gen_transId($con); $trans_type = 2; $amount = (-1)*$offer_cost; $gate_way = ""; $gate_way_detail = ""; $sql = transaction($con,$userid,$trans_type,$gate_way,$gate_way_detail,$trans_id,$amount); mysqli_query($con,$sql); $message = "Offer is successfully activated and is now live."; }else{ $message = "Server error. Please try again later."; } } }else{ $message = "You can't activate this offer."; } } $response['success'] = $success; $response['message'] = $mcrypt->encrypt($message); echo json_encode($response); db_close($con); } ?>