Why don't I have any problems getting an erection when watching porn or with my girlfriend, but do have problems when I am with a one night stand?

Erectile Dysfunction. The explanation is simple. When you are looking at pornography or with a girlfriend you know, you are relaxed. Going out with someone as a "one night stand" means you are nervous and anxious (as most people would be) since you are doing something very intimate with someone you don't know.
'it's all mental' You have 'performance anxiety' which sometimes is made worse with those 'extra few drinks' @ the bar.
Couple possibilities. You may be unable to perform in those circumstances due to several reasons, including anxiety, nervousness, guilt, and/or alcohol intake, all of which may cause you to have trouble attaining an erection. If this becomes more serious over time, see an urologist or pcp.