Enlightenment CVS committal Author : inc Project : web Module : www
Dir : web/www/donate Modified Files: donate_ipn.php donate_settings.php donate_meter.php Log Message: Here's the new code that'll reside at enlightenment.org/donate =================================================================== RCS file: /cvs/e/web/www/donate/donate_ipn.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- donate_ipn.php 8 Jun 2007 15:16:48 -0000 1.1 +++ donate_ipn.php 3 Jan 2008 07:43:01 -0000 1.2 @@ -14,7 +14,7 @@ // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n". "Content-Type: application/x-www-form-urlencoded\r\n". - "Content-Length: " . strlen($req) . "\r\n\r\n"; + "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); @@ -38,45 +38,45 @@ $payment_type = $_POST['payment_type']; $notify_version = $_POST['notify_version']; $verify_sign = $_POST['verify_sign']; -$payer_email = $_POST['payer_email']; +$payer_email = $_POST['payer_email']; $ip = $_SERVER['REMOTE_ADDR']; if ( ! $fp ) { // HTTP ERROR. } else { - fputs ($fp, $header . $req); + fputs ($fp, $header . $req); while ( !feof($fp) ) { - $res = fgets ($fp, 1024); - + $res = fgets ($fp, 1024); + if (strcmp ($res, "VERIFIED") == 0) { if (strcmp ($payment_status, "Completed") == 0) { - $result = mysql_query("select txn_id from donations where txn_id LIKE '%$trans_id%'"); + $result = mysql_query("select txn_id from donations where txn_id LIKE '%$trans_id%'"); if (!mysql_num_rows($result) && $receiver_email=="[EMAIL PROTECTED]" ) { // Email the person who donated, thanking them $message = "Dear $first_name $last_name,\nThank you for your donation to the Enlightenment project"; mail($to, "Donation to Enlightenment", $message, "From: " . $receiver_email . ""); - - $result = mysql_query("select donation,user_email from donations where user_email='$payer_email'"); - - if(!mysql_num_rows($result)) + + $result = mysql_query("select donation,user_email from donations where user_email='$payer_email'"); + + if(!mysql_num_rows($result)) { - $result = mysql_query( + $result = mysql_query( "INSERT into donations ". - "(ip, txn_id, name, donation,user_email) VALUES ". - "(\"$ip\", \"$trans_id\", \"$first_name $last_name\", \"$payment_gross\", '$payer_email')" - ); - } - else - { - $result = mysql_query( - "UPDATE donations - SET txn_id=CONCAT(txn_id,',$trans_id') - donation=" . $result['donation']+$payment_gross . - "WHERE user_email='$payer_email'" - ); + "(ip, txn_id, name, donation,user_email,date) VALUES ". + "(\"$ip\", \"$trans_id\", \"$first_name $last_name\", \"$payment_gross\", '$payer_email', NOW())" + ); + } + else + { + $result = mysql_query( + "UPDATE donations + SET txn_id=CONCAT(txn_id,',$trans_id') + donation=" . $result['donation']+$payment_gross . + "WHERE user_email='$payer_email'" + ); } } /*} else if (strcmp ($payment_status, "Pending") == 0) { @@ -85,18 +85,18 @@ } else if (strcmp ($payment_status, "Refunded") == 0) {*/ - } - } + } + } else if (strcmp ($res, "INVALID") == 0) { //echo "Sorry, you are not authorized to access this script! Your IP Address: $REMOTE_ADDR , is being E-Mailed to $CompanyName for investigation. \n\n If we find that you have been repeatidly attempting to access this script we will be forced to notify your ISP of this activity"; $message .= "FYI - There has been an attempted hack from someone trying to access the PayPal IPN script directly. Their IP address is: $REMOTE_ADDR"; mail($CompanyEmail, "APC PayPal IPN Hack Attempt", $message, "From: " . $CompanyEmail . ""); } - } + } fclose ($fp); -} - -header('Location: http://www.enlightenment.org/donation'); +} + +header('Location: http://www.enlightenment.org/donation'); -?> \ No newline at end of file +?> =================================================================== RCS file: /cvs/e/web/www/donate/donate_settings.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- donate_settings.php 8 Jun 2007 15:16:48 -0000 1.1 +++ donate_settings.php 3 Jan 2008 07:43:01 -0000 1.2 @@ -1,12 +1,12 @@ <?PHP -$dbhost = "mysql.inc-omplete.org"; -$dbusername = "thisisnottheusername"' -$dbpass = "thisisnotthemysqlpass"; -$dbname = "e212_donation"; +$dbhost = "xxxxxx"; +$dbusername = "xxxxxxx"; +$dbpass = "xxxxxxxx"; +$dbname = "donations"; -$cursym = '$'; +$cursym = "\$"; $curcode = "USD"; $CompanyName = "Enlightenment"; @@ -14,7 +14,8 @@ $CompanyEmail = "[EMAIL PROTECTED]"; // Make sure this is the same as you paypal email address $supportEmail = "[EMAIL PROTECTED]"; $salesEmail = "[EMAIL PROTECTED]"; - +# These Next couple of lines are no longer needed since we met our +goal.... $goal = 4000.00; $offset = 1255.00; ?> =================================================================== RCS file: /cvs/e/web/www/donate/donate_meter.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- donate_meter.php 8 Jun 2007 15:16:48 -0000 1.1 +++ donate_meter.php 3 Jan 2008 07:43:01 -0000 1.2 @@ -1,52 +1,48 @@ -<?PHP + +<?php require_once "donate_settings.php"; $loginParams = mysql_connect("$dbhost", "$dbusername", "$dbpass"); mysql_select_db("$dbname",$loginParams); -$result = mysql_query("select name, donation from `donations` - ORDER BY donation DESC"); - -if(!$result) +$result = mysql_query("select SUM(donation) as donation, COUNT(name) as donors from donations group by null"); +if(!$result){ + echo mysql_error(); +} +$row = mysql_fetch_array($result); +$donation = $row['donation']+$offset; +$donation_formatted = number_format ($donation, 2); +$donors = $row['donors']; +?> +<center> +<p> + <b>Current Status</b> + <b>Total Donated: <? echo $cursym.$donation_formatted; ?><br> By <? echo $donors; ?> donors.</b> +</p> +<p style="margin-top:0; margin-bottom:0; position:relative;"><b>Most Recent Donors:</b><br> + +<? + +$result = mysql_query("select name, donation, date from donations ORDER BY date DESC"); +if(!$result){ echo mysql_error(); +} $i=0; //$row = mysql_fetch_array($result); + $num = 0; while ($row = mysql_fetch_array($result)) { - if($i++ < 20) - $top5[] = $row['name']; - $donation += $row['donation']; -// $row = mysql_fetch_array($result); + echo $row['name'] ."<br>"; + if($num++ > 15) + break; } -$donation += $offset; - +/* +#$donation += $offset; $donation_formatted = number_format ($donation, 2); $goal_formatted = number_format($goal, 2); $percent_raised = number_format((float)$donation/(float)$goal*100, 1); - +*/ ?> - <h2>Current Status</h2> - <div id="donation_meter_progress" - style="width:500px; -background:url('http://www0.get-e.org/donate/images/progress_background.png'); - text-align:center; border:1px solid #b3b3b3; - height:25px;"> - <div id="donation_meter_bar" - style="height:25px; vertical-align:middle; - background:url('http://donate.edevelop.org/images/progress<?php echo ( -$percent_raised >= 100 ? '_complete' : '' );?>_foreground.png');background-repeat: repeat-x; - width:<?php echo ( $percent_raised >= 100 ? '100' : $percent_raised ); ?>%;"> - </div> - </div> - <p style="width:500px; position:relative; top:-32px; - z-index:3; font-weight:bold; font-size:12px; - color:#000000; padding:0; text-align:center; clear:none; - margin-bottom:0;"> - <?php echo $cursym.$donation_formatted . '/$' . $goal_formatted - . ' (' . $percent_raised . '%)'; ?> - </p> - <?php if(count($top5)) { ?> - <p style="margin-top:0; margin-bottom:0; position:relative; top:-25px;"><b>Top Donators:</b> <?php echo implode(', ', $top5);?></p> - <?php } ?> +</p></center> ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs