  Using the Keldysh-Usadel formalism, we theoretically study the $0$-$\pi$
transition profiles and current-phase relations of magnetic $SFSFS$ and
$SFSFFS$ Josephson nanojunctions in the diffusive regime. By allowing the
magnetizations of the ferromagnetic layers to take arbitrary orientations, the
strength and direction of the charge supercurrent flowing through the
ferromagnetic regions can be controlled via the magnetization rotation in one
of the ferromagnetic layers. Depending on the junction parameters, we find
opposite current flow in the ferromagnetic layers, revealing that remarkably
such configurations possess well-controlled $0$- and $\pi$-states
simultaneously, creating a three-terminal $0$-$\pi$ spin switch. We demonstrate
that the spin-controlled $0$-$\pi$ profiles trace back to the proximity induced
odd-frequency superconducting correlations generated by the ferromagnetic
layers. It is also shown that the spin-switching effect can be more pronounced
in $SFSFFS$ structures. The current-phase relations reveal the important role
of the middle $S$ electrode, where the spin controlled supercurrent depends
crucially on its thickness and phase differences with the outer $S$ terminals.
