"Blessed is the man that endureth temptation: for when he is tried, he shall receive the crown of life, which the Lord hath promised to them that love him." James 1:12
We have all fallen for the evil schemes of temptation. Temptation in itself is not sinful, but the act of following through with the temptation is. All forms of temptation are Satan induced. All temptations to the Christian are God filtered. But God does not tempt us. "Let no man say when he is tempted, I am tempted of God: for God cannot be tempted with evil, neither tempteth he any man:" James 1:13. Our job during a time of temptation is to find the proper channel to focus on. We can focus on the temptation itself, or we can focus on our greater passion, which to the saved, is the Lord.
Matthew 26:41 says "Watch and pray, that ye enter not into temptation: the spirit indeed is willing, but the flesh is weak.". The best thing we can do when temptation enters into our life is to "watch and pray". Pray to God, focus on God, talk to God, sing a song to God, have love enough for God that you do not want to displease Him in your actions or thoughts. Be in constant communion with God. God allows temptations to come into our life so that we think on Him more. For the Spirit of God is always willing, even if our flesh is weak.
There is nothing in your life that God doesn't already know about. There are no secret sins with God and confessing them to someone here will not help you with your standing with God. Imagine someone does something to you that you don't like, and instead of coming and apologizing to you directly, they go through a friend of theirs to relay the message to you. It would seem to you that they were too apologetic. We can go straight to God and apologize for sin for He has allowed us the mediator through Jesus Christ (1 Timothy 2:5).
David knew that his sin was not inflicting any cause toward anyone but God. "Against thee, thee only, have I sinned, and done this evil in thy sight: that thou mightest be justified when thou speakest, and be clear when thou judgest." Psalms 51:4 We must come to God directly and confess and forsake our sins. Whenever temptation comes into our life we can know that God has a way to lean on Him and a way for us to get away from it. 1 Corinthians 10:13 says "There hath no temptation taken you but such as is common to man: but God is faithful, who will not suffer you to be tempted above that ye are able; but will with the temptation also make a way to escape, that ye may be able to bear it.". Trust in God's will and love and you will be able to overcome any temptation that Satan tries to throw at you.