| 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/givesback/ |
Upload File : |
<?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','Gives Back');
$user = $_SESSION['user'];
if(!empty($_POST['action'])) {
switch($_POST['action']) {
case 'confirm_step':
$is_there = $db->get_results("SELECT id FROM grdb.givesback_steps_done
WHERE site_code='".$db->clean($siteCode)."'
AND client_id='".$db->clean($user)."'
AND step_done='".$db->clean($_POST['name'])."'");
if(empty($is_there)) {
$db->query("INSERT INTO grdb.givesback_steps_done
(
site_code
,client_id
,step_done
,ts
) VALUES (
'".$db->clean($siteCode)."'
,'".$db->clean($user)."'
,'".$db->clean($_POST['name'])."'
,NOW()
)");
}
die();
break;
case 'edit_name':
$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller
SET first='".$db->clean($_POST['first'])."'
,last='".$db->clean($_POST['last'])."'
WHERE id='".$db->clean($user)."'");
break;
case 'edit_email':
$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller
SET email='".$db->clean($_POST['email'])."'
WHERE id='".$db->clean($user)."'");
break;
case 'edit_phone':
$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller
SET phone_1='".$db->clean(preg_replace('/[^0-9]/','',$_POST['phone']))."'
WHERE id='".$db->clean($user)."'");
break;
case 'edit_address':
$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller
SET address1='".$db->clean($_POST['address'])."'
,city='".$db->clean($_POST['city'])."'
,state='".$db->clean($_POST['state'])."'
,zip='".$db->clean($_POST['zip'])."'
WHERE id='".$db->clean($user)."'");
break;
}
header("Location: /vx/usa/givesback/");
exit(0);
}
$client_info = (object) array();
$confirmed = array();
if(!empty($user)) {
//Check if they won
$res = $db->get_results("SELECT id FROM grdb.givesback_winners
WHERE site_code='".$db->clean($siteCode)."'
AND client_id='".$db->clean($user)."'");
if(!empty($res)) {
//They won, redirect to winner page
header("Location: winner.php");
exit(0);
}
$res = $db->get_results("SELECT step_done,ts
FROM grdb.givesback_steps_done
WHERE site_code='".$db->clean($siteCode)."'
AND client_id='".$db->clean($user)."'");
foreach($res as $r) {
$confirmed[$r->step_done] = date('M d, Y',strtotime($r->ts));
}
$already_entered = false;
//check if all steps are done, and put them in the givesback entered if so
$res = $db->get_results("SELECT ts FROM grdb.givesback_entered
WHERE site_code='".$db->clean($siteCode)."'
AND client_id='".$db->clean($user)."'");
if(empty($res)) {
if(count($confirmed)==5) {
$cat_id = 3; //Default to Personal
$date_ordered = '0000-00-00 00:00:00';
//They have all the steps done, enter them
$res = $db->get_results("SELECT p.profile_category_id,r.date_ordered
FROM lc2{$siteCode}_lc.lc_reseller r
LEFT JOIN lc2{$siteCode}_lc.lc_leads l ON l.customerID=r.id
LEFT JOIN lc2{$siteCode}_lc.lead_profile p ON p.lead_id=l.id
WHERE r.id='".$db->clean($user)."'");
if(!empty($res)) {
if(!empty($res[0]->profile_category_id)) {
$cat_id = $res[0]->profile_category_id;
}
$date_ordered = $res[0]->date_ordered;
}
$db->query("INSERT INTO grdb.givesback_entered
(
site_code
,client_id
,category_id
,date_ordered
,still_active
,ts
) VALUES (
'".$db->clean($siteCode)."'
,'".$db->clean($user)."'
,'".$db->clean($cat_id)."'
,'".$db->clean($date_ordered)."'
,1
,NOW()
)");
}
} else {
$already_entered = date('M d, Y',strtotime($res[0]->ts));
}
$res = $db->get_results("SELECT first,last,email,phone_1,address1,city,state,zip
FROM lc2{$siteCode}_lc.lc_reseller
WHERE id='".$db->clean($user)."'");
if(!empty($res)) {
$client_info = $res[0];
}
if(empty($_SESSION['visited_givesback'])) {
$_SESSION['visited_givesback'] = 1;
$db->query("INSERT IGNORE INTO grdb.givesback_page_has_visited
(
site_code
,client_id
,first_visit
) VALUES (
'".$db->clean($siteCode)."'
,'".$db->clean($user)."'
,NOW()
)");
}
}
ob_start();
?>
<script type="text/javascript">
function givesback_confirm_step(nm) {
var querystring = 'action=confirm_step&name=' + encodeURIComponent(nm);
$.ajax({
url:"/vx/usa/givesback/index.php",
cache: false,
type: "POST",
data: querystring,
success: function(results) {
window.location.reload(false);
}
});
}
</script>
<style type="text/css">
.fleft_side {
float:left;
width:500px;
}
.fright_side {
float:left;
width:335px;
margin-left:20px;
}
.confirm_info_button {
background:#cbe8ba;
color:black;
text-align:center;
width:90%;
padding:10px 0px;
border-radius:5px;
border:1px solid black;
}
.save_button {
background:#cbe8ba;
color:black;
text-align:center;
padding:10px 20px;
border-radius:5px;
border:1px solid black;
}
.givesback_status_table td {
vertical-align:top;
}
.winner_image {
float:left;
vertical-align:top;
width:100px;
margin-right:10px;
}
.winner_image img {
width:100%;
}
@media only screen and (max-width : 500px) {
.fleft_side {
float:none;
width:auto;
}
.fright_side {
float:none;
width:auto;
margin-left:0px;
margin-top:20px;
}
}
</style>
<div class="rb p20 top">
<div class="fleft_side">
<div class="rb">
<center>
<div><img src="givesback_black.png" style="width:100%;max-width:400px;" /></div>
<?php
$total_amount = 0;
$tres = $db->get_results("SELECT SUM(amount) as total_amount
FROM grdb.givesback_winners
WHERE money_sent<>'0000-00-00 00:00:00'");
$total_amount = $tres[0]->total_amount;
?>
<div><i>Total Awarded: $<?= number_format($total_amount);?></i></div>
<?php $next_date = date('M d, Y',strtotime('next monday'));?>
<div style="font-size:16px;font-weight:bold;color:red;"><i>Next Givesback Award Date: <?= $next_date;?></i></div>
</center>
</div>
<br />
<div class="rb">
<p>In an effort to help you reach your funding goals and to show our appreciation to our clients, we are proud to announce our "Givesback" cash award program. We will reward a few of members with <strong>cash awards in a random monthly drawing. Amounts will vary.</strong> Individuals, organizations, or businesses are all eligible. Winners will be notified by email and text. Winners will also be posted to the site on the "Givesback Page." Restrictions apply.</p>
<p>To be entered into the drawing, follow these 4 steps:</p>
<ol>
<li>Search our grant application database and find your <strong>3 Favorite Grants.</strong></li>
<li>Click the <strong>"Heart" icon</strong> in the bottom right-hand corner of each of these grant pages. As long as you have 3 funding sources selected as "favorites", you are eligible for the cash award as long as your account is active.</li>
<li><strong>Verify</strong> your <strong>name</strong>, your <strong>email address</strong>, your <strong>mobile phone number</strong>, and your <strong>address</strong> to be sure you receive the notifications if your are selected.</li>
</ol>
<p>Thank you for being a valued client!</p>
<p>USA Givesback</p>
</div>
</div>
<div class="fright_side">
<div style="background:#c9f1fd;padding:20px;width:100%;">
<div style="font-size:25px;"><strong>Your "Giveback" Status</strong></div>
<table class="givesback_status_table" style="width:100%;">
<?php /*
<tr>
<td><div class="relative iblock fa <?= (!empty($confirmed['i_want_cash'])) ? 'fa-check-square' : 'fa-square white';?> f16" style="vertical-align:middle;"></div></td>
<td>
<strong style="padding-left:5px;">Clicked "I want a Cash Award" button</strong>
<?php if(!empty($confirmed['i_want_cash'])) { ?>
<br /><i style="display:inline-block;padding-left:5px;"><?= $confirmed['i_want_cash'];?></i>
<?php } ?>
</td>
</tr>
*/ ?>
<tr>
<td><div class="relative iblock fa <?= (!empty($confirmed['name'])) ? 'fa-check-square' : 'fa-square white';?> f16" style="vertical-align:middle;"></div></td>
<td>
<strong style="padding-left:5px;">Confirm Name</strong>
<?php if(!empty($confirmed['name'])) { ?>
<i style="display:inline-block;padding-left:5px;"><?= $confirmed['name'];?></i>
<?php } ?>
<div class="f14"><?= $client_info->first;?> <?= $client_info->last;?></div>
<div id="name_edit" style="display:none;">
<form method="post" action="index.php">
<input type="hidden" name="action" value="edit_name" />
<div><input type="text" name="first" value="<?= $client_info->first;?>" placeholder="First Name" /></div>
<div><input type="text" name="last" value="<?= $client_info->last;?>" placeholder="Last Name" /></div>
<div><input type="submit" name="submit" value="Save" class="save_button" /></div>
</form>
</div>
<?php if(empty($confirmed['name'])) { ?>
<div style="cursor:pointer;" title="Edit" onclick="$('#name_edit').toggle();"><div class="relative iblock glyphicons glyphicons-pencil f14"></div>Edit Name</div>
<button onclick="givesback_confirm_step('name'); return false;" class="confirm_info_button">Click to Confirm Name</button>
<?php } ?>
</td>
</tr>
<tr>
<td><div class="relative iblock fa <?= (!empty($confirmed['email'])) ? 'fa-check-square' : 'fa-square white';?> f16" style="vertical-align:middle;"></div></td>
<td>
<strong style="padding-left:5px;">Confirm Email</strong>
<?php if(!empty($confirmed['email'])) { ?>
<i style="display:inline-block;padding-left:5px;"><?= $confirmed['email'];?></i>
<?php } ?>
<div class="f14"><?= $client_info->email;?></div>
<div id="email_edit" style="display:none;">
<form method="post" action="index.php">
<input type="hidden" name="action" value="edit_email" />
<div><input type="text" name="email" value="<?= $client_info->email;?>" placeholder="Email" /></div>
<div><input type="submit" name="submit" value="Save" class="save_button" /></div>
</form>
</div>
<?php if(empty($confirmed['email'])) { ?>
<div style="cursor:pointer;" title="Edit" onclick="$('#email_edit').toggle();"><div class="relative iblock glyphicons glyphicons-pencil f14"></div>Edit Email</div>
<button onclick="givesback_confirm_step('email'); return false;" class="confirm_info_button">Click to Confirm Email</button>
<?php } ?>
</td>
</tr>
<tr>
<td><div class="relative iblock fa <?= (!empty($confirmed['phone'])) ? 'fa-check-square' : 'fa-square white';?> f16" style="vertical-align:middle;"></div></td>
<td>
<strong style="padding-left:5px;">Confirm Mobile</strong>
<?php if(!empty($confirmed['phone'])) { ?>
<i style="display:inline-block;padding-left:5px;"><?= $confirmed['phone'];?></i>
<?php } ?>
<div class="f14"><?= phone_number($client_info->phone_1);?></div>
<div id="phone_edit" style="display:none;">
<form method="post" action="index.php">
<input type="hidden" name="action" value="edit_phone" />
<div><input type="text" name="phone" value="<?= phone_number($client_info->phone_1);?>" placeholder="Mobile Phone" /></div>
<div><input type="submit" name="submit" value="Save" class="save_button" /></div>
</form>
</div>
<?php if(empty($confirmed['phone'])) { ?>
<div style="cursor:pointer;" title="Edit" onclick="$('#phone_edit').toggle();"><div class="relative iblock glyphicons glyphicons-pencil f14"></div>Edit Mobile Phone</div>
<button onclick="givesback_confirm_step('phone'); return false;" class="confirm_info_button">Click to Confirm Mobile Phone</button>
<?php } ?>
</td>
</tr>
<tr>
<td><div class="relative iblock fa <?= (!empty($confirmed['address'])) ? 'fa-check-square' : 'fa-square white';?> f16" style="vertical-align:middle;"></div></td>
<td>
<strong style="padding-left:5px;">Confirm Address</strong>
<?php if(!empty($confirmed['address'])) { ?>
<i style="display:inline-block;padding-left:5px;"><?= $confirmed['address'];?></i>
<?php } ?>
<div class="f14"><?= $client_info->address1.'<br />'.$client_info->city.', '.$client_info->state.' '.$client_info->zip;?></div>
<div id="address_edit" style="display:none;">
<form method="post" action="index.php">
<input type="hidden" name="action" value="edit_address" />
<div><input type="text" name="address" value="<?= $client_info->address1;?>" placeholder="Street Address" /></div>
<div><input type="text" name="city" value="<?= $client_info->city;?>" placeholder="City" /></div>
<div><input type="text" name="state" value="<?= $client_info->state;?>" placeholder="State" /></div>
<div><input type="text" name="zip" value="<?= $client_info->zip;?>" placeholder="Zip" /></div>
<div><input type="submit" name="submit" value="Save" class="save_button" /></div>
</form>
</div>
<?php if(empty($confirmed['address'])) { ?>
<div style="cursor:pointer;" title="Edit" onclick="$('#address_edit').toggle();"><div class="relative iblock glyphicons glyphicons-pencil f14"></div>Edit Address</div>
<button onclick="givesback_confirm_step('address'); return false;" class="confirm_info_button">Click to Confirm Address</button>
<?php } ?>
</td>
</tr>
<tr>
<td><div class="relative iblock fa <?= (!empty($confirmed['favorites'])) ? 'fa-check-square' : 'fa-square white';?> f16" style="vertical-align:middle;"></div></td>
<td>
<strong style="padding-left:5px;">Favorited 3 Grants</strong>
<?php if(!empty($confirmed['favorites'])) { ?>
<i style="display:inline-block;padding-left:5px;"><?= $confirmed['favorites'];?></i>
<?php } ?>
</td>
</tr>
<tr>
<td><div class="relative iblock fa <?= (!empty($already_entered)) ? 'fa-check-square' : 'fa-square white';?> f16" style="vertical-align:middle;"></div></td>
<td>
<strong style="padding-left:5px;">Entered into the "Givesback" Program</strong>
<?php if(!empty($already_entered)) { ?>
<i style="display:inline-block;padding-left:5px;"><?= $already_entered;?></i>
<?php } ?>
</td>
</tr>
</table>
<?php if(count($confirmed)==6) { ?>
<center>
<div><img src="youre_entered.png" /></div>
<div><i>Be sure to check back on this page for updates on new winners. Remember you will be notified via email and text message.</i></div>
</center>
<?php } ?>
</div>
</div>
<div style="clear:both;"></div>
<div class="fleft_side">
<div style="margin:10px 0px;">
<center>
<div><img src="past_award_recipients.png" /></div>
<?php
$total_amount = 0;
$tres = $db->get_results("SELECT SUM(amount) as total_amount
FROM grdb.givesback_winners
WHERE money_sent<>'0000-00-00 00:00:00'");
$total_amount = $tres[0]->total_amount;
?>
<div><i>Total Awarded: $<?= number_format($total_amount);?></i></div>
</center>
</div>
<div style="font-size:14px;">
<?php $tres = $db->get_results("SELECT money_sent,amount,how_use_money,site_code,client_id,picture_location,IF(picture_location='',0,1) as has_picture FROM grdb.givesback_winners WHERE published=1 AND money_sent<>'0000-00-00 00:00:00' ORDER BY has_picture DESC,money_sent DESC");
foreach($tres as $tr) {
$tcres = $db->get_results("SELECT first,last FROM lc2{$tr->site_code}_lc.lc_reseller WHERE id='".$db->clean($tr->client_id)."'");
if(!empty($tcres)) {
?>
<div style="margin:20px 0px;">
<div class="winner_image">
<div><img src="https://surfcrm.com/bin/ajax/load_file_from_amazon_open.php?file=<?= urlencode($tr->picture_location);?>" onerror="$(this).remove();" /></div>
</div>
<div><u><strong><?= ucwords(strtolower($tcres[0]->first)).' '.substr(ucwords(strtolower($tcres[0]->last)),0,1);?></strong> was awarded on <?= date('F j, Y',strtotime($tr->money_sent));?></u></div>
<div style="margin-top:5px;"><i>"<?= $tr->how_use_money;?>"</i></div>
<div style="clear:both;"></div>
</div>
<?php
}
}
?>
</div>
</div>
<div style="clear:both;"></div>
</div>
<?php
$body = ob_get_clean();
$title = "Gives Back : ".$_SESSION['site_name'];
include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/non_angular_layout.php');
?>