Well I would say it's another script causing it because you aren't sending the SET command to NickServ in this one. Also, you should be using $server instead of $network in this.
Either this
if ($network == your_network_name)
or this
if ($server == your_server_name)