Salvation from eternal punishment is only received one way, through Jesus Christ (Jn.14:6). A person must recognize that he is a sinner, repent of his sins, realize that Christ died to pay his payment on the cross, and must ask Him to forgive him of his sins and be his Savior. A person must trust Christ and Christ alone for his salvation (His death, burial, and resurrection), for He is the only way (Acts 4:12).
A person does not need to “get his life right” with God before he can approach Him. The whole reason why man needs a Savior is because he cannot “get his life right” enough to find favor in God’s eyes, so he must let God do the work in him. On the other hand, when a person is saved, his works will change (Eph.2:8-10). The way of knowing if someone is saved or not is by looking at their works (Mt.7:20, Acts 26:20). Salvation is repentance from sin and faith towards God (1 Thes.1:9, Acts 20:21). Repentance is a change of mind that leads to a changed life. It is not the prayer that saves someone, but the decision of repentance and accepting God’s terms through Jesus Christ for salvation.