The US attacked Afghanistan, generally with world wide approval (including close allies/neighbors) because those who attacked America planned the attack under the were under the protection of the Afghan government.
If (and when) al-qaeda attacks US again, it is going to be the government of Pakistan that will be harboring the terrorists and who will be on the receiving end of America's rage. It doesn't matter who is president.