Actually, $chan would have to be replaced with the actual channel name or with a variable that contains the channel name. If there's more than one channel possible, then the code would have to be re-worked to check for all of the possible channels (and no, in this case putting mnultiple channels into a variable then using the variable directly would not work)