[eluser]Fierymind[/eluser]
Hi,
I have built complete billing and support system for web hosting business using CI, everything work great.
There is only 1 thing driving me crazy, may be its not related to CI, but you may share your thoughts in that:
In the last step of web hosting order process, a function prepares a URL of the credit card processor, set a value for session variable 'new_invoice_id' and go to credit card processor website
Code:
$payment_page = ".....";
$this->session->set_userdata('new_invoice_id',$invoice_id);
header('Location: '.$payment_page);
//end of function
after payment, the credit card processor redirect user back to another function in the same controller, here is the top part of it:
Code:
function new_paid($payment_method,$receipt_id) {
$invoice_id = $this->session->userdata('new_invoice_id');
if (!$invoice_id) {
exit('No Invoice ID provided');
}
//rest of order process ............
so if I could not get the $invoice_id from session, the program should halt and print 'No Invoice ID provided' or script will process the order and do many things.
in about 15% of orders, the user get the message 'No Invoice ID provided' AND in the same time order completed (order get status 'Piad' in MySQL db, create new receipt, send email, ..etc .. but does not show 'thank you' page, the output only 'No Invoice ID provided')!
and that means, the exit() executed and program continue to execute! further more, the value $invoice_id IS retrieved successfully and used to complete the order!
am I clear? .. here is again:
1. $invoice_id is retrieved from session correctly.
2. but
if (!$invoice_id) {exit();} executed (!?)
3. PHP continue to execute the function disregarding the called exit() and stopped just before last
$this->load->view()(!?)
any idea?