A man tried to sell hard drugs to a police officer at a music festival last year.
Christy Littleford offered ecstasy to the plain clothes officer as he patrolled inside the Sunrise Festival at Chapmanslade in May.
And when the 21-year-old was searched he was found to have a cocktail of other drugs on him.
As well as 11 ecstasy tablets, one pill of a similar drug, some psilocin, the active ingredient in magic mushrooms, and he also had just over a gram of cannabis.
Littleford, of Brynland Avenue, Bristol, pleaded guilty to possessing a class A drug with intent to supply and offering to supply the drug.
He also admitted two counts of simple possession of a class A drug and one of class B drug when he was arrested on Thursday, May 30.
The case, heard at Swindon Crown Court, was adjourned to Friday, January 31 and Littleford was released on bail on condition he does not go within a mile of music festivals and stays out of Wiltshire.