403Webshell
Server IP : 64.202.187.69  /  Your IP : 216.73.217.74
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/transmarket/translator/controllers/skip_voting_sentences_marketplaces.php
<?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';

$data = array();
$data['status'] = 300;
$offset = 0;
$user_id = $_SESSION['tm_id'];
if(isset($_POST['sentence_id']) && $_POST['sentence_id'] > 0) {
	$sqlInsert = 'INSERT INTO `tbl_skipped_voting_sentences_marketing` (`user_id`, `sentence_id`, `paragraph_id`, `user_ids`, `status`, `created_at`) VALUES '
			. '("' . $_SESSION['tm_id'] . '","' . $_POST['sentence_id'] . '",' . $_POST['paragraph_id'] . ',"' . $_POST['user_ids'] . '",1, "' . date('Y-m-d H:i:s') . '")';				
	$resultInsert = $mysqli->query($sqlInsert);
	
	$user_idT = $_POST['sentence_id'] .",";
	
	// Increment users total votes
	$sqlUpdateUS = 'UPDATE `tbl_translators` SET skip_voting_sentences_marketing = concat(ifnull(skip_voting_sentences_marketing,""), "' . $user_idT . '") where id = ' . $user_id;
	$resultUpdateUS = $mysqli->query($sqlUpdateUS);
	
	$sql = 'SELECT id FROM tbl_skipped_voting_sentences_marketing WHERE sentence_id = "'.$_POST['sentence_id'].'" AND status = 1';
	$result = $mysqli->query($sql);
	
	if($result->num_rows == 3) {		
		// user can again vote for the sentence, so make status to 0
		$sqlUpdateS = 'UPDATE tbl_skipped_voting_sentences_marketing SET status = 0 WHERE sentence_id = "' . $_POST['sentence_id'] . '"';
		$resultUpdateS = $mysqli->query($sqlUpdateS);		
		
		$sqlInsert1 = 'INSERT INTO `tbl_skipped_sentences_marketing` (`sentence_id`, `created_at`) VALUES '
			. '("' . $_POST['sentence_id'] . '", "' . date('Y-m-d H:i:s') . '")';				
		$resultInsert1 = $mysqli->query($sqlInsert1);
	
		// insert sentence suggestions into clone table for history
		$sqlDuplicateSuggestion = 'INSERT INTO tbl_user_suggestion_marketing_mapping_skipped
		SELECT * FROM tbl_user_suggestion_marketing_mapping
		WHERE sentence_id = "' . $_POST['sentence_id'] . '"';
		$resultDuplicateSuggestion = $mysqli->query($sqlDuplicateSuggestion);
		
		// insert suggestion voting into clone table for history
		$sqlDuplicateVote = 'INSERT INTO tbl_user_votes_marketing_tmn_skipped
		SELECT * FROM tbl_user_votes_marketing_tmn
		WHERE suggestion_id IN (SELECT id FROM `tbl_user_suggestion_marketing_mapping` WHERE sentence_id = "' . $_POST['sentence_id'] . '")';
		$resultDuplicateVote = $mysqli->query($sqlDuplicateVote);
		
		// get the sequence
		$sql1 = 'SELECT id FROM tbl_skipped_sentences_marketing WHERE sentence_id = "'.$_POST['sentence_id'].'"';
		$result1 = $mysqli->query($sql1);
		$sequence = $result1->num_rows;
		
		// update sentence sequence
		$sqlUpdateS = 'UPDATE tbl_user_suggestion_marketing_mapping_skipped SET sequence = "'.$sequence.'" WHERE id IN (SELECT id FROM `tbl_user_suggestion_marketing_mapping` WHERE sentence_id = "' . $_POST['sentence_id'] . '")';
		$resultUpdateS = $mysqli->query($sqlUpdateS);
				
		// update users votes count 
		$sqlUpdateS1 = 'UPDATE tbl_translators SET total_votes_marketing = total_votes_marketing - 1 WHERE id IN (SELECT t.user_id FROM `tbl_user_votes_marketing_tmn` t INNER JOIN tbl_user_suggestion_marketing_mapping m ON m.id = t.suggestion_id WHERE m.sentence_id = "' . $_POST['sentence_id'] . '")';
		$resultUpdateS1 = $mysqli->query($sqlUpdateS1);
		
		// update users suggestions count 
		$sqlUpdateS2 = 'UPDATE tbl_translators SET total_suggestions_marketing = total_suggestions_marketing - 1 WHERE id IN (SELECT user_id FROM tbl_user_suggestion_marketing_mapping WHERE sentence_id = "' . $_POST['sentence_id'] . '")';
		$resultUpdateS2 = $mysqli->query($sqlUpdateS2);
		
		// delete sentence suggestions
		$sqlDeleteS = 'DELETE FROM tbl_user_suggestion_marketing_mapping WHERE sentence_id = "'.$_POST['sentence_id'].'" AND user_id != 0';
		$resultDeleteS = $mysqli->query($sqlDeleteS);
		
		// delete suggestions voting
		$sqlDeleteS = 'DELETE FROM tbl_user_votes_marketing_tmn WHERE suggestion_id IN (SELECT id FROM `tbl_user_suggestion_marketing_mapping` WHERE sentence_id = "' . $_POST['sentence_id'] . '")';
		$resultDeleteS = $mysqli->query($sqlDeleteS);
		
		// update sentence 
		$sqlUpdateS = 'UPDATE tbl_sentence_marketing SET suggestion_count = 1, is_open_for_voting = 1 WHERE id = "' . $_POST['sentence_id'] . '"';
		$resultUpdateS = $mysqli->query($sqlUpdateS);
		
		// update machine suggestion voting
		$sqlUpdateM = 'UPDATE tbl_sentence_marketing SET credits = 0, voted_user_id = "", is_winning = 0, winning_credits = 0 WHERE sentence_id = "' . $_POST['sentence_id'] . '" AND user_id = 0';
		$resultUpdateM = $mysqli->query($sqlUpdateM);
	}
	if(isset($_POST['total']) && $_POST['total'] == 0) {
		// UnLock the paragraph for other users if all sentences skipped
		$sqlUpdateS = 'UPDATE `tbl_paragraphs` SET is_lock = 0, locked_user_id = 0, locked_at = "" where id = "' . $_POST['paragraph_id'].'"';
		$resultUpdateS = $mysqli->query($sqlUpdateS);
	}
	$data['status'] = 200;
	
}
echo json_encode($data);  // send data as json format
?>

Youez - 2016 - github.com/yon3zu
LinuXploit