<?php
$channel = @$_GET['channel'];
$channel = rtrim($channel,'/');
$channel = ltrim($channel,'/');

if(!$channel) {
        $channel = "irchelp";
}


echo "<!DOCTYPE html>\n";

echo "<!-- Please do not use the engine url directly, you're being loadbalanced over multiple servers, we reserve the right to change the engine name at any point\n";
echo "At this point, you can call webchat.krey.net/channelname   Do not include the # before the channel name\n";
echo "For example, to join #irchelp you will use http://webchat.krey.net/irchelp\n";
echo "Should you need any customisations that are not possible at this moment, contact Egg on irc or email egg@krey.net -->\n";


echo "<HTML><HEAD><TITLE>#";

echo htmlspecialchars($channel);

echo " webchat</TITLE></HEAD>";
echo "<FRAMESET ROWS=\"*\">";

echo "<FRAME SRC=\"https://nexus.webchat.krey.net/?c=startup%20join%20%23";

echo urlencode($channel);

echo "\" NAME=\"chatframe\"></FRAMESET></HTML>";
