Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Nuke Treasury
Author Message
valdarez
Worker
Worker


Joined: Jan 22, 2007
Posts: 104

PostPosted: Fri Nov 16, 2007 12:24 pm Reply with quote

I am running treasury on one site without a problem, and on another site I can't get any donations to show up. Even if I manually enter them into the table, nothing shows. I don't get it.

When I run the test, everything passes. I have the IPN notifications setup at Paypal.com. Any clues as to what is going on???

I am using Godaddy on the site that is failing to update the Donat-o-meter block, and another provider on the one that is working.
 
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17077

PostPosted: Fri Nov 16, 2007 12:47 pm Reply with quote

Because you say nothing show up, that could mean there's a database/table issue. Use phpMyAdmin and manually examine the donations table to see if the entries are getting in. Also check your server error log to see if anything shows up there.
 
View user's profile Send private message
valdarez
PostPosted: Fri Nov 16, 2007 2:39 pm Reply with quote

I checked the database tables, and nothings there. I have no idea how to view the server logs with Godaddy, but I suppose nows a good time to figure that out. Smile

I'll insert a value into the table and see if it gets displayed properly. At least that way I'll know if it's getting stuff out of the table, and not putting it in.

There are a lot of posts about Godaddy not working with this module to to an PHP fsocket open() call or something along those lines.
 
Raven
PostPosted: Fri Nov 16, 2007 3:15 pm Reply with quote

The server error logs should be available via your control panel.
 
valdarez
PostPosted: Fri Nov 16, 2007 3:55 pm Reply with quote

I don't see them there. Perhaps it's on different versions? I noticed there's an option to upgrade to configuration 2.0. Looks like I'm on configuration 1.0.
 
Raven
PostPosted: Fri Nov 16, 2007 4:56 pm Reply with quote

Your hosting control panel does not give you access to your server logs?
 
valdarez
PostPosted: Fri Nov 16, 2007 6:32 pm Reply with quote

Not that I have seen. If it's there, I can't find it. My other provider puts the server logs into a separate directory that I can view via FTP or a TELNET session. Godaddy doesn't appear to do that either. Sad

I did updated the database, and the Donat-o-meter is displaying the data properly. So whatever the problem is, it has to do with the IPN functionality. For whatever reason, it's not updating the tables.
 
Raven
PostPosted: Fri Nov 16, 2007 8:24 pm Reply with quote

It's not an IPN issue if manual entries aren't making it into the table because Paypal isn't called for manual entries. You are having some kind of a MySQL issue. Your server logs will tell you what the error is. See this post for another way of displaying the eror if it is a MySQL eror.
Only registered users can see links on this board! Get registered or login!
 
valdarez
PostPosted: Fri Nov 16, 2007 9:52 pm Reply with quote

I have a request in to determine how to view the server log files. I took a look at the sql_layer.php file and at line 289 it already has the following:

Code:
 if (mysql_errno()) { echo mysql_error()."<br />"; }


Doesn't that basically do what you wanted me to do? Only it's checking for an error number before it displays the error?
 
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Fri Nov 16, 2007 11:47 pm Reply with quote

If your host does not allow fsockopen() then your ipn script will die before it can update the database tables.

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
valdarez
PostPosted: Sat Nov 17, 2007 8:47 am Reply with quote

It doesn't look like GoDaddy gives you access to the server logs.

Code:
Server logs are not available to Shared Hosting accounts, you would need to have a Dedicated Server to have access to the raw log files. I apologize for any inconvenience this may cause. 


They claim you can make calls via that command gremmie:

Code:
Thank you for contacting Online Support. You are able to use fsockopen on any of our PHP-enabled hosting plans. All of our outgoing connections are made via a proxy server. Connections can only be made using HTTP and HTTPS. HTTPS connections will need to be made proxy aware. The proxy server IP address is ************ with connections made on port ****. I hope that this information is helpful in solving your connection problem. 


Think the 'proxy aware' bit it throwing off the code?
 
Gremmie
PostPosted: Sat Nov 17, 2007 12:50 pm Reply with quote

