What do you want to know?
The preg_match() looks to see if the channel name is in the following format:
"#" followed by any number of text/numeric characters, but NO symbols. What they are doing is if preg_match() fails (or equates to FALSE) then do what's within the if() brackets.
#chat <-- fulfulls preg_match()
#blah0189 <-- fulfulls preg_match()
#na&ane <-- doesn't match
So, your code basically says:
If the preg_match() equates to false, set the $msg variable to a string which states why. Set the $badlist array. $badlist are channel names that are prohibited. The for() loop takes the length of $badlist array and for each item in the $badlist array, If $_POST channel is equivilant to the $badlist array item, then ereg equates to TRUE and sets the $msg variable.
Later in the code, it checks to see if $msg is empty, if not, then it displays the error and exits.
Now, the whole for(if(ereg("".strtolower....) stuff can possibly be circumvented with a simple:
if(in_array($_POST['CHANNEL'], $badlist))
{
$msg .= blah blah blah;
}
~Brett