This is just my ramblings of the advice I give my friends. If you want more details on a subject comment and I will contact you if you leave your email.
This is a common problem among us nerdy guys. The main reason for this whole thing is that you aren't yourself you get needy and you get weird and not independent. Girls are looking for a guy that is pretty much a solid rock in his personality and can stand alone so they can lean on you. So if this is your problem take three months and if you can't go without flirting you have a problem and I can try to help. If you can make it then it has something to do with how you act whether you are two faced or that you or that you are just not the right guy for them.
So back to the ones with a problem what you need to do is start seeing who you are without girls. Decide that you don't need them. You can do this by being alone a lot of self evaluation and even going to friends and asking them for help to see what they see you as. If all you are is a relationship ask them to help you with it if they truly are your friend then they will help. Really the best ones to ask is the friends that are girls cause they give the best help and opinions. This only works if you are willing to be brutally honest with the facts of things. That is my basic advice on the matter I give better advice when I know the situation.
The trick for getting rid of addictions is really annoying and you really have to want to quit. What you do is first evaluate do I have a strong reason for stopping if so you are at a good start. If not listen up. You need to find someone to talk to like a friend, a crush, a girlfriend, a parent, and or wife. I bet they can give you some pretty good reasons for quitting. Then once they give you a reason or if they are your reason then let's continue. The next step is the hard part you have to tell people about it and have them help keep you away from it. Also you need to make sure that you tell yourself instead of it being good that whenever you are reminded of it sight, smell, taste, feel,or sound tell yourself that it is bad and be disgusted at it. Then once you quit keep yourself away from even the slightest temptation of it cause all it takes is a little bit of it to start all over again. That is the basics for everyone but the nit picky details you decide for yourself.