[guadec-web] trying to resolve error:3



commit 529e6e6abc92ce187090245e35a2e849e239dfd5
Author: Saumya Dwivedi <saumya zero gmail com>
Date:   Wed Jul 9 13:53:42 2014 +0530

    trying to resolve error:3

 guadec/ipn.php         |   11 ++---------
 guadec/ipnlistener.php |   31 ++++++++++++++++---------------
 2 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/guadec/ipn.php b/guadec/ipn.php
index 6c6f94d..3d0e622 100755
--- a/guadec/ipn.php
+++ b/guadec/ipn.php
@@ -19,10 +19,6 @@ $listener = new IpnListener();
 // tell the IPN listener to use the PayPal test sandbox
 $listener->use_sandbox = true;
 
-//require_once( ABSPATH . 'wp-load.php' );
-// update database variable
-global $wpdb;
-
 // try to process the IPN POST
 try {
     $listener->requirePostMethod();
@@ -83,8 +79,8 @@ if ($verified) {
     
     if (!empty($errmsg)) {
         $reg_email = $cvar['email'];
-        $body = $listener->updateCompleted($reg_email);
-       
+        $upipn = $listener->updateCompleted($reg_email);
+       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";
@@ -101,9 +97,6 @@ if ($verified) {
     } else {
 
         $reg_email = $cvar['email'];
-        var_dump($wpdb);
-        $table_name = $wpdb->prefix .'guadec2014_registration';
-        error_log($table_name);     // check if the wpdb is accessible
         $body = $listener->updateCompleted($reg_email);
         // $wpdb->update(
         // $table_name,
diff --git a/guadec/ipnlistener.php b/guadec/ipnlistener.php
index 5a8d662..8b8c9bd 100755
--- a/guadec/ipnlistener.php
+++ b/guadec/ipnlistener.php
@@ -313,29 +313,30 @@ class IpnListener {
         }
     }
     public function updateCompleted($reg_email='dummy mail com') {
-        if (!$wpdb) {
-    $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
-} else {
-    global $wpdb;
-}   
-    
+    //    if (!$wpdb) {
+    //        $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
+    //    } else {
+            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,
-        // array(
-        //     'payment' => 'Completed'
-        //     ),
-        // array(
-        //     'email' => $reg_email
-        //     ) 
-        // );
+        $up = $wpdb->update(
+        $table_name,
+        array(
+            'payment' => 'Completed'
+            ),
+        array(
+            'email' => $reg_email
+            ) 
+        );
         if(!($up)){
             throw new Exception("Database Error: Not Updated");
         }
+        return (var_dump(($wpdb)));
     }
 }
 ?>


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