MOON
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 PHP/5.4.10
System: Linux vps.presagepowered.net 2.6.18-398.el5 #1 SMP Tue Sep 16 20:51:48 EDT 2014 i686
User: mckernan (512)
PHP: 5.4.10
Disabled: NONE
Upload Files
File: /home/mckernan/public_html/iJournal/includes/client/inccats.php
<?php

// income categories
	// init database name
	$database = DB_PREFIX;	
	
		
	// process request
	if ($sid != '')
	{
		// sid check
		require "includes/session/sidck.php";
		
		
		// init return value
		$rv = '<root>' . PHP_EOL;
		$rv .= '<cats>' . PHP_EOL;
	
	
		// fetch database name / open db
		$db = '';
		if ( isset($_POST['db']) ) $db = $_POST['db'];
		if ( isset($_GET['db']) ) $db = $_GET['db'];
		
		if ($db == '') die();
		
		$database .= $db;
		
		require "includes/db.php";
		
		
		// fetch client info
		$query = "SELECT in_gross, in_hascogs, in_cogs, in_0, in_1, in_2, in_3 FROM categories";
		
		if ($result = $db->query($query))
		{
			if ($db->affected_rows == 1)
			{
				$row = $result->fetch_assoc();
			
				$rv .= '<gross>' . $row['in_gross'] . '</gross>' . PHP_EOL;
				$rv .= '<hascogs>' . $row['in_hascogs'] . '</hascogs>' . PHP_EOL;
				$rv .= '<cogs>' . $row['in_cogs'] . '</cogs>' . PHP_EOL;
				$rv .= '<other0>' . $row['in_0'] . '</other0>' . PHP_EOL;
				$rv .= '<other1>' . $row['in_1'] . '</other1>' . PHP_EOL;
				$rv .= '<other2>' . $row['in_2'] . '</other2>' . PHP_EOL;
				$rv .= '<other3>' . $row['in_3'] . '</other3>' . PHP_EOL;
			}
			else
			{
				$rv .= '<gross></gross>' . PHP_EOL;
				$rv .= '<hascogs>0</hascogs>' . PHP_EOL;
				$rv .= '<cogs></cogs>' . PHP_EOL;
				$rv .= '<other0></other0>' . PHP_EOL;
				$rv .= '<other1></other1>' . PHP_EOL;
				$rv .= '<other2></other2>' . PHP_EOL;
				$rv .= '<other3></other3>' . PHP_EOL;
			}
		}
		else
		{
			$rv .= '<gross></gross>' . PHP_EOL;
			$rv .= '<hascogs>0</hascogs>' . PHP_EOL;
			$rv .= '<cogs></cogs>' . PHP_EOL;
			$rv .= '<other0></other0>' . PHP_EOL;
			$rv .= '<other1></other1>' . PHP_EOL;
			$rv .= '<other2></other2>' . PHP_EOL;
			$rv .= '<other3></other3>' . PHP_EOL;
		}
		
		
		// finish output
		$rv .= '</cats>' . PHP_EOL;
		$rv .= '</root>' . PHP_EOL;
				
		
		// return data
		echo $rv;
		
		die;
	}
	else
	{
		header('Server: ');
		header('X-Powered-By: ');
		header("HTTP/1.0 404 Not Found");
	}

?>