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 token='".escape($con,$token)."'"; if(db_rows($con,$sql)>0){ /* Fetch the offer */ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $status = $row['status']; $image = $row['image']; } /* if status is 0, delete and refund the money */ if($status==0){ /* delete */ $sql = "delete from offers where userid=".intval($userid)." and token='".escape($con,$token)."'"; mysqli_query($con,$sql); /* Delete the image */ unlink("../closeapp/offers/".$image); $trans_id = gen_transId($con); $trans_type = 3; $amount = $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); $success = 1; $message = "Offer is successfully deleted and money refunded."; }else{ /* Just Delete */ $sql = "delete from offers where userid=".intval($userid)." and token='".escape($con,$token)."'"; mysqli_query($con,$sql); /* Delete the image */ unlink("../closeapp/offers/".$image); $success = 1; $message = "Offer is successfully deleted."; } } } $response['success'] = $success; $response['message'] = $mcrypt->encrypt($message); echo json_encode($response); db_close($con); } ?>