[eluser]cehennem[/eluser]
Hey there,
I'm developing an e-commerce web page nowadays. Today I have faced a very interesting problem-bug or whatever bullshit it is.
There is a function in a model file that draw money from user's credit card information.
Code:
function draw_money() {
$bank = new Posnet();
$example_card['ccno'] = '4553591000148024'; # example valid ccno
$example_card['expdate'] = '1303';
$example_card['cvc'] = '000';
$example_card['orderid'] = rand(100000,999999);
$example_card['amount'] = '3500';
$example_card['currencycode'] = 'YT';
$example_card['instnumber'] = '00';
$bank->DoSaleTran(
$example_card['ccno'],
$example_card['expdate'],
$example_card['cvc'],
$example_card['orderid'],
$example_card['amount'],
$example_card['currencycode'],
$example_card['instnumber']
);
}
the function above takes about 10 secs to complete the process. its all ok so far. but now, there is also another function in this model that formats the card data to be valid for the draw-money process. when I use this function in draw_money() function, the page gives Timeout message with page title of "500 Internal Server Error". Read comments to see differences.
Code:
function format_card_data($vars) {
$vars['ccno'] = str_replace('-', '', $vars['ccno']);
return $vars;
}
function draw_money() {
$bank = new Posnet();
$example_card['ccno'] = '4553-5910-0014-8024'; # example invalid ccno
$example_card['expdate'] = '1303';
$example_card['cvc'] = '000';
$example_card['orderid'] = rand(100000,999999);
$example_card['amount'] = '3500';
$example_card['currencycode'] = 'YT';
$example_card['instnumber'] = '00';
# strip non-numeric chars. from ccno
$example_card = $this->format_card_data($example_card); # <<<------------
$bank->DoSaleTran(
$example_card['ccno'],
$example_card['expdate'],
$example_card['cvc'],
$example_card['orderid'],
$example_card['amount'],
$example_card['currencycode'],
$example_card['instnumber']
);
}
The error message:
Quote:Request Timeout
This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase 'Connection Timeout'.
that because the timeout of the script execution is defined 30 sec in the conf file.
Thats very intersting I got this message just because of I used a simple function to strip "-" character in the credit card.