Global existence and nonexistence of solutions for second-order nonlinear differential equations