You got your sequence wrong. You're assuming %channels already has a value way before it is given one.

[color:green]; the @ makes sure you're opped (can't kick if you're not anyway)[/color]
[color:green]; at the same time it also prevents from triggering when you join, thus saving if statements[/color]
on @*:JOIN:#mychannel: whois $nick
[color:green]; raw 319 catches the channels info[/color]
raw 319:*: {
  if (#porn isin $2-) ban -k #mychannel $2 3 get lost

DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius