Looks like I got this working with Hair Guy's code.
Here's what Im using for 3.4.10
Code:
# new login mod
$mysite_pattern = '~^(http://'.$xcart_http_host.'|https://'.$xcart_https_host.')~';
if($login_type=="C" && !func_is_cart_empty($cart)) {
if (preg_match('/\/cart\.php\?mode=(auth|checkout)/', $_SERVER['HTTP_REFERER'])) {
# go to next step in checkout
func_header_location("../$redirect/cart.php?mode=checkout");
} elseif (preg_match($mysite_pattern, $_SERVER['HTTP_REFERER'])) {
# go back to where we were before login
func_header_location(" ".$_SERVER['HTTP_REFERER']);
} else {
func_header_location("../$redirect/cart.php");
}
} elseif ( ($config["General"]["default_pwd"]=="Y") and (count($default_accounts)>0) and $admin_safe_mode==false) {
echo"<SCRIPT language='JavaScript'>
alert('Default passwords for one or more administrator/provider accounts are not changed. We recommend you to change default passwords for security reasons. The default X-cart accounts$default_accounts_string!');
self.location='$to_url';
</SCRIPT>If you see this message it means that your browser doesn't support Javascript or it is disabled. Please enable JavaScript in your browser settings for proper X-Cart functionality.";
x_session_save();
exit;
}
else {
if (preg_match($mysite_pattern, $_SERVER['HTTP_REFERER'])) {
# go back to where we were before login
func_header_location(" ".$_SERVER['HTTP_REFERER']);
} else {
func_header_location("../$redirect/home.php");
}
}
}
# here ends new login mod