Moonlighting is illegal as this violates the policy of company. Working in more than one company and channelising confidential information to the other company is illegal.