I would get yourself a Paypal developer account, which is a sandbox account for you to play in without doing any actual financial transactions. You can then setup a fake developer account and turn on IPN and point it at your script. You can then test it and figure out why it is not updating the tables. You will have to instrument the IPN script. It already has a log feature built into it, so make sure you have logging cranked to the max. See the Treasury admin panel for that.
 
Raven
PostPosted: Sat Nov 17, 2007 2:09 pm Reply with quote

Get a new host. Their policy sucks.
 
valdarez
PostPosted: Sun Nov 18, 2007 10:20 am Reply with quote

I tried to GoDaddy once before, but had to switch due to poor response times, and their horrible customer support. I thought I would try them out again and see if they had improved their operation. Response times (page views) are great, customer support is just ridiculously bad. Half the time I question whether or not they even speak the same language as me, much less have any working knowledge of the servers/configuration GoDaddy.com provides. The response I posted above was 5 messages into a simple question that should have had one response.

Back to the problem at hand. Can you tell me what I should be looking for in the logs? I'm sure I can ask them to go through the logs for me and report their findings.

Gremmie, what do you mean by 'instrument the IPN script'?

If worse comes to worse, then I will change providers, but I would prefer to do that only as a last resort.
 
Raven
PostPosted: Sun Nov 18, 2007 1:14 pm Reply with quote

Your problems would melt away with Raven Web Hosting RavensScripts
 
Gremmie
PostPosted: Sun Nov 18, 2007 1:46 pm Reply with quote

valdarez wrote:

Gremmie, what do you mean by 'instrument the IPN script'?


It's a fancy phrase for debug it. Since paypal is actually calling your script you can't just add echo statements because only paypal would see those. There is support in the script for a log file. You'd have to add a few lines of code in there to open a log file, set the resource equal to $lp, and then the ipn script will write debug info to it.

I would double check your host on their claim that they are allowing remote socket connections. Write a small test script to open a socket to a remote host (like say a TeamSpeak, Ventrilio, or Gaming Server) and see if that works.

But I am with Raven on this one. It should not be this hard. It is probably the host.
 
valdarez
PostPosted: Sun Nov 18, 2007 4:25 pm Reply with quote

You know, I seem to recall them not allowing it. I think last time I was trying to run a node that showed our TeamSpeak server status, and it wouldn't allow it. I'm almost 99% certain that's why I switched the first time.

GoDaddy sucks. Lesson learned.
 
valdarez
PostPosted: Mon Nov 19, 2007 2:58 pm Reply with quote

Ok... I thought I'd try my hand at this to see if I could get it to work. I found some code to make things proxy aware, and I tried modifying it, but it doesn't seem to be working. I'm not a PHP developer by trade, can someone take a look at this code and tell me why it might be failing? (Note I have the IP/Port set for the proxy/port of my server).

Code:
$proxy_name = '11.111.111.111'; //insert your own proxy address here

$proxy_port = 1111;

$fp = fsockopen($proxy_name, $proxy_port);
if (!$fp)
{
   dprt("FAILED to connect to PROXY SERVER", _ERR);
   return false;
}

fputs($fp, "GET Only registered users can see links on this board! Get registered or login! HTTP/1.0\r\nHost: $proxy_name\r\n\r\n");
 
Raven
PostPosted: Mon Nov 19, 2007 3:50 pm Reply with quote

Try this script. You don't need to make any changes at all.
Code:
<?php

//
// This example shows a simple, one-shot HTTP client. It simply connects to a page, submits a HEAD request, echoes the reply, and exits.
//
error_reporting(E_ALL);

echo "<h2>TCP/IP Connection</h2>\n";

/* Get the port for the WWW service. */
$service_port = getservbyname('www', 'tcp');

/* Get the IP address for the target host. */
$address = gethostbyname('google.com');

/* Create a TCP/IP socket. */
echo "<u><b>Attempting to create a socket ...\n<br /></b></u>";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n<br />";
} else {
    echo "OK.\n<br /><br />";
}

echo "<u><b>Attempting to connect to '$address' on port '$service_port' ...<br /></b></u>";
$result = socket_connect($socket, $address, $service_port);
if ($result === false) {
    echo "socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "\n<br />";
} else {
    echo "OK.\n<br /><br />";
}

