Uname:Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 13.126.101.145  /  Your IP : 216.73.216.63
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/rentals_updated/wp-content/plugins/operators/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rentals_updated/wp-content/plugins/operators/admin-uploaddocs.php
<?php
// Ensure the file is not accessed directly
if (!defined('ABSPATH')) {
    exit;
}

// Add admin menu
add_action('admin_menu', 'ticket_admin_menu');
function ticket_admin_menu() {
    add_menu_page(
        'Upload Documents',    // Page title
        'Upload Documents',    // Menu title
        'manage_options',    // Capability
        'uploaddocs-dashboard',     // Menu slug
        'uploaddocs_list',// Callback function
        'dashicons-tickets', // Icon URL
        6                    // Position
    );
	// Add a submenu page
    add_submenu_page(
        'uploaddocs-dashboard', // The slug name for the parent menu
        'Upload New Documents', // The text to be displayed in the title tags of the page when the submenu is selected
        'Upload New Documents', // The text to be used for the submenu
        'manage_options', // The capability required for this menu to be displayed to the user
        'create_newdocs', // The slug name to refer to this submenu
        'create_newdocs' // The function to be called to output the content for this page
    );
	/* add_submenu_page(null, //parent slug
	'Delete Operator', //page title
	'Delete', //menu title
	'manage_options', //capability
	'delete-operator', //menu slug
	'delete_operator'); //function */
}

