If at any time after the commencement of any action by a resident of this state, he or she becomes non-resident; or if in any case the court is satisfied that any plaintiff is unable to pay the costs of the action, or that he or she is so unsettled as to endanger the officers of the court with respect to their legal claims, it shall be the duty of the court, on motion of the defendant or any officer of the court, to order the plaintiff, on or before a day in such order stated, to give security for the payment of costs in such action. If such plaintiff neglects or refuses, on or before the day in such order stated, to file a written instrument of some responsible person, being a resident of this state, whereby he or she shall bind himself or herself to pay all costs which have accrued, or may accrue in such action, the court shall, on motion, dismiss the action. The defendant or officer making such motion shall file therewith his or her affidavit, or the affidavit of some credible person, stating that he or she has reason to believe, and does believe, that in case such action is prosecuted to a conclusion, a judgment will be entered against such plaintiff for such costs.
735 ILCS 5/5-104