| Server IP : 64.202.187.69 / Your IP : 216.73.216.192 Web Server : Apache System : Linux 69.187.202.64.host.secureserver.net 3.10.0-1160.144.1.el7.tuxcare.els6.x86_64 #1 SMP Fri May 29 16:22:24 UTC 2026 x86_64 User : transmarket ( 1001) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/transmarket/translator/controllers/ |
Upload File : |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include 'connection.php';
error_reporting(E_ALL);
ini_set('display_errors', 1);
$data['status'] = 300;
$data['msg'] = 'Error while claiming. Try again.';
require_once('functions.claims.php');
$claims_obj = new Claims();
//get Minimum TMN require to Claim value
$min_tmn_require_to_claim = $claims_obj->getMinimumTmnRequireToClaim();
//get Maximum TMN can Claim value
$max_tmn_can_claim = $claims_obj->getMaximumTmnCanClaim();
if( isset($_SESSION['tm_id']) && isset($_POST['claim']) && isset($_POST['requested_tmn']) ) {
$id = $_SESSION['tm_id'];
//$sqlT = 'SELECT * FROM `tbl_translators` WHERE id= ' . $id;
//$resultT = $mysqli->query($sqlT);
$sqlT = "SELECT tmn_balance as tmn_credits FROM translator_tmn_transactions WHERE user_id = " . $id . " ORDER BY id DESC LIMIT 1";
$resultT = $mysqli->query( $sqlT );
$requested_tmn = $_POST['requested_tmn'];
while ($row = $resultT->fetch_object()) {
if( $requested_tmn > 0 && $requested_tmn !='' ) {
if( $requested_tmn >= $min_tmn_require_to_claim && $requested_tmn <= $max_tmn_can_claim ) {
if( $requested_tmn <= $row->tmn_credits ) {
$sqlClaim = 'select id from translator_claimed_credits where user_id = ' . $id.' and status = 0';
$resultClaim = $mysqli->query($sqlClaim);
if( $resultClaim->num_rows == 0 ) {
//$claim_amount = (int) $row->tmn_credits * 0.003;
$claim_amount = (int) $requested_tmn * 0.003;
//$sql1 = 'INSERT INTO `translator_claimed_credits`(`user_id`, `claimed_credits`, `claim_amount`, `status`, `created_at`) VALUES
//(' .$id . ','.$row->tmn_credits.','.$claim_amount.',0,"'.date('Y-m-d H:i:s').'")';
$sql1 = 'INSERT INTO `translator_claimed_credits`(`user_id`, `claimed_credits`, `claim_amount`, `status`, `created_at`) VALUES
(' .$id . ','.$requested_tmn.','.$claim_amount.',0, NOW() )';
$result = $mysqli->query($sql1);
$_SESSION['tm_is_claim_pending'] = 1;
$data['status'] = 200;
$data['msg'] = 'Your TMN has been claimed successfully.';
} else {
$data['msg'] = 'Please wait for your previous claim to clear out.';
}
} else {
$data['msg'] = 'You do not have sufficient TMN to claim.';
}
} else {
$data['msg'] = 'Requested tmn should be more than ' . $min_tmn_require_to_claim . ' and less than ' . $max_tmn_can_claim;
}
} else {
$data['msg'] = 'Please fill redeem tmn';
}
}
}
echo json_encode($data);