Skip to content

Instantly share code, notes, and snippets.

@MaleXachi
Created May 23, 2013 21:46
Show Gist options
  • Save MaleXachi/5639690 to your computer and use it in GitHub Desktop.
Save MaleXachi/5639690 to your computer and use it in GitHub Desktop.
This is a method to generate iframe with lightIRC parameters, which it make easier for other users to add your chat for their website. This script works as well, but i had not to much time, so it's maybe not perfectly, so post a comment, if you want to make somethings better. Please click on star, if you have a github account and if you like thi…
<!DOCTYPE html>
<head>
<title>Simple lightIRC iFrame Generator By MaleXachi</title>
<meta charset="utf-8">
<style>
body{font-family:Verdana;font-size:12px;width:920px;margin:10px auto 0;margin-bottom: 20px;}
h2{font-size: 14px;}
</style>
</head>
<body>
<h2>lightIRC - iFrame Code Generator - By MaleXachi</h2>
<hr>
<p>Play around with the options at the bottom. You can edit the IFrame code yourself by adding more parameters. See the complete list in the <a href="http://redmine.lightirc.com/projects/lightirc/wiki/Customization_parameters" target="_blank">Wiki</a>.</p>
<?php
$Domain = strip_tags($_POST['Domain']);
$Host = strip_tags($_POST['Host']);
$Width = strip_tags($_POST['Width']);
$Height = strip_tags($_POST['Height']);
$Nick = strip_tags($_POST['Nick']);
$Channel = strip_tags($_POST['Channel']);
$Language = $_POST['Language'];
switch($Language){case "en": case "nl": case "bd": case "bg": case "br": case "cz": case "da": case "de": case "el": case "es": case "et": case "fr": case "hu": case "it": case "ja": case "pl": case "ro": case "ru": case "sl": case "sq": case "sr_cyr": case "sr_lat": case "sv": case "th": case "tr": case "uk": break; default: $Language = "en";}
$NickSelectionBox = $_POST['NickSelectionBox'];
switch($NickSelectionBox){case "true": case "false": break; default: $NickSelectionbox = "true";}
$ShowServerWindow = $_POST['ShowServerWindow'];
switch($ShowServerWindow){case "true": case "false": break; default: $ShowServerWindow = "true";}
$NickServPassword = $_POST['NickServPassword'];
switch($NickServPassword){case "false": case "true": break; default: $NickServPassword = "false";}
$Color = $_POST['Color'];
switch($Color){case "": case "black": case "blue": case "darkorange": case "green": case "lightblue": case "yellow": break; default: $Color = "";}
?>
<br />
<iframe src="<?php
if(empty($Domain) && empty($Host) && empty($Nick) && empty($Channel)){
echo 'http://www.lightirc.com/start/?host=irc.lightirc.com&amp;nick=User_%25&amp;autojoin=%23test&amp;showNickSelection=true&amp;nickservPassword=false&amp;showServerWindow=true&amp;styleURL=css%2F.css';
} else {
echo 'http://www.' . $Domain . '/?host=' . $Host . '&amp;nick=' . urlencode($Nick) .
'&amp;autojoin=' . urlencode($Channel) . '&amp;showNickSelection=' . $NickSelectionBox .
'&amp;nickservPassword=' . $NickServPassword . '&amp;showServerWindow=' . $ShowServerWindow . '&amp;styleURL=css%2F' . $Color . '.css';
}
?>" style="width:100%; height:400px;"></iframe>
<br /><br />
<textarea style="width:100%; height:60px;"><iframe src="<?php
if(empty($Domain) && empty($Host) && empty($Nick) && empty($Channel)){
echo 'http://www.lightirc.com/start/?host=irc.lightirc.com&amp;nick=User_%25&amp;autojoin=%23test&amp;showNickSelection=true&amp;nickservPassword=false&amp;showServerWindow=true&amp;styleURL=css%2F.css';
} else {
echo 'http://www.' . $Domain . '/?host=' . $Host . '&amp;nick=' . urlencode($Nick) .
'&amp;autojoin=' . urlencode($Channel) . '&amp;showNickSelection=' . $NickSelectionBox .
'&amp;nickservPassword=' . $NickServPassword . '&amp;showServerWindow=' . $ShowServerWindow . '&amp;styleURL=css%2F' . $Color . '.css';
}
?>" style="<?php
if(empty($Width) && empty($Height)){
echo 'width: 800px;height: 400px;';
} else {
echo 'width: ' . $Width . 'px;height: ' . $Height . 'px;';
}
?>"></iframe>
</textarea>
<form action="lightirc-iframe-generator.php" method="POST">
<table>
<tr>
<td>Domain:</td>
<td><input type="text" name="Domain" value="<?php
if(empty($Domain)){
echo "lightirc.com/start";
} else {
echo $Domain;
}
?>" size="30" maxlength="50"> Fill your Domain name here.</td>
</tr>
<tr>
<td>IRC Server:</td>
<td><input type="text" name="Host" value="<?php
if(empty($Host)){
echo "irc.lightirc.com";
} else {
echo $Host;
}
?>" size="30" maxlength="50"></td>
</tr>
<tr>
<td>Width:</td>
<td><input type="text" name="Width" value="<?php
if(empty($Width)){
echo "800";
} else {
echo $Width;
}
?>" size="5" maxlength="5" /></td>
</tr>
<tr>
<td>Height:</td>
<td><input type="text" name="Height" value="<?php
if(empty($Height)){
echo "400";
} else {
echo $Height;
}
?>" size="5" maxlength="5" /></td>
</tr>
<tr>
<td>Nick:</td>
<td><input type="text" name="Nick" value="<?php
if(empty($Nick)){
echo "User_%";
} else {
echo $Nick;
}
?>" size="30" maxlength="50" /> % will be replaced by a random number.</td>
</tr>
<tr>
<td>Channel:</td>
<td><input type="text" name="Channel" value="<?php
if(empty($Channel)){
echo "#test";
} else {
echo $Channel;
}
?>" size="30" maxlength="50" /></td>
</tr>
<tr>
<td>Language:</td>
<td><select name="Language">
<?php
$Lang = array(
'English' => 'en',
'Dutch' => 'nl',
'Bengali' => 'bd',
'Bulgarian' => 'bg',
'Brazilian/Portuguese' => 'br',
'Czech' => 'cz',
'Danish' => 'da',
'German' => 'de',
'Greek' => 'el',
'Spanish' => 'es',
'Estonian' => 'et',
'French' => 'fr',
'Hungarian' => 'hu',
'Italian' => 'it',
'Japanese' => 'ja',
'Spanish' => 'es',
'Polish' => 'pl',
'Romanian' => 'ro',
'Russian' => 'ru',
'Slovenian' => 'sl',
'Albanian' => 'sq',
'Serbian Cyrillic' => 'sr_cyr',
'Serbian Latin' => 'sr_lat',
'Swedish' => 'sv',
'Thai' => 'th',
'Turkish' => 'tr',
'Ukrainian' => 'uk'
);
foreach($Lang as $LangKey => $LangValue) {
echo '<option value="'.$LangValue.'">'.$LangKey.'</option>';
}
?>
</select></td>
</tr>
<tr>
<td>Show nickname select box:</td>
<td>
<select name="NickSelectionBox">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
</td>
</tr>
<tr>
<td>NickServ password:</td>
<td>
<select name="NickServPassword">
<option value="true">Yes</option>
<option value="false" selected="selected">No</option>
</select> Shows a box to enter a password and identifies the user to NickServ.
</td>
</tr>
<tr>
<td>Show server window:</td>
<td>
<select name="ShowServerWindow">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
</td>
</tr>
<tr>
<td>Style:</td>
<td><select name="Color">
<?php
$Colour = array(
'Default' => '',
'Black' => 'black',
'Blue' => 'blue',
'Darkorange' => 'darkorange',
'Green' => 'green',
'Lightblue' => 'lightblue',
'Yellow' => 'yellow',
);
foreach($Colour as $ColourKey => $ColourValue) {
echo '<option value="'.$ColourValue.'">'.$ColourKey.'</option>';
}
?>
</select></td>
</tr>
</table>
<input type="submit" name="submit" value="Generate Code">
</form>
<?php echo "<!-- (c) MaleXachi 23-05-2013 - lightIRC iFrame Generator -->"; ?>
</body>
</html>
@sagargulati
Copy link

Well it's available publically on there official website i think :)

@sagargulati
Copy link

Also can you make lightirc.com/start.php file for us?

@MaleXachi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment