Optimal control of one- and two-photon transitions with shaped femtosecond pulses and feedback