You CAN do this. I know that feeling, I have been there before. I have lost and regained! But the thing that you need to change is your thinking. Diets don't work, you need a lifestyle change. You need a new way of eating that will be maintainable for the rest of your life! That's how you will be successful. That's what I'm doing this time moreso than last time. I am eating now, how I always will be. I try to make healthier choices, I don't always succeed, but I fit it into my calories if I do make bad choices. I will not deprive myself of foods I like because I know it will not be sustainable in the long term. You don't have to go that route, but what you need to do is to find a way to eat that is healthier, proper portions and something you can do for ever!
Don't go down the downward spiral! I have been through that stupid cycle.... eat bad, get depressed about it, eat bad, gain, get depressed about it, eat bad, gain, get depressed.... etc. etc.... and it's just not worth it. You will have bad days, I will have bad days, but the thing I'm changing is not letting myself think, I did bad this meal, might as well do bad the whole day. Oh I did bad yesterday, whatever, I'll eat what I want today.. NO! That can't be how I think anymore, and same to you! You do bad one meal/one day, the next day needs to be a refresh/restart! It needs to be, ok... how will I do better today!
Yeah sometimes it's not easy to change your way of thinking, but that's how it'll work in the long run. Maybe you should see a therapist or someone like that to talk things through and get to the bottom of why you are sabotaging yourself. They can give you help with how to change those patterns/behavious and understand more about yourself. I know if I was still doing that to myself, I'd go too!
Ok enough from me! I hope I didn't upset you with what I said, but I really hope it helps. So after reading this, go workout!!!

Or plan your food for the next day so you know what you are eating and won't stray! You can and will do this, but it starts with you! Don't get in your own way!!!