<?php

/*

  osCommRes, Services Online
  http://www.oscommres.com

  Copyright (c) 2005 osCommRes

  Released under the GNU General Public License
*/
// Set flag that this is a parent file
	define( '_FEXEC', 1 );
  require('includes/application_top.php');

  $input_params="";
  if (isset($HTTP_GET_VARS['error_message'])) $error_mes = $HTTP_GET_VARS['error_message'];
  else if (isset($HTTP_GET_VARS['payment_error'])) $error_mes=$HTTP_GET_VARS['payment_error'];
  else if (isset($HTTP_GET_VARS['error'])) $error_mes = $HTTP_GET_VARS['error'];
  else $error_mes = 'Unknown error';

  if ($error_mes!="") {
	  //error count start
			/*$error_count+=1;
			tep_set_session_value('error_count',$error_count);
		  	$exp_count=3;
	   	if(defined('CHECKOUT_FAIL_RETRY')) 	$exp_count=(int)CHECKOUT_FAIL_RETRY;
	       if($HTTP_SESSION_VARS['error_count']>$exp_count){
		   	tep_session_destroy();
		   	tep_session_unregister('login_id');
		  		tep_session_unregister('login_firstname');
			   tep_session_unregister('login_groups_id');
			   tep_session_unregister('login_groups_type');
			   tep_session_unregister('login_email');
			   tep_session_unregister('top_admin_email');
		     	tep_redirect(tep_href_link(FILENAME_LOGIN));	
	   	 }*/
   //error count end 
  }
  $input_params.=tep_get_all_get_params(array(),true); 
  if (tep_session_is_registered('payment_page')){
    if ($payment_page=='default'){
	//$input_params="error_message=payment_error";
       tep_redirect(tep_href_link(FILENAME_CREATE_ORDER_NEW,$input_params . 'cID=' . $customer_id . '&payment_error_flag=yes','SSL'));
    } else if ($payment_page=='refund'){
       tep_redirect(tep_href_link(FILENAME_REFUND_RESERVATIONS,$input_params . $HTTP_SESSION_VARS['payment_params'],'SSL'));
    } else if ($payment_page=='waitlist'){
       tep_redirect(tep_href_link(FILENAME_PENDING_WAITLIST_PAYMENTS_CONFIRM,$input_params . $HTTP_SESSION_VARS['payment_params'],'SSL')); 
	} else if ($payment_page=='wallet'){
       tep_redirect(tep_href_link(FILENAME_WALLET_PAYMENT,$input_params,'SSL'));
	}
  }
  tep_redirect(tep_href_link(FILENAME_FORBIDEN));
?>