$in = "HEAD / HTTP/1.1\r\n";
$in .= "Host: Only registered users can see links on this board! Get registered or login!
$in .= "Connection: Close\r\n\r\n";
$out = '';

echo "<u><b>Sending HTTP HEAD request ...\n<br /></b></u>";
socket_write($socket, $in, strlen($in));
echo "OK.\n<br /><br />";

echo "<u><b>Reading response ...\n\n<br /></b></u>";
while ($out = socket_read($socket, 2048)) {
    echo nl2br($out);
}

echo "<b><u>Closing socket ...<br /></b></u>";
socket_close($socket);
echo "OK.\n\n<br />";
?>
 
valdarez
PostPosted: Mon Nov 19, 2007 4:15 pm Reply with quote

I received the following error:

fatal error: Call to undefined function: socket_create() in...
 
Raven
PostPosted: Mon Nov 19, 2007 4:49 pm Reply with quote

And so you have your answer.

This what you should have seen

TCP/IP Connection

Attempting to create a socket ...
OK.

Attempting to connect to '72.14.207.99' on port '80' ...
OK.

Sending HTTP HEAD request ...
OK.

Reading response ...
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=91a86968f474a5d9:TM=1195509234:LM=1195509234:S=Q0Ra5ZqDicqC81bu; expires=Wed, 18-Nov-2009 21:53:54 GMT; path=/; domain=.google.com
Server: gws
Content-Length: 0
Date: Mon, 19 Nov 2007 21:53:54 GMT
Connection: Close

Closing socket ...
OK.
 
warren-the-ape
Worker
Worker


Joined: Nov 19, 2007
Posts: 196
Location: Netherlands

PostPosted: Tue Nov 20, 2007 12:42 pm Reply with quote

Wow great stuff can be found at this forum Very Happy


valdarez wrote:
I am running treasury on one site without a problem, and on another site I can't get any donations to show up. Even if I manually enter them into the table, nothing shows. I don't get it.

When I run the test, everything passes. I have the IPN notifications setup at Paypal.com. Any clues as to what is going on???



At our website/forum we have this 'problem' for ages now.

After reading this topic i succesfully upgraded from 1.0 to 1.1 - No result
Let the root owner (im 1 of the administrators) enable IPN tracking in his PayPal account - No result
Manually inserting through Treasury Financial Register - No result


- PayPal payments are received perfectly
- IPN test works perfectly
- even the script that Raven posted above works perfectly Bang Head Sad


Could this be something in the database? If so what could it be and where or what do i have to look for?
 
View user's profile Send private message
Raven
PostPosted: Tue Nov 20, 2007 1:20 pm Reply with quote

I would try this - it usually reveals or eliminates the problem.

First of all determine if either table is getting updated. If neither is getting updated then apply the logic presented here to both tables. The 2 tables are transactions and translog. Basically you are going to trap the SQL statements and then use phpMyAdmin to manually execute the statements interactively to see if they work or not.

The line numbers may vary but you'll find the code w/o any problem.

Edit ipnppd.php

Code:
====[FIND]====

