Jump to content


Photo

paybox.php - where is the problem?


  • Please log in to reply
3 replies to this topic

#1 jack9876

jack9876
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 October 2006 - 02:08 PM

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.

<?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.maboutiqu...-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');
}
}
?>





#2 Destruction

Destruction
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 18 October 2006 - 03:42 PM

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?

<?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') .
?>

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

Thanks,

Dest

#3 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 18 October 2006 - 03:46 PM

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

I think this:
tep_draw_hidden_field('PBX_IDENTIFIANT', 'xxxxxx');

Should be:
tep_draw_hidden_field('PBX_IDENTIFIANT', 'xxxxxx') . // notice the period, instead of semi-colon

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#4 jack9876

jack9876
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 October 2006 - 05:59 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users