Jump to content

paybox.php - where is the problem?


jack9876

Recommended Posts

Hi All,

Believe me,I don't take asking for help on web forums lightly,but I am at the end of my tether struggling with this.

In brief,I moved a friend's OSCommerce to a new server.So,Paybox puts the site into test mode specific to the site (since Paybox was running at one point on the old set up).Paybox also told us we should upgrade to modulev2.cgi with a file revised with PBX variables,as opposed to the old IBS.

Ever since then,I have tried and tried about thirty different files,combinations of variables,modes you name it,nothing works.The much sought-after paybox module version 3 code below gives an immediate T_String error.This is why I put a semi-colon after PBX_IDENTIFIANT.I'm quite certain that wasn't the correct thing to do,but at least it got us through the checkout process,at which point we get an error code -7 (missing mandatory variable).
Now,since I *know* I have tried every permutation known to man to get this to work,can anyone tell me *why* the file throws an unexpected T_String error?
What I mean is - is the error in this file,can anyone see it?,or could it be (horror of horrors) even deeper within the OSCommerce source?

Thank you so so much for your time.

[quote]<?php
/*
Contribution by Emmanuel Alliel <manu@maboutique.biz>

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

class paybox {
var $code, $title, $description, $enabled;

// class constructor
function paybox() {
global $order;

$this->code = 'paybox';
$this->title = MODULE_PAYMENT_PAYBOX_TEXT_TITLE;
$this->description = MODULE_PAYMENT_PAYBOX_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_PAYBOX_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_PAYBOX_STATUS == 'True') ? true : false);

if ((int)MODULE_PAYMENT_PAYBOX_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_PAYBOX_ORDER_STATUS_ID;
}

if (is_object($order)) $this->update_status();

$this->form_action_url = MODULE_PAYMENT_PAYBOX_CGI;
}

// class methods
function update_status() {
global $order;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYBOX_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYBOX_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}

//Haisoft : ces trois lignes doivent être commentées si le module ne s'affiche pas dans la page de paiement
if ($check_flag == false) {
$this->enabled = false;
}
//Haisoft (fin)
}
}

function javascript_validation() {
return false;
}

function selection() {
return array('id' => $this->code,
'module' => $this->title);
}

function pre_confirmation_check() {
return false;
}

function confirmation() {
return false;
}

function process_button() {
global $order;

$process_button_string = tep_draw_hidden_field('PBX_MODE', '1') .
tep_draw_hidden_field('PBX_SITE', 'xxxxx') .
tep_draw_hidden_field('PBX_RANG', 'xx') .
tep_draw_hidden_field('PBX_IDENTIFIANT', 'xxxxxx');
tep_draw_hidden_field('PBX_TOTAL', (round($order->info['total'],2)) * 100) .
tep_draw_hidden_field('PBX_DEVISE', '978') .
tep_draw_hidden_field('PBX_CMD', $order->customer['email_address'] . '|' . $order->info['total']) .
tep_draw_hidden_field('PBX_PORTEUR', $order->customer['email_address']) .
tep_draw_hidden_field('PBX_RETOUR', 'PBX_TOTAL:M;PBX_CMD:R;auto:A;trans:T') .
tep_draw_hidden_field('PBX_ANNULE', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'NONSSL', true)) .
tep_draw_hidden_field('PBX_REFUSE', tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'NONSSL', true)) .
tep_draw_hidden_field('PBX_EFFECTUE', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false)) .
tep_draw_hidden_field(tep_session_name(), tep_session_id()) .
tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_post=true,cb_flds=' . tep_session_name());

return $process_button_string;
}

function before_process() {
global $HTTP_POST_VARS;

if ($HTTP_POST_VARS['valid'] == 'true') {
if ($remote_host = getenv('REMOTE_HOST')) {
if ($remote_host != 'paybox.com') {
$remote_host = gethostbyaddr($remote_host);
}
if ($remote_host != 'paybox.com') {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $HTTP_POST_VARS[tep_session_name()] . '&payment_error=' . $this->code, 'SSL', false, false));
}
} else {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $HTTP_POST_VARS[tep_session_name()] . '&payment_error=' . $this->code, 'SSL', false, false));
}
}
}

function after_process() {
return false;
}

function get_error() {
global $HTTP_GET_VARS;

if (isset($HTTP_GET_VARS['message']) && (strlen($HTTP_GET_VARS['message']) > 0)) {
$error = stripslashes(urldecode($HTTP_GET_VARS['message']));
} else {
$error = MODULE_PAYMENT_PAYBOX_TEXT_ERROR_MESSAGE;
}

return array('title' => MODULE_PAYMENT_PAYBOX_TEXT_ERROR,
'error' => $error);
}

function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYBOX_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}

function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Paybox Module', 'MODULE_PAYMENT_PAYBOX_STATUS', 'True', 'Activer ce module Paybox ?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PBX_SITE', 'MODULE_PAYMENT_PAYBOX_PBX_SITE', '1999888', 'PBX_SITE fournit par Paybox', '6', '2', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PBX_RANG', 'MODULE_PAYMENT_PAYBOX_PBX_RANG', '99', 'PBX_RANG fournit par Paybox', '6', '3', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PBX_IDENTIFIANT', 'MODULE_PAYMENT_PAYBOX_PBX_IDENTIFIANT', '2', 'PBX_IDENTIFIANT fournit par Paybox', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('CGI Path', 'MODULE_PAYMENT_PAYBOX_CGI', 'http://www.maboutique.biz/cgi-bin/paybox.cgi', 'Chemin de votre module CGI fournit par Paybox', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYBOX_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYBOX_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAYBOX_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
}

function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
return array('MODULE_PAYMENT_PAYBOX_STATUS', 'MODULE_PAYMENT_PAYBOX_PBX_SITE', 'MODULE_PAYMENT_PAYBOX_PBX_RANG','MODULE_PAYMENT_PAYBOX_PBX_IDENTIFIANT', 'MODULE_PAYMENT_PAYBOX_CGI', 'MODULE_PAYMENT_PAYBOX_ZONE', 'MODULE_PAYMENT_PAYBOX_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYBOX_SORT_ORDER');
}
}
?>[/quote]


Link to comment
Share on other sites

Usually php will define which line the error occurred on or around.  If this could be highlighted it would make it easier to help define the problem.  If it is not available would it be possible to see the error in full, copied to here?

[code]
<?php
$process_button_string = tep_draw_hidden_field('PBX_MODE', '1') .
tep_draw_hidden_field('PBX_SITE', 'xxxxx') .
tep_draw_hidden_field('PBX_RANG', 'xx') .
tep_draw_hidden_field('PBX_IDENTIFIANT', 'xxxxxx');          //HERE
tep_draw_hidden_field('PBX_TOTAL', (round($order->info['total'],2)) * 100) .
tep_draw_hidden_field('PBX_DEVISE', '978') .
?>
[/code]

Where I've put //HERE there is a ; which should be a .

Thanks,

Dest
Link to comment
Share on other sites

I think you're right about the semi-colon...

I think this:
[code=php:0]tep_draw_hidden_field('PBX_IDENTIFIANT', 'xxxxxx');
[/code]

Should be:
[code=php:0]tep_draw_hidden_field('PBX_IDENTIFIANT', 'xxxxxx') . // notice the period, instead of semi-colon
[/code]

Regards
Huggie
Link to comment
Share on other sites

Thank you both so much for answering :D.

I just tried replacing the semi-colon with a fullstop and it's blank screening at checkout now,when you hit the cgi,I mean.It's not because errors are being routed directly to Apache's logs,btw.

I *think* I might have just discovered why.The SSL certs are messed up.Not thinking,I just tried to login to cPanel via https.Firefox prompted me that the SSL cert was issued for server.localdomain.com,but I was trying to establish a connection to my-friends-site.com."Security Error - Domain Name Mismatch"

That sounds screwed up to me,and don't incorrectly installed SSL certs cause blank screens on checkout process? It would certainly account for the fact that we have been unable to get anywhere with this.

@ Destruction.The unexpected T_String error occurred on the line below tep_draw_hidden_field('PBX_IDENTIFIANT', 'xxxxxx'); Line 84.

The referring file is checkout.php.I'd post that,but should I ask about the SSL certs first? The host did have problems installing the cert,and might have got confused because I sent him all the backups from the old site too - one of which was a localhost key...

I'm thinking the cert/key is mismatched.

Thank you guys! I actually feel like I'm getting somewhere now.I'll post back with my hosts response.The least I can do is note it here for anyone else in the same situation.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.