Line 177 :          $insertSQL = sprintf("INSERT INTO transactions (`txn_id`,`business`,`item_name`, `item_number`, `quantity`, `invoice`, `custom`, `memo`, `tax`, `option_name1`, `option_selection1`, `option_name2`, `option_selection2`, `payment_status`, `payment_date`, `txn_type`, `mc_gross`, `mc_fee`, `mc_currency`, `settle_amount`, `exchange_rate`, `first_name`, `last_name`, `address_street`, `address_city`, `address_state`, `address_zip`, `address_country`, `address_status`, `payer_email`, `payer_status`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $_POST['txn_id'],$_POST['business'],$_POST['item_name'],$_POST['item_number'],$_POST['quantity'],$_POST['invoice'],$_POST['custom'],$_POST['memo'],$_POST['tax'],$_POST['option_name1'],$_POST['option_selection1'],$_POST['option_name2'],$_POST['option_selection2'],$_POST['payment_status'],strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])),$_POST['txn_type'],$mc_gross,$mc_fee,$_POST['mc_currency'],$_POST['settle_amount'],$_POST['exchange_rate'],$_POST['first_name'],$_POST['last_name'],$_POST['address_street'],$_POST['address_city'],$_POST['address_state'],$_POST['address_zip'],$_POST['address_country'],$_POST['address_status'],$_POST['payer_email'],$_POST['payer_status']);

====[ADD AFTER]====
die('<br /><br />Line # '.__LINE__.'$insertSQL = '.htmlentities($insertSQL).'<br /><br >');

Now, copy that line of code and get into phpMyAdmin. Select your database and then click the SQL tab at the top of the screen. Paste the copied line in the window and click GO. If it doesn't load then phpMyAdmin will show the MySQL error. Continue fixing the error and rerunning until successful. Once successful in phpMyAdmin delete or comment out the DIE() line and try your script again. If it runs/works then you're all set. If not, then goto the next step. Make sure that you have commented out or removed the DIE() step.

Code:
====[FIND]====

Line 203 :          $insertSQL = sprintf("INSERT INTO transactions (`txn_id`,`business`,`item_name`, `item_number`, `quantity`, `invoice`, `custom`, `memo`, `tax`, `option_name1`, `option_selection1`, `option_name2`, `option_selection2`, `payment_status`, `payment_date`, `txn_type`, `mc_gross`, `mc_fee`, `mc_currency`, `settle_amount`, `exchange_rate`, `first_name`, `last_name`, `address_street`, `address_city`, `address_state`, `address_zip`, `address_country`, `address_status`, `payer_email`, `payer_status`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $_POST['txn_id'],$_POST['business'],$_POST['item_name'],$_POST['item_number'],$_POST['quantity'],$_POST['invoice'],$_POST['custom'],$_POST['memo'],$_POST['tax'],$_POST['option_name1'],$_POST['option_selection1'],$_POST['option_name2'],$_POST['option_selection2'],$_POST['payment_status'],strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])),$_POST['txn_type'],$_POST['mc_gross'],$_POST['mc_fee'],$_POST['mc_currency'],$_POST['settle_amount'],$_POST['exchange_rate'],$_POST['first_name'],$_POST['last_name'],$_POST['address_street'],$_POST['address_city'],$_POST['address_state'],$_POST['address_zip'],$_POST['address_country'],$_POST['address_status'],$_POST['payer_email'],$_POST['payer_status']);

====[ADD AFTER]====
die('<br /><br />Line # '.__LINE__.'$insertSQL = '.htmlentities($insertSQL).'<br /><br >');

Now, copy that line of code and get into phpMyAdmin. Select your database and then click the SQL tab at the top of the screen. Paste the copied line in the window and click GO. If it doesn't load then phpMyAdmin will show the MySQL error. Continue fixing the error and rerunning until successful. Once successful in phpMyAdmin delete or comment out the DIE() line and try your script again. If it runs/works then you're all set. If not, then goto the next step. Make sure that you have commented out or removed the DIE() step.

Code:
====[FIND]====

Line 256 :    $sql = "INSERT INTO translog VALUES ('','" . strftime('%Y-%m-%d %H:%M:%S',mktime()) . "', '"
       . strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])) . "','" . addslashes($log) . "')";

====[ADD AFTER]====
die('<br /><br />Line # '.__LINE__.'$sql = '.htmlentities($sql).'<br /><br >');


If all these tests work in phpMyAdmin then we'll have to come up with something else.
 
warren-the-ape
PostPosted: Sat Nov 24, 2007 8:41 am Reply with quote

Thnx for the response Raven, unfortunately im a big noob with things like SQL and phpmyadmin (dont even know how to start it xD).


But the 'problem' seems to be no problem any longer.
I think, in our case, not updating the PayPal account (including the ipnppd path) was the reason it didnt work.


There were also a few mixups between me and the account holder cause he didnt know that only donations made through the site will show up Rolling Eyes

Anyway, im glad its working again Cool
 
valdarez
PostPosted: Thu Nov 29, 2007 1:51 pm Reply with quote

Looks like GoDaddy responded to my complaint about the open socket not working. This was their reply...

"To open connections to other site requires that you use CURL."

Does CURL mean anything to you guys?
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Nuke Treasury

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©