Miranda Cosgrove Stalker Goes Cyber Ordered Off Social Media

6/10/2015 12:50 AM PDT

The man convicted of stalking Miranda Cosgrove got a big break when the psych hospital where he was confined gave him a pass to leave for a few days ... and guess what he went and did?

Joshua Stockton got a furlough a week ago ... it was a reward for good behavior. We're told he went to his parents' home but almost immediately jumped on the computer and started contacting Miranda's friends trying to find out anything he could about the actress.

Miranda's friends told her they were contacted and she immediately got in touch with authorities.

Stockton's in trouble, because he was ordered in October to stay 100 yards away from Miranda and not to contact anyone for the purpose of harassing her.  

Stockton was hauled into court and the judge ordered him to stay off all social media for a year. The judge also said one more misstep and he was going to prison for 4 years.

Stockton's back in the psych facility.