if($_SERVER[‘HTTP_HOST’] == ‘prostateawarenessfoundation.loc:9090’)
{
$connection = mysql_connect(‘localhost’,’paf’,’thunder1′) or die(“no database connection”);
}
else
{
$connection = mysql_connect(‘mysql126.hosting.earthlink.net’,’paf’,’Cat2Dog’) or die(“no database connection”);
}
$fileserverpath=”{$_SERVER[‘HTTP_HOST’]}”;
$db_paf = mysql_select_db(“paf”,$connection) or die(“no schema connection”);
/* Begin store into database section */
if ($_POST[“submitDonation”]) {
if(number_format(trim($_POST[“item_price_1″]),2) == ‘0.00’)
{
echo(”
Error processing donation! Amount must not be blank or non-numeric!
“);
}
else
{
$ip=$_SERVER[‘REMOTE_ADDR’];
$currentDate = date(‘Y-m-d’);
if($_POST[“donatename”]==”)
{
$donatename=’Anonymous’;
}
else
{
$donatename=$_POST[“donatename”];
}
if($_POST[“item_description_1″]==”)
{
$donatedesc=”;
}
else
{
$donatedesc=$_POST[“item_description_1”];
}
/* Check to see if record has already been added – page refreshed after posting */
$query = “SELECT * FROM donations WHERE teamid='{$_POST[“teamid”]}’ AND donatedesc=’$donatedesc’ AND donateamt='{$_POST[“item_price_1”]}’ AND donatename=’$donatename’ AND donatedate=’$currentDate’ AND donatetime='{$_POST[“formprocessedtime”]}’ AND ipaddress=’$ip'”;
$donationExistResult = mysql_query($query) or die(‘Error, checking existing record failed’);
if (mysql_num_rows($donationExistResult) == 0)
{
// post event changes to database table donations
$query = “INSERT INTO donations (teamid, donatedesc, donateamt, donatename, donatedate, donatetime, ipaddress)
VALUES (‘{$_POST[“teamid”]}’,’$donatedesc’,'{$_POST[“item_price_1”]}’,’$donatename’,’$currentDate’,'{$_POST[“formprocessedtime”]}’,’$ip’)”;
$donationSaveResult = mysql_query($query) or die(‘Error, save record failed’);
if($donationSaveResult==1)
{
echo ”
“;
echo”“;
}
}
else
{
echo(“There was a problem processing your donation, please try again later”);
exit;
}
}
}
/* End store into database section */
if (!$_GET[‘event’])
{
$date = date(“Y-m-d”);
$eventQuery = “SELECT * FROM events WHERE active=’Yes’ AND eventenddate >”.$date;
$eventsResult = mysql_query($eventQuery,$connection) or die(“event query failed”);
$eventsRow = mysql_fetch_array($eventsResult);
if (mysql_num_rows($eventsResult) > 0)
{
$eventid = $eventsRow[“eventid”];
}
}
else
{
$eventid = $_GET[‘event’];
$eventQuery = “SELECT * FROM events WHERE active=’Yes’ AND eventid=”.$eventid;
$eventsResult = mysql_query($eventQuery,$connection) or die(“event query failed”);
$eventsRow = mysql_fetch_array($eventsResult);
$eventdonateAmountQuery = “SELECT sum( donateamt ) AS donationTotal FROM donations WHERE Active = ‘Yes’ AND teamid IN (SELECT teamid FROM eventteams WHERE eventid=”.$eventid.”)”;
$eventdonateAmountResult = mysql_query($eventdonateAmountQuery,$connection) or die(“event total donate amount query failed”);
$eventdonateAmountRow = mysql_fetch_array($eventdonateAmountResult);
}
if (mysql_num_rows($eventsResult) == 1)
{
$teamAllQuery = “SELECT teamid,teammembers FROM eventteams WHERE active=’Yes’ AND eventid=”.$eventid.” ORDER BY teammembers”;
$teamsAllResult = mysql_query($teamAllQuery,$connection) or die(“all team query failed”);
if ($_GET[‘team’])
{
$teamid = $_GET[‘team’];
$teamQuery = “SELECT * FROM eventteams WHERE active=’Yes’ AND eventid=”.$eventid.” AND teamid=”.$teamid;
$teamsResult = mysql_query($teamQuery,$connection) or die(“team query failed”);
$teamsRow = mysql_fetch_array($teamsResult);
$donateQuery = “SELECT * FROM donations WHERE active=’Yes’ AND teamid=”.$teamid .” ORDER BY donatedate”;
$donateResult = mysql_query($donateQuery,$connection) or die(“donate query failed”);
$donateAmountQuery = “SELECT sum(donateamt) as donationTotal FROM donations WHERE Active=’Yes’ AND teamid=”.$teamid;
$donateAmountResult = mysql_query($donateAmountQuery,$connection) or die(“donate amount query failed”);
$donateAmountRow = mysql_fetch_array($donateAmountResult);
}
}
?>
PAF is currently using Google Checkout to process donations. Google is not charging Non-Profit Organizations any commision on donations through their checkout service for a limited time. It is fast, confidential and easy to use. Using this service makes sure your donation goes to where you want it to. Using Google Checkout will require you to create an account with Google. After submitting your donation you will be redirected to Google Checkout to complete the transaction. You will receive a confirmation email from Google when your transaction is completed. If you encounter problems using Google Checkout, or would prefer to mail in donations. You can send checks payable to PAF at: |
||||||||||||||||||||||
|
>
|