function uploadnewdocs_enqueue_custom_styles_and_scripts($hook) {
	
    // Load only on the logsheet dashboard page
if ($hook !== 'toplevel_page_uploaddocs-dashboard') {
        return;
    }

    // Enqueue Bootstrap CSS
    wp_enqueue_style('bootstrap-css', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css');

    // Enqueue DataTables CSS
    wp_enqueue_style('datatables-css', 'https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css');
	
	// Enqueue Font Awesome CSS
    wp_enqueue_style('fontawesome-css', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css');	

    // Enqueue your custom CSS
    wp_enqueue_style('rfq-custom-styles', plugin_dir_url(__FILE__) . 'css/custom-style.css');

    // Enqueue jQuery and DataTables JS
    wp_enqueue_script('jquery');
    wp_enqueue_script('datatables-js', 'https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js', array('jquery'), '1.10.24', true);
	

    // Enqueue Bootstrap JS and your custom JS
    wp_enqueue_script('bootstrap-js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js', array('jquery'), '4.5.2', true);
    wp_enqueue_script('rfq-custom-scripts', plugin_dir_url(__FILE__) . 'js/custom-script.js', array('jquery'), '1.0', true);
	
	
}

add_action('admin_enqueue_scripts', 'uploadnewdocs_enqueue_custom_styles_and_scripts');

// Display the data
function ticket_list() {
	global $wpdb;
	$user = wp_get_current_user();
	if ( in_array( 'operator', (array) $user->roles ) ) {
		$table_name = $wpdb->prefix . 'raise_tickets';
		$user_id = $user->ID;
		$results = $wpdb->get_results("SELECT * FROM $table_name where operator_id=$user_id order by id desc");
	}else if(in_array( 'administrator', (array) $user->roles )){
		$table_name = $wpdb->prefix . 'raise_tickets';
		$user_id = $user->ID;
		$results = $wpdb->get_results("SELECT * FROM $table_name order by id desc");
	}
    ?>
    <div class="wrap rfq-wrap">
        <h1 class="wp-heading-inline mb-2 font-weight-bold">Tickets</h1>
        <table id="ticket-table" class="table table-striped table-bordered">
            <thead class="thead-dark">
                <tr>
                    <th scope="row" class="manage-column">Sr. No</th>
                    <th scope="col" class="manage-column">Operator Name</th>
					<th scope="col" class="manage-column">Equipment Name</th>
					<th scope="col" class="manage-column">Problem Type</th>
					<th scope="col" class="manage-column">Problem Description</th>
					<th scope="col" class="manage-column">Additional Notes</th> 
                    <th scope="col" class="manage-column">Status</th>
					<th scope="col" class="manage-column">Created On</th>
                    <th scope="col" class="manage-column">Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php
					$i = 1;
					foreach($results as $result){
						$user_info = get_userdata($result->operator_id);
						$user_name = $user_info->user_nicename;
						?>
						<tr>
							<td><?php echo $i;?></td>
							<td><?php echo $user_name;?></td>
							<td>
							<?php 
							$product = wc_get_product( $result->equipment_id );
							echo $product->get_title();
							?>
							</td>
							<td><?php echo ($result->problem_type == 1) ? 'Breakdown' : 'New Request'; ?></td>
							<td><?php echo $result->problem_description;?></td>
							<td><?php echo $result->additional_notes;?></td>
							<td><?php echo $result->status;?></td>
							<td><?php echo $result->created_on;?></td>
							<td><a href="javascript:void(0);" data-toggle="modal" data-target="#ticketsModal<?php echo $result->id;?>">View</a></td>
						</tr>
						<div class="modal fade" id="ticketsModal<?php echo $result->id;?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
							<div class="modal-dialog modal-lg">
								<div class="modal-content">
									<div class="modal-header">
										<h5 class="modal-title" 
											id="exampleModalLabel">
											Tickets Details
										</h5>
										
										<button type="button" 
											class="close" 
											data-dismiss="modal" 
											aria-label="Close">
											<span aria-hidden="true">
												&times;
											</span>
										</button>
									</div>

									<div class="modal-body">

										<!-- Data passed is displayed 
											in this part of the 
											modal body -->
										<h6 id="modal_body">Tickets Details</h6>
										<div class="row">
											<div class="col-md-6">
												<div class="col-md-6">
													<label>Ticket Raised Name</label>
												</div>
												<div class="col-md-6">
													<p><?php echo $user_name;?></p>
												</div>
											</div>
											<div class="col-md-6">
												<div class="col-md-6">
													<label>Equipment Name</label>
												</div>
												<div class="col-md-6">
													<p><?php echo $product->get_title();?></p>
												</div>
											</div>
											<div class="col-md-6">
												<div class="col-md-6">
													<label>Problem Description</label>
												</div>
												<div class="col-md-6">
													<p><?php echo $result->problem_description;?></p>
												</div>
											</div>
											<div class="col-md-6">
												<div class="col-md-6">
													<label>Additional Notes</label>
												</div>
												<div class="col-md-6">
													<p><?php echo $result->additional_notes;?></p>
												</div>
											</div>
											<div class="col-md-6">
												<div class="col-md-6">
													<label>Attachment</label>
												</div>
												<div class="col-md-6">
													<p><a href="<?php echo $result->attachment;?>" download>Download Attachment</a></p>
												</div>
											</div>
											<div class="col-md-6">
												<div class="col-md-6">
													<label>Request Raised On</label>
												</div>
												<div class="col-md-6">
													<p><?php echo $result->created_on;?></p>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>		
						</div>
						<?php
						
						$i++;
					}
				?>
            </tbody>
        </table>
    </div>
    <script>
        // Initialize DataTable
        jQuery(document).ready(function($) {
            $('#ticket-table').DataTable();
        });
		/* function updateStatus(id){
			alert(id);
		} */
    </script>
    <?php
} 
function create_ticket(){
	global $wpdb;
	if(isset($_POST['createticket'])!=''){
		$table_name = $wpdb->prefix . "raise_tickets";
		$user_id = get_current_user_id();
		$productId = $_POST['equipment_id'];
		
		$problem_type = $_POST['problem_type'];
		$problem_description = $_POST['problem_description'];
		if($problem_type == 1){
			$productId = $_POST['equipment_idhid'];
		}else{
			$productId = $_POST['equipment_id'];
		}
		
		if (isset($_FILES['attachment']) && $_FILES['attachment']['size'] > 0) {
			// Handle file upload
			$upload_attachment = wp_handle_upload($_FILES['attachment'], array('test_form' => false));
			if (isset($upload_attachment['url']) && !isset($upload_attachment['error'])) {
				$attachmenturl = $upload_attachment['url'];
			}else{
				$attachmenturl = '';
			}				
		}
		$additional_notes = $_POST['additional_notes'];
		$result_check = $wpdb->insert($table_name, [
			"operator_id" => $user_id,
			"problem_type" => $problem_type,
			"problem_description" => $problem_description,
			"equipment_id" => $productId,
			"attachment" => $attachmenturl,
			//"priority_level" => $priority_level,
			"additional_notes" => $additional_notes,
			"created_on" => date('Y-m-d H:i:s'),
		]);
		if($result_check){
		   //successfully inserted.
		   echo "<p>Ticket Raised Successfully</p>";
		}else{
		  //something gone wrong
		  echo "<p>Error Occurs</p>";
		}
		
	}
	?>
	
<div class="wrap">
	<form method="post" name="createoperator" id="createuser" class="form" enctype="multipart/form-data">
		<div class="row">
			<div class="column">
			<h3>Create Ticket</h3>
			<table class="form-table" role="presentation">
				<tbody>
					
					<tr class="">
						<th scope="row"><label for="log_date">Select Problem Type<span class="description">(required)</span></label></th>
						<td>
							<label>
								<input type="radio" name="problem_type" class="form-control" value="1">Breakdown
							</label>
							<label>
								<input type="radio" name="problem_type" class="form-control" value="2">New Request
							</label>
						</td>
					</tr>
					<tr class="form-field new_equipment" style="display:none">
						<th scope="row"><label for="log_date">Select Equipment<span class="description"></label></th>
						<td><select name="equipment_id" id="equipment_id" class="regular-text" required>
								<option value="">Select Equipment</option>
								<?php
								$pargs = array(
									'post_type'=> 'product',
									'orderby'    => 'post_title',
									'post_status' => 'publish',
									'order'    => 'ASC',
									'posts_per_page' =>-1 // this will retrive all the post that is published 
								);
								$products = new WP_Query( $pargs );
								foreach($products->posts as $product){
								?>
								<option value="<?php echo $product->ID;?>"><?php echo $product->post_title;?></option>
								<?php
								}
								?>
							</select></td>
					</tr>
					<tr class="form-field equipment_brk" style="display:none">
						<th scope="row"><label for="log_date">Equipment<span class="description"></label></th>
						<td>
						<?php
						
						$user_id = get_current_user_id();
						$machineassoc = get_user_meta($user_id, 'machine_associated', true);
						$product = wc_get_product( $machineassoc );						
						?>
						<input type="text" name="equipment_name" id="equipment_name"class="regular-text" value="<?php echo $product->get_title();?>" readonly>
						<input type="hidden" name="equipment_idhid" id="equipment_idhid"class="regular-text" value="<?php echo $machineassoc;?>" readonly>
						</td>
					</tr>
					<tr class="form-field form-required">
						<th scope="row"><label for="email">Problem Description <span class="description">(required)</span></label></th>
						<td><textarea name="problem_description" id="problem_description" class="regular-text" required></textarea></td>
					</tr>
					<tr class="form-field">
						<th scope="row"><label for="first_name">Upload Images/Documents </label></th>
						<td>
							<input type="file" name="attachment[]" id="attachment" class="regular-text" required multiple>
							<p>Upload Multiple Images/Documents</p>
						</td>
					</tr>
					<tr class="form-field form-required">
						<th scope="row"><label for="email">Additional Notes</label></th>
						<td><textarea name="additional_notes" id="additional_notes" class="regular-text"></textarea></td>
					</tr>
				</tbody>
			</table>
			</div>
			
			
		</div>
		<p class="submit"><input type="submit" name="createticket" id="createticket" class="button button-primary" value="Add Ticket"></p>
	</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$("input[name$='problem_type']").click(function() {
		var type = $(this).val();
		if(type == 1){
			$('.equipment_brk').show();
			$('.new_equipment').hide();
		}else if(type == 2){
			$('.equipment_brk').hide();
			$('.new_equipment').show();
		}
	});
});
</script>
	<?php
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit