[guadec-web] Error Resolved: trying on the main server



commit f6dca0ea595d24a7bf13ca00ffe18c9f0a75b263
Author: Saumya Dwivedi <saumya zero gmail com>
Date:   Wed Jul 9 14:23:02 2014 +0530

    Error Resolved: trying on the main server

 guadec/confirm-payment.php |   10 +++++-----
 guadec/ipn.php             |   27 +++++++++------------------
 guadec/ipnlistener.php     |   14 ++++----------
 3 files changed, 18 insertions(+), 33 deletions(-)
---
diff --git a/guadec/confirm-payment.php b/guadec/confirm-payment.php
index 232075f..6ad9552 100644
--- a/guadec/confirm-payment.php
+++ b/guadec/confirm-payment.php
@@ -6,7 +6,7 @@ Template Name: Confirm Payment
 <?php
  $application_submitted = false;
  $mailContent = '';
- $table_name = $wpdb->prefix .'guadec2014_registration';
+ $table_name = $wpdb->prefix .'guadec2014_registrations';
 
 global $wpdb;
 $sql = "CREATE TABLE $table_name (
@@ -58,9 +58,9 @@ if (!empty($_POST)) {
        //check if the email already registered
        //TODO: Add the payment condition, once ipn works
        $repeat = $wpdb->get_var($wpdb->prepare(
-               "select id from wp_guadec2014_registration
-               where email=%s",
-               $email)
+               "select id from wp_guadec2014_registrations
+               where email=%s and payment=%s",
+               $email, 'Completed')
        );
        
 
@@ -137,7 +137,7 @@ if (!empty($_POST)) {
        <div> "Invalid Submission. Please go through registration page first."</div>
 <?php else: ?>
        <?php if ($errors == true): ?>
-       <div> "Invalid/Already used email. Please make sure you are not already registered."<a 
href="http://localhost/wordpress/?page_id=4787";> Go back to Registration </a>
+       <div> "Invalid/Already used email. Please make sure you are not already registered. If you are, and 
want to make certain adjustments to your record, contact our system administration "provide an email address 
here" OR "<a href="http://localhost/wordpress/?page_id=4787";> Go back to Registration </a>
        <?php else: ?>
                <?php //echo $registerInfo; ?>
                <div class="section group">
diff --git a/guadec/ipn.php b/guadec/ipn.php
index 3d0e622..6bddc0d 100755
--- a/guadec/ipn.php
+++ b/guadec/ipn.php
@@ -8,7 +8,6 @@ GUADEC 2014 Registration
 <?php
 // tell PHP to log errors to ipn_errors.log in this directory
 ini_set('log_errors', true);
-//ini_set('error_log', dirname(__FILE__).'/ipn_errors.log');
 
 ini_set('error_log', 'ipn_errors.log');
 
@@ -76,11 +75,14 @@ if ($verified) {
     }
 
     // TODO: Check for duplicate user_id
-    
+    $reg_email = $cvar['email'];
+    if(empty($reg_email)){
+        $errmsg .= "No Valid user email-address found\n"
+    }        
     if (!empty($errmsg)) {
-        $reg_email = $cvar['email'];
-        $upipn = $listener->updateCompleted($reg_email);
-       error_log($upipn);
+        $status = "Fraud-check"
+        $upipn = $listener->updateCompleted($reg_email,$status);
+        error_log($upipn);
         // manually investigate errors from the fraud checking
         $body .= "Registration Payment Successful-with fraud warning ";
         $body .= "IPN failed fraud checks: \n$errmsg\n\n";
@@ -95,18 +97,7 @@ if ($verified) {
         mail($_POST['payer_email'], 'GUADEC-2014 Registration Payment:Waiting for Confirmation', $body, 
$headers);
         
     } else {
-
-        $reg_email = $cvar['email'];
-        $body = $listener->updateCompleted($reg_email);
-        // $wpdb->update(
-        // $table_name,
-        // array(
-        //     'payment' => 'Completed'
-        //     ),
-        // array(
-        //     'email' => $reg_email
-        //     ) 
-        // );
+        $body = $listener->updateCompleted($reg_email, $_POST['payment_status']);
         $body .= "Registration Payment Successful for ";
         $body .= $cvar['name'];
         $body .= " with email ";
@@ -115,6 +106,7 @@ if ($verified) {
         error_log($body);
         mail($_POST['receiver_email'], 'GUADEC-2014 Registration Payment Successful', $body, $headers);
         mail($_POST['payer_email'], 'GUADEC-2014 Registration Successful', $body, $headers);
+        $body .= "Complete List of items that you have paid for\n"
         $email_content =
         "Name: " . $cvar['name'] . "\r\n".
         "Email: " . $cvar['email'] . "\r\n" .
@@ -132,7 +124,6 @@ if ($verified) {
 } 
 else {
     // manually investigate the invalid IPN
-
     error_log($listener->getTextReport());
     mail($_POST['receiver_email'], 'Invalid IPN', $listener->getTextReport());
 }
diff --git a/guadec/ipnlistener.php b/guadec/ipnlistener.php
index 8b8c9bd..cd353ad 100755
--- a/guadec/ipnlistener.php
+++ b/guadec/ipnlistener.php
@@ -11,6 +11,8 @@
  *  @author     Micah Carrick
  *  @copyright  (c) 2012 - Micah Carrick
  *  @version    2.1.0
+ *  
+ *  Modified for use: GUADEC 2014 Registrations 
  */
 
 require_once($_SERVER['DOCUMENT_ROOT']."/wp-load.php"); 
@@ -312,17 +314,9 @@ class IpnListener {
             throw new Exception("Invalid HTTP request method.");
         }
     }
-    public function updateCompleted($reg_email='dummy mail com') {
-    //    if (!$wpdb) {
-    //        $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
-    //    } else {
-            global $wpdb;
-    //    }   
-        
+    public function updateCompleted($reg_email='dummy mail com', $status='Pending') {
+        global $wpdb;
         $table_name = $wpdb->prefix .'guadec2014_registrations';
-     //   error_log($table_name);     // check if the wpdb is accessible
-        var_dump($wpdb);
-        $up = $wpdb->get_results('SELECT * FROM wp_guadec2014_registrations', ARRAY_A);
              
         $up = $wpdb->update(
         $table_name,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]