webchat in a Coppermine templated page webchat in a Coppermine templated page
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

webchat in a Coppermine templated page

Started by Tranz, May 03, 2006, 06:11:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tranz

I am posting this on behalf of Yancho, who started a thread about webchat integration. He posted his code here due to trouble posting in our forums. I've modified yancho's instructions to simplify.



1 - Create a file chat.php and add the code below.
2. Remember to change $page and $nick for your network (I would be happy to host any coppermine gallery channels on my network - PM to help u) [Yancho's profile for PM]


<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');

pageheader('Web Chat');

//start of webchat code

$page= (isset($_REQUEST['page']))? $_REQUEST['page']: "webchat.php";
$nick= (isset($_REQUEST['nick']))? $_REQUEST['nick']: "Yancho";
if (
$page != "chat"$page "";
$nick str_replace(" ""_"$nick);// replaces spaces on nicknames
$nick ereg_replace("^[0-9]*[0-9]"""$nick);// deletes numbers on the beginning of nicknames
$nick str_replace("ä""ae"$nick);
$nick str_replace("ö""oe"$nick);
$nick str_replace("ü""ue"$nick);
$self getenv("PHP_SELF");
?>

<h1>#EF Web Chat</h1>
<?php if($page == ""): ?>
<?php
starttable
('100%');
?>

<tr><td>
<div>
To begin chatting in #EF using our web chat type your nick name below and click Login. The script may take a few minutes to load. You may have to click Yes to allow it to be loaded by your web browser. We promise the web chat client does not load any viruses, spyware, or anything else nasty.<br /><br />
If you'd rather connect with your own IRC client, head to  #EF at <b>irc.mt-leaders.info:6668</b><br /><br />
<div class="wrchatrules">
<!-- If you have rules or other information you want to display on the page put it between these comment lines -->
<b>......Please read the following IMPORTANT information:</b>
<ul>
<li> Once the #EF Web Chat is fully loaded it will automatically connect you to the #EF chatroom.</li>
<li> If you choose a nickname that someone else is using you will be assigned a random nickname. To choose another nick type /nick desirednickhere and hit enter.</li>
<li> <a href="http://www.java.com/en/download/manual.jsp" target="_blank"><img src="http://www.wyldryde.org/graphics/javagetnow.gif" width="88" height="31" alt="Download Java" border="0" align="middle" /></a> To use the Web Chat, you must have <a href="http://www.java.com/en/download/manual.jsp" target="_blank">Java</a> installed. If you don't have it, it is available for free from Sun.</li>
</ul><br />
<!-- If you have rules or other information you want to display on the page put it between these comment lines -->
</div>
</div>

<table width="45%" align="center">
<tr><td align="center">
<form name="login" action="<?php print $self?>" method="get" onSubmit="return chkForm();"><table width="100%" cellpadding="18" cellspacing="0">
<table cellpadding="4">
<tr><td align="right">Enter a Nickname:</td><td><input name="nick" type="text" size="20" maxlength="12" value="EFStudent<?php echo rand(100,9999?>"></td><td><input type="hidden" name="page" value="chat"> <input type="submit" value="Start Chatting!" onClick="document.getElementById('wrservers').style.display='none'"></td></tr>
</table>
</form>
</td></tr>
</table>

<br />
<br />
<div class="poweredby" style="text-align: center; font-family: sans-serif; font-size: xx-small; margin-top: 6px; margin-right: 6px; margin-left: 6px; margin-bottom: 6px">
</div>
<?php endif;
if(
$page == "chat"): ?>

<applet code="IRCApplet.class" codebase="http://www.wyldryde.org/chat/" archive="irc.jar,pixx.jar" width="640" height="400">
<param name="CABINETS" value="irc.cab,securedirc.cab,pixx.cab" />
<param name="gui" value="pixx" />
<param name="language" value="english" />
<param name="pixx:language" value="pixx-english" />
<param name="host" value="irc.mt-leaders.info" />
<param name="port" value="6668" />
<param name="alternateserver1" value="irc.mt-leaders.info 6668" />
<param name="autoconnection" value="true" />
<param name="nick" value="<?php print $nick?>" />
<param name="alternatenick" value="<?php print $nick?>???" />
<param name="userid" value="EF" />
<param name="name" value="EF Web Chat User" />
<param name="command1" value="/join #EF" />
<param name="quitmessage" value="All you others visit www.mt-leaders.info " />
<param name="soundbeep" value="bell2.au" />
<param name="soundquery" value="ding.au" />
<param name="useinfo" value="false" />
<param name="style:sourcefontrule1" value="all all Serif 12" />
<param name="allowdccchat" value="false" />
<param name="allowdccfile" value="false" />
<param name="style:bitmapsmileys" value="true" />
<param name="style:smiley1" value=":) img/sourire.gif" />
<param name="style:smiley2" value=":-) img/sourire.gif" />
<param name="style:smiley3" value=":-D img/content.gif" />
<param name="style:smiley4" value=":d img/content.gif" />
<param name="style:smiley5" value=":-O img/OH-2.gif" />
<param name="style:smiley6" value=":o img/OH-1.gif" />
<param name="style:smiley7" value=":-P img/langue.gif" />
<param name="style:smiley8" value=":p img/langue.gif" />
<param name="style:smiley9" value=";-) img/clin-oeuil.gif" />
<param name="style:smiley10" value=";) img/clin-oeuil.gif" />
<param name="style:smiley11" value=":-( img/triste.gif" />
<param name="style:smiley12" value=":( img/triste.gif" />
<param name="style:smiley13" value=":-| img/OH-3.gif" />
<param name="style:smiley14" value=":| img/OH-3.gif" />
<param name="noasldisplayprefix" value="true" />
<param name="pixx:helppage" value="http://www.wyldryde.org/faq/" />
<param name="pixx:showabout" value="false" />
<param name="pixx:showconnect" value="true" />
<param name="pixx:timestamp" value="true" />
<param name="pixx:highlight" value="true" />
<param name="pixx:highlightnick" value="true" />
<param name="pixx:nickfield" value="true" />
<param name="pixx:styleselector" value="true" />
<param name="pixx:setfontonstyle" value="true" />
<h1><a href="http://www.wyldryde.org">WyldRyde</a> Web Chat</h1>
<p>You need an updated version of <a href="http://www.java.com/en/download/manual.jsp" target="_blank">Java</a> installed and enabled to use this chat room. <a href="http://www.java.com/en/download/manual.jsp" target="_blank">Download it now for free.</a></p>
</applet>
<div class="poweredby" style="text-align: center; font-family: sans-serif; font-size: xx-small; margin-top: 6px; margin-right: 6px; margin-left: 6px; margin-bottom: 6px">

</div>
<?
endif;
?>
</td>
</tr>
<!-- end of webchat code -->

<?
endtable();
pagefooter();
?>


Then follow the threads on how to add a link in the menu :)

Enjoy ;)

Tranz

@Yancho: Could you please clarify what network info needs to be edited?

@all: I ended up modifying the code a bit, including removing the body tag. The loss there is the input field is no longer automatically selected. But I figured it was better to clean up the code since the body tag already exists in the Coppermine template. If you want to keep that functionality, you can refer to Yancho's original code and use the body tag.

olti


olti

Nevermind, I get it. Remember to change $page and $nick for your network

Please delete my posts here!!

Tranz

Based on a PM I received, there seems to be some confusion in this thread. I posted the content in the first post on behalf of Yancho. My only involvement was the code changes I posted. I am NOT hosting chat channels myself.

I hope that clarifies. Sorry for any confusion.

anandanand

Does anyone have a demo for this? so that we could see it live in action.

I'm new to copper mine system but so far I doing a lot to make my Coppermine system on my website be more advanced by adding mods or plugins.  :)

Thank in advance.

Regards,
Anand N.

allvip

Idon't know with what to change $page and $nick.Please help me.The chat .php should be on my website root folder?