Welcome Guest, Not a member yet? Register   Sign In
Facebook Credits Demo Application Errors
#1

[eluser]JohnnyAction[/eluser]
Facebook has provided some sample code to create a demo credits page found here: https://github.com/facebook/credits-api-sample

I've taken the facebook files and set them up as autoloaded plugins, then turned their index.php view into a view. I created a controller that loads up and launches the view. This part seems great.

When I load the page, everything seems to work. I can buy credits, and it comes back successful. The only problem is that when the page first loads, I get these 3 error messages:

Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined index: order_id
Filename: views/credits_view.php
Line Number: 45

A PHP Error was encountered
Severity: Notice
Message: Undefined index: error_code
Filename: views/credits_view.php
Line Number: 50

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: html
Filename: views/credits_view.php
Line Number: 56

The errors come from this part of the code:

Code:
<?php
  // if $order_id and $status are passed back, we know they were send from the full
  // page view, here we print the same information users see through the normal path
  if ($_GET['order_id'] && $_GET['status']) {
    $html = "Transaction Completed! </br></br>"
      ."Data returned from Facebook: </br>"
      ."<b>Order ID: </b>" . $_GET['order_id'] . "</br>"
      ."<b>Status: </b>" . $_GET['status'];
  } elseif ($_GET['error_code'] && $_GET['error_message']) {
    $html = "Transaction Failed! </br></br>"
      ."Error message returned from Facebook:</br>"
      .$_GET['error_message'];
  }
  ?&gt;
  <div id="output"> &lt;?=$html?&gt; </div> </br></br>

As far as I understand it, the errors are related to the 'order_id','error_code' and 'html' variables. What I don't understand is why.

Haven't I read somewhere that CI has a problem with $_GET commands from Facbeook? Is that the issue? If so, how do I get around it?

As I said, this doesn't seem to change the functionality of the credit purchase. If I comment out that whole block, it still works fine. I just don't know what problems that might cause. I know this code is pretty new, and I've very new to this stuff. Any help would be appreciated.




Theme © iAndrew 2016 - Forum software by © MyBB