403Webshell
Server IP : 10.200.247.200  /  Your IP : 216.73.217.19
Web Server : Apache
System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64
User : jeremy ( 1001)
PHP Version : 8.4.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/usa_sites/governmentgrants.us/vx/usa/organizer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/governmentgrants.us/vx/usa/organizer/index.php
<?php
	session_start();
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/ua.php');
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/func.php');
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx_/site_info.php');
	include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mysql.php');
	track_member_action('Page Visit','Application Organizer');
	$user = $_SESSION['user'];
	ob_start();
	if(empty($_SESSION['subscriptions']['2'])) {
		$page_title = 'Application Organizer';
		$page_title_html = '
						<div class="rib fas fa-cabinet-filing va-middle v14_title_image" style="padding-bottom:40px;color:#0844a4;"></div>
						<div style="padding-top:6px;text-align:left;">
							<h2>Application Organizer is for VIP Members!</h2>
							<p style="text-align:left;font-size:12px;">Organize the applications you are applying for by updating the status for each application.</p>
						</div>
						<div style="clear:both;"></div>';
		$redir_location = '/vx/usa/organizer/';
		include_once($_SERVER['DOCUMENT_ROOT'].'/vx/usa/subscribe/v14.php');
	}
	if(empty($_GET['cat'])) {
		$_GET['cat'] = 'favorites';
	}
	
	$not_ignored_where = " AND gg.grants_id NOT IN (SELECT grants_id FROM grdb.grd_usa_ignored_grants WHERE site_code='".$db->clean($siteCode)."' AND client_id='".$db->clean($user)."')";
	
	$res = $db->get_results("SELECT COUNT(*) as c
							FROM grdb.grd_usa_saved_grants sg
							LEFT JOIN grdb.grd_grants gg ON gg.grants_id=sg.grants_id
							WHERE sg.site_code='".$db->clean($siteCode)."'
							AND sg.client_id='".$db->clean($user)."'
							AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
							AND gg.bad_url=0
							{$not_ignored_where}");
	$favorites_count = (empty($res)) ? 0 : $res[0]->c;
	
	$res = $db->get_results("SELECT COUNT(*) as c
							FROM grdb.grd_usa_filling_grants sg
							LEFT JOIN grdb.grd_grants gg ON gg.grants_id=sg.grants_id
							WHERE sg.site_code='".$db->clean($siteCode)."'
							AND sg.client_id='".$db->clean($user)."'
							AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
							AND gg.bad_url=0
							{$not_ignored_where}");
	$filled_count = (empty($res)) ? 0 : $res[0]->c;
	
	$res = $db->get_results("SELECT COUNT(*) as c
							FROM grdb.grd_usa_submitted_grants sg
							LEFT JOIN grdb.grd_grants gg ON gg.grants_id=sg.grants_id
							WHERE sg.site_code='".$db->clean($siteCode)."'
							AND sg.client_id='".$db->clean($user)."'
							AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
							AND gg.bad_url=0
							{$not_ignored_where}");
	$submitted_count = (empty($res)) ? 0 : $res[0]->c;
	
	$res = $db->get_results("SELECT COUNT(*) as c
							FROM grdb.grd_usa_denied_grants sg
							LEFT JOIN grdb.grd_grants gg ON gg.grants_id=sg.grants_id
							WHERE sg.site_code='".$db->clean($siteCode)."'
							AND sg.client_id='".$db->clean($user)."'
							AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
							AND gg.bad_url=0
							{$not_ignored_where}");
	$denied_count = (empty($res)) ? 0 : $res[0]->c;
	
	$res = $db->get_results("SELECT COUNT(*) as c
							FROM grdb.grd_usa_approved_grants sg
							LEFT JOIN grdb.grd_grants gg ON gg.grants_id=sg.grants_id
							WHERE sg.site_code='".$db->clean($siteCode)."'
							AND sg.client_id='".$db->clean($user)."'
							AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
							AND gg.bad_url=0
							{$not_ignored_where}");
	$approved_count = (empty($res)) ? 0 : $res[0]->c;
?>
<div class="rb p20 top">
	<div style="max-width:500px;margin:0px auto;">
		<h2><span class="fas fa-cabinet-filing" style="color:#0844a4;"></span> Application Organizer</h2>
		<hr />
		<p>Organize the applications you are applying for by updating the status for each application.</p>
		<div class="row" style="margin:10px 0px;">
			<div class="col-xs-3">
				<div style="padding:0px 8px;">
					<div style="width:100%;height:60px;border:1px solid red;padding:10px;cursor:pointer;text-align:center;<?= ($_GET['cat']=='favorites') ? 'background:red;color:white;' : 'background:white;color:red;';?>" onclick="window.location = '/vx/usa/organizer/?cat=favorites'; return false;">
						<div><i class="fas fa-heart" style="font-size:30px;"></i></div>
						<div style="font-size:10px;">Favorites</div>
					</div>
					<div id="favorited_number" style="width:100%;background:red;color:white;text-align:center;font-size:14px;<?= ($_GET['cat']=='favorites') ? 'border-top:1px solid white;' : 'border-top:1px solid red;';?>"><?= $favorites_count;?></div>
				</div>
			</div>
			<div class="col-xs-9">When you "Favorite" a grant, we'll add it to the Organizer.</div>
		</div>
		<hr />
		<p>To move an application to one of the different stages, select stage button. Select a Stage to view the applications. You can also click Favorites above to view all your favorites:</p>
		<div class="row" style="margin:10px 0px;">
			<div class="col-xs-3">
				<div style="padding:0px 8px;">
					<div style="width:100%;height:60px;border:1px solid #5125ad;padding:10px;cursor:pointer;text-align:center;<?= ($_GET['cat']=='filled') ? 'background:#5125ad;color:white;' : 'background:white;color:#5125ad;';?>" onclick="window.location = '/vx/usa/organizer/?cat=filled'; return false;">
						<div><i class="fas fa-file-invoice-dollar" style="font-size:30px;"></i></div>
						<div style="font-size:10px;">Filling Out</div>
					</div>
					<div id="filling_number" style="width:100%;background:#5125ad;color:white;text-align:center;font-size:14px;<?= ($_GET['cat']=='filled') ? 'border-top:1px solid white;' : 'border-top:1px solid #5125ad;';?>"><?= $filled_count;?></div>
				</div>
			</div>
			<div class="col-xs-3">
				<div style="padding:0px 8px;">
					<div style="width:100%;height:60px;border:1px solid #d39c2f;padding:10px;cursor:pointer;text-align:center;<?= ($_GET['cat']=='submitted') ? 'background:#d39c2f;color:white;' : 'background:white;color:#d39c2f;';?>" onclick="window.location = '/vx/usa/organizer/?cat=submitted'; return false;">
						<div><i class="fas fa-paper-plane" style="font-size:30px;"></i></div>
						<div style="font-size:10px;">Submitted</div>
					</div>
					<div id="submitted_number" style="width:100%;background:#d39c2f;color:white;text-align:center;font-size:14px;<?= ($_GET['cat']=='submitted') ? 'border-top:1px solid white;' : 'border-top:1px solid #d39c2f;';?>"><?= $submitted_count;?></div>
				</div>
			</div>
			<div class="col-xs-3">
				<div style="padding:0px 8px;">
					<div style="width:100%;height:60px;border:1px solid #606060;padding:10px;cursor:pointer;text-align:center;<?= ($_GET['cat']=='denied') ? 'background:#606060;color:white;' : 'background:white;color:#606060;';?>" onclick="window.location = '/vx/usa/organizer/?cat=denied'; return false;">
						<div><i class="fas fa-thumbs-down" style="font-size:30px;"></i></div>
						<div style="font-size:10px;">Denied</div>
					</div>
					<div id="denied_number" style="width:100%;background:#606060;text-align:center;color:white;font-size:14px;<?= ($_GET['cat']=='denied') ? 'border-top:1px solid white;' : 'border-top:1px solid #606060;';?>"><?= $denied_count;?></div>
				</div>
			</div>
			<div class="col-xs-3">
				<div style="padding:0px 8px;">
					<div style="width:100%;height:60px;border:1px solid #629b44;padding:10px;cursor:pointer;text-align:center;<?= ($_GET['cat']=='approved') ? 'background:#629b44;color:white;' : 'background:white;color:#629b44;';?>" onclick="window.location = '/vx/usa/organizer/?cat=approved'; return false;">
						<div><i class="fas fa-thumbs-up" style="font-size:30px;"></i></div>
						<div style="font-size:10px;">Approved</div>
					</div>
					<div id="approved_number" style="width:100%;background:#629b44;color:white;text-align:center;font-size:14px;<?= ($_GET['cat']=='approved') ? 'border-top:1px solid white;' : 'border-top:1px solid #629b44;';?>"><?= $approved_count;?></div>
				</div>
			</div>
		</div>
		<hr />
	</div>
	<?php
	$total_count = 0;
	$page = 1;
	$per_page = 20;
	if(!empty($_REQUEST['page'])) {
		$page = $_REQUEST['page'];
	}
	$order_by = 'ORDER BY ts_added DESC';
	switch($_GET['cat']) {
		case 'favorites':
			?>
			<div style="color:red;">
				<i class="fas fa-heart" style="float:left;font-size:50px;vertical-align:middle;padding-right:10px;"></i>
				<div style="font-size:18px;">Favorites</div>
				<div style="font-size:12px;"><i>Here are the applications you have marked as Favorites</i></div>
				<div style="clear:both;"></div>
			</div>
			<?php
			$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grd_usa_saved_grants sg
									LEFT JOIN grdb.grd_grants AS gg ON sg.grants_id=gg.grants_id
									WHERE sg.site_code='".$db->clean($siteCode)."'
									AND sg.client_id='".$db->clean($user)."'
									AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									AND gg.bad_url=0
									{$not_ignored_where}");
			$total_count = $res[0]->c;
			$max_page = ceil($total_count/$per_page);
			if($page<1) {
				$page = 1;
			}
			if($page>$max_page) {
				$page = $max_page;
			}
			$limit = '';
			if($total_count >= $per_page) {
				$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
			}
			$grant_list = $db->get_results("SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_saved_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline='0000-00-00'
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											
											UNION SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_saved_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline >= CURDATE()
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											{$order_by}
											{$limit}
										");
			break;
		case 'viewed':
			?>
			<div style="color:#0792db;">
				<i class="fas fa-globe" style="float:left;font-size:50px;vertical-align:middle;padding-right:10px;"></i>
				<div style="font-size:18px;">Go to Site</div>
				<div style="font-size:12px;"><i>Here are the applications you have visited their website.</i></div>
				<div style="clear:both;"></div>
			</div>
			<?php
			$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grd_usa_viewed_grants sg
									LEFT JOIN grdb.grd_grants AS gg ON sg.grants_id=gg.grants_id
									WHERE sg.site_code='".$db->clean($siteCode)."'
									AND sg.client_id='".$db->clean($user)."'
									AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									AND gg.bad_url=0
									{$not_ignored_where}");
			$total_count = $res[0]->c;
			$max_page = ceil($total_count/$per_page);
			if($page<1) {
				$page = 1;
			}
			if($page>$max_page) {
				$page = $max_page;
			}
			$limit = '';
			if($total_count >= $per_page) {
				$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
			}
			$grant_list = $db->get_results("SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_viewed_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline='0000-00-00'
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											
											UNION SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_viewed_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline >= CURDATE()
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											{$order_by}
											{$limit}
										");
			break;
		case 'filled':
			?>
			<div style="color:#5125ad;">
				<i class="fas fa-file-invoice-dollar" style="float:left;font-size:50px;vertical-align:middle;padding-right:10px;"></i>
				<div style="font-size:18px;">Filling Out</div>
				<div style="font-size:12px;"><i>Here are the applications you marked as filling out.</i></div>
				<div style="clear:both;"></div>
			</div>
			<?php
			$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grd_usa_filling_grants sg
									LEFT JOIN grdb.grd_grants AS gg ON sg.grants_id=gg.grants_id
									WHERE sg.site_code='".$db->clean($siteCode)."'
									AND sg.client_id='".$db->clean($user)."'
									AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									AND gg.bad_url=0
									{$not_ignored_where}");
			$total_count = $res[0]->c;
			$max_page = ceil($total_count/$per_page);
			if($page<1) {
				$page = 1;
			}
			if($page>$max_page) {
				$page = $max_page;
			}
			$limit = '';
			if($total_count >= $per_page) {
				$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
			}
			$grant_list = $db->get_results("SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_filling_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline='0000-00-00'
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											
											UNION SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_filling_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline >= CURDATE()
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											{$order_by}
											{$limit}
										");
			break;
		case 'submitted':
			?>
			<div style="color:#d39c2f;">
				<i class="fas fa-paper-plane" style="float:left;font-size:50px;vertical-align:middle;padding-right:10px;"></i>
				<div style="font-size:18px;">Submitted</div>
				<div style="font-size:12px;"><i>Here are the applications you marked as submitted.</i></div>
				<div style="clear:both;"></div>
			</div>
			<?php
			$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grd_usa_submitted_grants sg
									LEFT JOIN grdb.grd_grants AS gg ON sg.grants_id=gg.grants_id
									WHERE sg.site_code='".$db->clean($siteCode)."'
									AND sg.client_id='".$db->clean($user)."'
									AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									AND gg.bad_url=0
									{$not_ignored_where}");
			$total_count = $res[0]->c;
			$max_page = ceil($total_count/$per_page);
			if($page<1) {
				$page = 1;
			}
			if($page>$max_page) {
				$page = $max_page;
			}
			$limit = '';
			if($total_count >= $per_page) {
				$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
			}
			$grant_list = $db->get_results("SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_submitted_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline='0000-00-00'
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											
											UNION SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_submitted_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline >= CURDATE()
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											{$order_by}
											{$limit}
										");
			break;
		case 'denied':
			?>
			<div style="color:#606060;">
				<i class="fas fa-thumbs-down" style="float:left;font-size:50px;vertical-align:middle;padding-right:10px;"></i>
				<div style="font-size:18px;">Denied</div>
				<div style="font-size:12px;"><i>Here are the applications you marked as you were denied.</i></div>
				<div style="clear:both;"></div>
			</div>
			<?php
			$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grd_usa_denied_grants sg
									LEFT JOIN grdb.grd_grants AS gg ON sg.grants_id=gg.grants_id
									WHERE sg.site_code='".$db->clean($siteCode)."'
									AND sg.client_id='".$db->clean($user)."'
									AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									AND gg.bad_url=0
									{$not_ignored_where}");
			$total_count = $res[0]->c;
			$max_page = ceil($total_count/$per_page);
			if($page<1) {
				$page = 1;
			}
			if($page>$max_page) {
				$page = $max_page;
			}
			$limit = '';
			if($total_count >= $per_page) {
				$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
			}
			$grant_list = $db->get_results("SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_denied_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline='0000-00-00'
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											
											UNION SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_denied_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline >= CURDATE()
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											{$order_by}
											{$limit}
										");
			break;
		case 'approved':
			?>
			<div style="color:#629b44;">
				<i class="fas fa-thumbs-up" style="float:left;font-size:50px;vertical-align:middle;padding-right:10px;"></i>
				<div style="font-size:18px;">Approved</div>
				<div style="font-size:12px;"><i>Here are the applications you marked as you were approved.</i></div>
				<div style="clear:both;"></div>
			</div>
			<?php
			$res = $db->get_results("SELECT COUNT(DISTINCT(gg.grants_id)) as c
									FROM grdb.grd_usa_approved_grants sg
									LEFT JOIN grdb.grd_grants AS gg ON sg.grants_id=gg.grants_id
									WHERE sg.site_code='".$db->clean($siteCode)."'
									AND sg.client_id='".$db->clean($user)."'
									AND (gg.deadline='0000-00-00' OR gg.deadline >= CURDATE())
									AND gg.bad_url=0
									{$not_ignored_where}");
			$total_count = $res[0]->c;
			$max_page = ceil($total_count/$per_page);
			if($page<1) {
				$page = 1;
			}
			if($page>$max_page) {
				$page = $max_page;
			}
			$limit = '';
			if($total_count >= $per_page) {
				$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
			}
			$grant_list = $db->get_results("SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_approved_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline='0000-00-00'
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											
											UNION SELECT 
													gg.*,
													gbg.ts_added,
													gufg.id AS favorite,
													guvg.id AS viewed,
													gusg.id AS submitted,
													guag.id AS approved,
													gudg.id AS denied,
													gufig.id AS filling,
													gt.name AS grant_type,
													IF(gg.deadline='0000-00-00',1,0) as no_deadline,
													ggl.bg_color_hex,
													ggl.logo_url
											FROM grdb.grd_usa_approved_grants gbg
											LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
											LEFT JOIN grdb.grd_usa_saved_grants AS gufg ON gg.grants_id = gufg.grants_id AND gufg.client_id = '$user' AND gufg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_viewed_grants AS guvg ON gg.grants_id = guvg.grants_id AND guvg.client_id = '$user' AND guvg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_submitted_grants AS gusg ON gg.grants_id = gusg.grants_id AND gusg.client_id = '$user' AND gusg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_approved_grants AS guag ON gg.grants_id = guag.grants_id AND guag.client_id = '$user' AND guag.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_denied_grants AS gudg ON gg.grants_id = gudg.grants_id AND gudg.client_id = '$user' AND gudg.site_code = '$siteCode'
											LEFT JOIN grdb.grd_usa_filling_grants AS gufig ON gg.grants_id = gufig.grants_id AND gufig.client_id = '$user' AND gufig.site_code = '$siteCode'
											LEFT JOIN grdb.grd_types AS gt ON gt.types_id = gg.types_id
											LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
											WHERE
												gbg.site_code='".$db->clean($siteCode)."'
												AND gbg.client_id='".$db->clean($user)."'
												AND gg.deadline >= CURDATE()
												AND gg.bad_url=0
												{$not_ignored_where}
											GROUP BY gg.grants_id
											{$order_by}
											{$limit}
										");
			break;
	}
	?>
	<?php if(!empty($limit)) { ?>
	<div class="paging">
		<center>
			<h3><?= paging_title($page,$total_count,$per_page);?> of <?= number_format($total_count);?></h3>
			<button onclick="grant_list_change_page('1'); return false;" title="<?= paging_title(1,$total_count,$per_page);?>">&lt;&lt;</button>
			<button onclick="grant_list_change_page('<?= $page-1;?>'); return false;" title="<?= paging_title($page-1,$total_count,$per_page);?>">&lt;</button>
			<?php for($i=$page-5;$i<$page+5;$i++) {
				if($i>=1 && $i<=$max_page) { ?>
			<button onclick="grant_list_change_page('<?= $i;?>'); return false;" <?= ($i==$page) ? 'class="selected_page"' : '';?> title="<?= paging_title($i,$total_count,$per_page);?>"><?= $i;?></button>
				<?php } ?>
			<?php } ?>
			<button onclick="grant_list_change_page('<?= $page+1;?>'); return false;" title="<?= paging_title($page+1,$total_count,$per_page);?>">&gt;</button>
			<button onclick="grant_list_change_page('<?= $max_page;?>'); return false;" title="<?= paging_title($max_page,$total_count,$per_page);?>">&gt;&gt;</button>
		</center>
	</div>
	<?php } ?>
	<div id="grantList">
		<?php
		$on_organizer = 1;
		if($phone) {
			include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/inc/non_angular_grant_list_mobile.php');
		} else {
			include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/inc/non_angular_grant_list.php');
		} ?>
	</div>
	<?php if(!empty($limit)) { ?>
	<div class="paging">
		<center>
			<h3><?= paging_title($page,$total_count,$per_page);?> of <?= number_format($total_count);?></h3>
			<button onclick="grant_list_change_page('1'); return false;" title="<?= paging_title(1,$total_count,$per_page);?>">&lt;&lt;</button>
			<button onclick="grant_list_change_page('<?= $page-1;?>'); return false;" title="<?= paging_title($page-1,$total_count,$per_page);?>">&lt;</button>
			<?php for($i=$page-5;$i<$page+5;$i++) {
				if($i>=1 && $i<=$max_page) { ?>
			<button onclick="grant_list_change_page('<?= $i;?>'); return false;" <?= ($i==$page) ? 'class="selected_page"' : '';?> title="<?= paging_title($i,$total_count,$per_page);?>"><?= $i;?></button>
				<?php } ?>
			<?php } ?>
			<button onclick="grant_list_change_page('<?= $page+1;?>'); return false;" title="<?= paging_title($page+1,$total_count,$per_page);?>">&gt;</button>
			<button onclick="grant_list_change_page('<?= $max_page;?>'); return false;" title="<?= paging_title($max_page,$total_count,$per_page);?>">&gt;&gt;</button>
		</center>
	</div>
	<?php } ?>
</div>
<?php
	$body = ob_get_clean();
	$title = "Application Organizer : ".$_SESSION['site_name'];
	include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/non_angular_layout.php');
?>

Youez - 2016 - github.com/yon3zu
LinuXploit