you could stay away from online gambling by keeping less money online. So even if you lose you don't lose much.
To stay away in gambling needs a lot of discipline, you need to be more focus on doing productive things that would affect your life in a positive way in the future and never gamble if you can't handle the stress it brings unto you.
Yeah, dicilpline and commitment to yourself to stop gambling and i sucess doing that and makes me to not gambling anymore. Do something outside from your home is a good one too.
Going with your friends and do productive things would make you stay away in gambling. To be honest, I was once addicted in gambling but with the help of my friends and family I was able to quit it completely.