The accused, Waheed Dehinde, lives at No. 28 Ilo Awella Road, Ota, the News Agency of Nigeria (NAN) reports.
Chief Magistrate Funke Odubanjo ordered that Dehinde should be remanded in prison pending the presentation of facts and sentences.
Odubanjo later adjourned the case till November 30.
The prosecutor, Cpl. Abdulkareem Mustapha, told the court that the accused and others still at large, committed the offence on November 17 at about 3.20 p.m. at Ota Magistrates Court, Ogun.
Mustapha said the offences contravened Sections 467 and 516 of the Criminal Code, Laws of Ogun, 2006.