Get the current script name, add it as a new hidden input field to the login form. Then edit include/login.php and make proper adjustments to the func_header_location($redirect_to."/cart.php"); and the ..."/home.php" as these two files would need to be replaced with the new variable. Lets say the hidden input field name is prev_page you would setup the redirects in login.php like:
Code:
func_header_location($redirect_to.$prev_page);
hth.
