can someone help please i need to convert this to html
<?
/////////////////////////////////////////////////////////////////////////////////////////////////
// //
// GumChat //
// Current Version : 1.15 //
// Author : GUMSLONE //
// You you can redistribute it and/or modify this script but please always put author's name //
// Copyright (c) 2006 GumSlone. All rights reserved. //
// Additional scripts can be found at wapforum.org.uk //
// 17.12.2006 //
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION STARTS HERE
///////////////////////////////////////////////////////////////////////////
$TimeZone="0"; //0 means server time
$New_Time = time() + ($TimeZone * 60 * 60);// hours* 60 mins* 60secs DONT TOUCH!
$_time=date("H:i",$New_Time); //DONT TOUCH!
$_refresh=200; //chatroom refreshtime
$_room_size=15; //means chatroom size of 15 messages
$home_page_url="http://2wap.net";
$home_page_title="2wap.net";
$encoding="ISO-8859-1"; //DONT TOUCH!
//$encoding="UTF-8"; //dlja Russkogo (Kirilica) its for russian language
$_translit="0"; //Its only for russians!!! Do not change! Dlja perewoda s translita w russkij postawte mesto "0" edinicu "1"
/////////////[Change language or menu]////////////////////////////////
$lang_user_in_chat="users in chat";
$lang_enter="- Enter -";
$lang_nickname="Your Nickname:";
$lang_gender="Gender:";
$lang_male="Male";
$lang_female="Female";
$lang_age="Age: ";
$lang_show_smilies="Show smilies? ";
$lang_yes="YES";
$lang_no="NO";
$lang_select_chatroom="Select Chatroom";
$lang_users="Users in";
$lang_chatrooms="Chatrooms";
$lang_smilies="Smilies";
$lang_next="Next »";
$lang_prev="« Prev";
$lang_chat="Back to Chatroom";
$lang_say="Say";
$lang_refresh="Refresh";
$lang_message="Message:";
$lang_ok="OK";
$lang_change_chatroom="Change Chatroom";
$lang_who_is_online="Who's Inside";
$lang_loading="Loading...<br/>please wait";
$lang_exit="Logout";
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE
///////////////////////////////////////////////////////////////////////////
/////////////[DO NOT EDIT AFTER THIS LINE]////////////////////////////////
header("Content-type: text/vnd.wap.wml; charset=$encoding");
header("Cache-Control: no-store, no-cache, must-revalidate");
print "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<!-- GumChat by GumSlone Version 1.05 (c) 2005 All rights reserved. -->
<!-- Additional scripts can be found at wapforum.org.uk -->
<wml>
<?php
if ($nick&&$room) {
$daten="online/on$room";
$time = time();
$user = explode ('/', $HTTP_USER_AGENT);
$ip = ("!$nick!$user[0]!$REMOTE_ADDR!$G!$A!");
$ablaufzeit = "$time"-"250";
$pruefung = @file($daten);
while (list ($line_num, $line) = @each ($pruefung))
{$zeiten = explode(":",$line);
if($zeiten[0] <= $ablaufzeit)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$ippruefung = @file($daten);
while (list ($line_num, $line) = @each ($ippruefung))
{$ips = explode(":",$line);
if($ips[1] == $ip)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$fp = fopen("$daten", "a+");
flock($fp,2);
fputs ($fp, "$time:$ip:\n");
flock($fp,3);
fclose ($fp);
}
if ($gum=="") {
echo "<card id=\"GumChat\" title=\"GumChat $_time\">";
echo "<p align=\"center\">";
echo "<img src=\"logo.gif\" alt=\"GumChat\"/><br/>";
$n = 0;
$files = '';
if ($handle = opendir("rooms/"))
{
while (false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..' && $file != 'files'&& $file != 'cgi-bin'&& $file != 'chat')
{
if($n >= 0 && $n < 20){
$onfile=file("online/on$file");
$counts=count($onfile);
if($counts<2){
$gumdata = explode(":",$onfile[0]);
$ablaufzeit = time()-"250";
if($gumdata[0]<=$ablaufzeit){
$fp = fopen("online/on$file","w+");
$counts=0;
}
}
$total=$total+$counts;
$n++;
}
}
}
closedir($handle);
}
echo "$total $lang_user_in_chat!<br/>";
echo "$lang_nickname <input name=\"us\" maxlength=\"20\"/><br/>";
echo $lang_gender.'
<select name="g" multiple="false">
<option value="m">'.$lang_male.'</option>
<option value="f">'.$lang_female.'</option>
</select><br/>';
echo"$lang_age<input name=\"a\" maxlength=\"2\" format=\"NN\" size=\"2\"/><br/>";
echo $lang_show_smilies.'
<select name="sm" multiple="false">
<option value="1">'.$lang_yes.'</option>
<option value="0">'.$lang_no.'</option>
</select><br/>';
echo "<anchor title=\"Enter\">$lang_enter";
echo "<go href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&nick=$(us)&sm=$(sm)&G=$(g )&A=$(a)\" method=\"post\">";
echo "<postfield name=\"userreg\" value=\"\$us\"/>";
echo "</go>";
echo "</anchor>";
echo "<br/><br/><a href=\"$home_page_url\">$home_page_title</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="rooms") {
echo "<card id=\"ChatRooms\" title=\"$lang_chatrooms ($_time)\">";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"center\">";
$nick = ereg_replace(" ", "_", $nick);
$nick = ereg_replace("!", "", $nick);
if(preg_match("/[^\da-zA-Z-@_]+/", $nick)||$nick=="") $error='Not suported chars in Nickname!<br/>';
if(empty($error)){
echo "$lang_select_chatroom<br/>";
$n = 0;
$files = '';
if ($handle = opendir("rooms/"))
{
while (false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..' && $file != 'files'&& $file != 'cgi-bin'&& $file != 'chat')
{
if($n >= 0 && $n < 20){
$onfile=file("online/on$file");
$counts=count($onfile);
$total=$total+$counts;
$n++;
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$file\">$file [$counts]</a><br/>";
}
}
}
closedir($handle);
}
}else
echo $error."<anchor>Back<prev/></anchor><br/>";
echo "<br/>$total $lang_users $n $lang_chatrooms!";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="add") {
$mess = eregi_replace(' ', ' ', $mess);
if($nick==""||$nick==" ")
echo '<card id="card0" title="..." ontimer="index.php"><timer value="10"/>';
elseif($mess==""||$mess==" ")
echo "<card id=\"card0\" title=\"loading...\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\"><timer value=\"10\"/>";
else{
echo "<card id=\"card0\" title=\"loading...\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\"><timer value=\"10\"/>";
echo "<do type=\"options\" name=\"refresh\" label=\"Chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"center\">$lang_loading</p>";
$xfile = @file("rooms/$room");
$check = explode("&&",$xfile[0]);
$check2 = explode("&&",$xfile[1]);
if("$mess"!="$check[2]"&&"$mess"!="$check2[2]"){
$nick = ereg_replace(" ", "_", $nick);
$nick=substr(trim($nick),0,20);
$text = "&&$nick $_time&&$mess&&";
$text = stripslashes($text);
$text = ereg_replace("\n", " ", $text);
$text = ereg_replace("\r", "", $text);
$text = ereg_replace("~", "-", $text);
$text = str_replace('$', '$$', $text);
$text = ereg_replace("_", " ", $text);
if (File_Exists("rooms/$room"))
{
$zpravy = File("rooms/$room");
}
$fp = FOpen("rooms/$room", "w");
FPutS($fp, "$text\n");
for ($i=0; $i<$_room_size; $i++)
{
FPutS($fp, $zpravy[$i]);
}
FClose($fp);
}
}
echo "</card>";
}
if ($gum=="croom") {
$onxfile = @file("online/on$room");
$countonl= count($onxfile);
echo "<card id=\"card0\" title=\"$room in $countonl ($_time)\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=";
echo $New_Time;
echo "\"><timer value=\"$_refresh\"/>";
echo "<do type=\"options\" name=\"say\" label=\"$lang_say\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=say&nick=$nick&sm=$sm&G=$G& A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"refresh\" label=\"$lang_refresh\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"whowhere\" label=\"$lang_who_is_online\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"changeroom\" label=\"$lang_change_chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&nick=$nick&sm=$sm&G=$G&am p;A=$A\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"smilies\" label=\"$lang_smilies\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=say&nick=$nick&sm=$sm&G=$G& A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_say</a> ";
echo " <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_refresh</a><br/>";
$fp = FOpen("rooms/$room", "r");
while ($radka = FGetS($fp, 512))
{
$udata = explode("&&",$radka);
$udata[2]=htmlspecialchars($udata[2]);
$udata[2] = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a href="\\1">\\1</a>', $udata[2]);
$udata[2] = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1<a href="http://\\2">\\2</a>', $udata[2]);
$udata[2] = filterBadWords($udata[2]);
if($sm==1)$udata[2] = ReplaceTextToSmilies($udata[2]);
if($_translit==1)latrus($udata[2]);
echo"<small><b>".htmlspecialchars($udata[1])." »</b><br/>".$udata[2]."</small><br/>";
}
FClose($fp);
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=say&nick=$nick&sm=$sm&G=$G& A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_say</a> ";
echo " <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_refresh</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room\">$lang_who_is_online</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&nick=$nick&sm=$sm&G=$G&am p;A=$A\">$lang_change_chatroom</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room\">$lang_smilies</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."\">$lang_exit</a><br/>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="say") {
echo "<card id=\"Say\" title=\"$lang_say ($_time)\">";
echo "<do type=\"options\" name=\"refresh\" label=\"Chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
echo "$lang_message <input name=\"mess".$New_Time."\" maxlength=\"200\"/><br/>";
echo "<anchor title=\"Say\">$lang_say";
echo "<go href=\"".$_SERVER["PHP_SELF"]."?gum=add&nick=$nick&sm=$sm&G=$G& A=$A&room=$room\" method=\"post\">";
echo "<postfield name=\"mess\" value=\"\$(mess".$New_Time.")\"/>";
echo "</go>";
echo "</anchor>";
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\">$lang_chat</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="smilies") {
echo "<card id=\"Smilies\" title=\"$lang_smilies ($_time)\">";
echo "<do type=\"options\" name=\"refresh\" label=\"$lang_chat\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
$conf["items_per_page"] = 5;
if (!isset($page)) {$page = 0;}
$total = 0;
if(!($dp = opendir("./smilies/"))) die ("Cannot open ./smilies/");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
if ($file_count > 0)
{
$first_record = $page * $conf["items_per_page"];
$last_record = $first_record + $conf["items_per_page"];
while (list($fileIndexValue, $file_name) = each ($file_array))
{
if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
{
$user = explode ('.', $file_name);
echo "<img src=\"smilies/$file_name\" alt=\".".$user[0].".\"/> .".$user[0].".<br/>";
}
}
if (($file_count > 0) AND ($last_record < $file_count))
{
// next button
$next_page = $page + 1;
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room&page=$next_page\">$lan g_next</a><br/>";
}
if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room&page=$prev_page\">$lan g_prev</a><br/>";
}
}
closedir($dp);
echo "<b>$file_count</b> $lang_smilies";
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\">$lang_chat</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="online") {
echo "<card id=\"Online\" title=\"$lang_who_is_online ($_time)\">";
echo "<do type=\"options\" name=\"refresh\" label=\"$lang_chat\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
$xfile = @file("online/on$room");
$xfile = array_reverse($xfile);
$p = 25;
if ($npage == ""){$npage = "1";}
$countfile= count($xfile);
$first = $countfile - ($p * ($npage - 1));
$second = $countfile - ($p * $npage) + 1;
if ($second < 1) {$second = 1;}
$npages = ceil($countfile / $p);
if ($npage <= $npages and $npage>1) $gline_rew = "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room&npage=".($npage-1)."\">$lang_prev</a>";
if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room&npage=".($npage+1)."\"> $lang_next</a>";
$nn=1;
for ($i = $first-1; $i >= $second-1; $i--) {
$udata = explode("!",$xfile[$i]);
if($udata[4]==m) $gender=$lang_male;
if($udata[4]==f) $gender=$lang_female;
print $nn++." <b>$udata[1]</b> $gender ($udata[5]) $udata[2]<br/>";
}
print"<br/>";
if ($npages>1)
print $gline_rew."| ".$gline_next;
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\">$lang_chat</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
function filterBadWords($str){
// words to filter, you can add here some more
$badwords=array( "****", "Bitch", "Dick", "Hitler", "Nazi", "Asshole", "Wichser");
// replace filtered words with
$replacements=array( "censored", "have a nice day");
for($i=0;$i < sizeof($badwords);$i++){
srand((double)microtime()*1000000);
$rand_key = (rand()%sizeof($replacements));
$str=eregi_replace($badwords[$i], $replacements[$rand_key], $str);
}
return $str;
}
function ReplaceTextToSmilies($str){
$dir = "smilies/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$smilie=explode(".",$file);
$str = str_replace('.'.$smilie[0].'.', '<img src="'.$dir.'/'.$file.'" alt=".'.$smilie[0].'." />', $str);
}
closedir($dh);
}
}
return $str;
}
function latrus($str) {
$tran = array(
"A"=>"А","a"=>"а","B"=>"Б","b"=>"б","V"=>"В",
"v"=>"в","G"=>"Г","g"=>"г","D"=>"Д","d"=>"д",
"E"=>"Е","e"=>"е","yo"=>"Ё","Zh"=>"Ж","zh"=>"ж ",
"Z"=>"З","z"=>"з","I"=>"И","i"=>"и","J"=>"Й",
"j"=>"й","K"=>"К","k"=>"к","L"=>"Л","l"=>"л",
"M"=>"М","m"=>"м","N"=>"Н","n"=>"н","O"=>"О",
"o"=>"о","P"=>"П","p"=>"п","R"=>"Р","r"=>"р",
"S"=>"С","s"=>"с","T"=>"Т","t"=>"т","U"=>"У",
"u"=>"у","F"=>"Ф","f"=>"ф","H"=>"Х","h"=>"х",
"C"=>"Ц","c"=>"ц","Ch"=>"Ч","ch"=>"ч","Sh"=>"Ш ",
"sh"=>"ш","Sch"=>"Щ","sch"=>"щ","''"=>"ъ",
"Y"=>"Ы","y"=>"ы","'"=>"ь","Ye"=>"Э",
"ye"=>"э","Yu"=>"Ю","yu"=>"ю","Ya"=>"Я","ya"=> "я",
"Yo"=>"ё"
);
return strtr($str,$tran);
}
///////////////////////////////////////////////////////////////////////////
// END OF SCRIPT ENJOY!
///////////////////////////////////////////////////////////////////////////
?>
</wml>
<?
/////////////////////////////////////////////////////////////////////////////////////////////////
// //
// GumChat //
// Current Version : 1.15 //
// Author : GUMSLONE //
// You you can redistribute it and/or modify this script but please always put author's name //
// Copyright (c) 2006 GumSlone. All rights reserved. //
// Additional scripts can be found at wapforum.org.uk //
// 17.12.2006 //
/////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION STARTS HERE
///////////////////////////////////////////////////////////////////////////
$TimeZone="0"; //0 means server time
$New_Time = time() + ($TimeZone * 60 * 60);// hours* 60 mins* 60secs DONT TOUCH!
$_time=date("H:i",$New_Time); //DONT TOUCH!
$_refresh=200; //chatroom refreshtime
$_room_size=15; //means chatroom size of 15 messages
$home_page_url="http://2wap.net";
$home_page_title="2wap.net";
$encoding="ISO-8859-1"; //DONT TOUCH!
//$encoding="UTF-8"; //dlja Russkogo (Kirilica) its for russian language
$_translit="0"; //Its only for russians!!! Do not change! Dlja perewoda s translita w russkij postawte mesto "0" edinicu "1"
/////////////[Change language or menu]////////////////////////////////
$lang_user_in_chat="users in chat";
$lang_enter="- Enter -";
$lang_nickname="Your Nickname:";
$lang_gender="Gender:";
$lang_male="Male";
$lang_female="Female";
$lang_age="Age: ";
$lang_show_smilies="Show smilies? ";
$lang_yes="YES";
$lang_no="NO";
$lang_select_chatroom="Select Chatroom";
$lang_users="Users in";
$lang_chatrooms="Chatrooms";
$lang_smilies="Smilies";
$lang_next="Next »";
$lang_prev="« Prev";
$lang_chat="Back to Chatroom";
$lang_say="Say";
$lang_refresh="Refresh";
$lang_message="Message:";
$lang_ok="OK";
$lang_change_chatroom="Change Chatroom";
$lang_who_is_online="Who's Inside";
$lang_loading="Loading...<br/>please wait";
$lang_exit="Logout";
///////////////////////////////////////////////////////////////////////////
// CONFIGURATION ENDS HERE
///////////////////////////////////////////////////////////////////////////
/////////////[DO NOT EDIT AFTER THIS LINE]////////////////////////////////
header("Content-type: text/vnd.wap.wml; charset=$encoding");
header("Cache-Control: no-store, no-cache, must-revalidate");
print "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<!-- GumChat by GumSlone Version 1.05 (c) 2005 All rights reserved. -->
<!-- Additional scripts can be found at wapforum.org.uk -->
<wml>
<?php
if ($nick&&$room) {
$daten="online/on$room";
$time = time();
$user = explode ('/', $HTTP_USER_AGENT);
$ip = ("!$nick!$user[0]!$REMOTE_ADDR!$G!$A!");
$ablaufzeit = "$time"-"250";
$pruefung = @file($daten);
while (list ($line_num, $line) = @each ($pruefung))
{$zeiten = explode(":",$line);
if($zeiten[0] <= $ablaufzeit)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$ippruefung = @file($daten);
while (list ($line_num, $line) = @each ($ippruefung))
{$ips = explode(":",$line);
if($ips[1] == $ip)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$fp = fopen("$daten", "a+");
flock($fp,2);
fputs ($fp, "$time:$ip:\n");
flock($fp,3);
fclose ($fp);
}
if ($gum=="") {
echo "<card id=\"GumChat\" title=\"GumChat $_time\">";
echo "<p align=\"center\">";
echo "<img src=\"logo.gif\" alt=\"GumChat\"/><br/>";
$n = 0;
$files = '';
if ($handle = opendir("rooms/"))
{
while (false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..' && $file != 'files'&& $file != 'cgi-bin'&& $file != 'chat')
{
if($n >= 0 && $n < 20){
$onfile=file("online/on$file");
$counts=count($onfile);
if($counts<2){
$gumdata = explode(":",$onfile[0]);
$ablaufzeit = time()-"250";
if($gumdata[0]<=$ablaufzeit){
$fp = fopen("online/on$file","w+");
$counts=0;
}
}
$total=$total+$counts;
$n++;
}
}
}
closedir($handle);
}
echo "$total $lang_user_in_chat!<br/>";
echo "$lang_nickname <input name=\"us\" maxlength=\"20\"/><br/>";
echo $lang_gender.'
<select name="g" multiple="false">
<option value="m">'.$lang_male.'</option>
<option value="f">'.$lang_female.'</option>
</select><br/>';
echo"$lang_age<input name=\"a\" maxlength=\"2\" format=\"NN\" size=\"2\"/><br/>";
echo $lang_show_smilies.'
<select name="sm" multiple="false">
<option value="1">'.$lang_yes.'</option>
<option value="0">'.$lang_no.'</option>
</select><br/>';
echo "<anchor title=\"Enter\">$lang_enter";
echo "<go href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&nick=$(us)&sm=$(sm)&G=$(g )&A=$(a)\" method=\"post\">";
echo "<postfield name=\"userreg\" value=\"\$us\"/>";
echo "</go>";
echo "</anchor>";
echo "<br/><br/><a href=\"$home_page_url\">$home_page_title</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="rooms") {
echo "<card id=\"ChatRooms\" title=\"$lang_chatrooms ($_time)\">";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"center\">";
$nick = ereg_replace(" ", "_", $nick);
$nick = ereg_replace("!", "", $nick);
if(preg_match("/[^\da-zA-Z-@_]+/", $nick)||$nick=="") $error='Not suported chars in Nickname!<br/>';
if(empty($error)){
echo "$lang_select_chatroom<br/>";
$n = 0;
$files = '';
if ($handle = opendir("rooms/"))
{
while (false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..' && $file != 'files'&& $file != 'cgi-bin'&& $file != 'chat')
{
if($n >= 0 && $n < 20){
$onfile=file("online/on$file");
$counts=count($onfile);
$total=$total+$counts;
$n++;
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$file\">$file [$counts]</a><br/>";
}
}
}
closedir($handle);
}
}else
echo $error."<anchor>Back<prev/></anchor><br/>";
echo "<br/>$total $lang_users $n $lang_chatrooms!";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="add") {
$mess = eregi_replace(' ', ' ', $mess);
if($nick==""||$nick==" ")
echo '<card id="card0" title="..." ontimer="index.php"><timer value="10"/>';
elseif($mess==""||$mess==" ")
echo "<card id=\"card0\" title=\"loading...\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\"><timer value=\"10\"/>";
else{
echo "<card id=\"card0\" title=\"loading...\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\"><timer value=\"10\"/>";
echo "<do type=\"options\" name=\"refresh\" label=\"Chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"center\">$lang_loading</p>";
$xfile = @file("rooms/$room");
$check = explode("&&",$xfile[0]);
$check2 = explode("&&",$xfile[1]);
if("$mess"!="$check[2]"&&"$mess"!="$check2[2]"){
$nick = ereg_replace(" ", "_", $nick);
$nick=substr(trim($nick),0,20);
$text = "&&$nick $_time&&$mess&&";
$text = stripslashes($text);
$text = ereg_replace("\n", " ", $text);
$text = ereg_replace("\r", "", $text);
$text = ereg_replace("~", "-", $text);
$text = str_replace('$', '$$', $text);
$text = ereg_replace("_", " ", $text);
if (File_Exists("rooms/$room"))
{
$zpravy = File("rooms/$room");
}
$fp = FOpen("rooms/$room", "w");
FPutS($fp, "$text\n");
for ($i=0; $i<$_room_size; $i++)
{
FPutS($fp, $zpravy[$i]);
}
FClose($fp);
}
}
echo "</card>";
}
if ($gum=="croom") {
$onxfile = @file("online/on$room");
$countonl= count($onxfile);
echo "<card id=\"card0\" title=\"$room in $countonl ($_time)\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=";
echo $New_Time;
echo "\"><timer value=\"$_refresh\"/>";
echo "<do type=\"options\" name=\"say\" label=\"$lang_say\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=say&nick=$nick&sm=$sm&G=$G& A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"refresh\" label=\"$lang_refresh\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"whowhere\" label=\"$lang_who_is_online\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"changeroom\" label=\"$lang_change_chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&nick=$nick&sm=$sm&G=$G&am p;A=$A\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"smilies\" label=\"$lang_smilies\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=say&nick=$nick&sm=$sm&G=$G& A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_say</a> ";
echo " <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_refresh</a><br/>";
$fp = FOpen("rooms/$room", "r");
while ($radka = FGetS($fp, 512))
{
$udata = explode("&&",$radka);
$udata[2]=htmlspecialchars($udata[2]);
$udata[2] = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a href="\\1">\\1</a>', $udata[2]);
$udata[2] = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1<a href="http://\\2">\\2</a>', $udata[2]);
$udata[2] = filterBadWords($udata[2]);
if($sm==1)$udata[2] = ReplaceTextToSmilies($udata[2]);
if($_translit==1)latrus($udata[2]);
echo"<small><b>".htmlspecialchars($udata[1])." »</b><br/>".$udata[2]."</small><br/>";
}
FClose($fp);
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=say&nick=$nick&sm=$sm&G=$G& A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_say</a> ";
echo " <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=";
echo $New_Time;
echo "\">$lang_refresh</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room\">$lang_who_is_online</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&nick=$nick&sm=$sm&G=$G&am p;A=$A\">$lang_change_chatroom</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room\">$lang_smilies</a><br/>";
echo "<a href=\"".$_SERVER["PHP_SELF"]."\">$lang_exit</a><br/>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="say") {
echo "<card id=\"Say\" title=\"$lang_say ($_time)\">";
echo "<do type=\"options\" name=\"refresh\" label=\"Chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
echo "$lang_message <input name=\"mess".$New_Time."\" maxlength=\"200\"/><br/>";
echo "<anchor title=\"Say\">$lang_say";
echo "<go href=\"".$_SERVER["PHP_SELF"]."?gum=add&nick=$nick&sm=$sm&G=$G& A=$A&room=$room\" method=\"post\">";
echo "<postfield name=\"mess\" value=\"\$(mess".$New_Time.")\"/>";
echo "</go>";
echo "</anchor>";
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\">$lang_chat</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="smilies") {
echo "<card id=\"Smilies\" title=\"$lang_smilies ($_time)\">";
echo "<do type=\"options\" name=\"refresh\" label=\"$lang_chat\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
$conf["items_per_page"] = 5;
if (!isset($page)) {$page = 0;}
$total = 0;
if(!($dp = opendir("./smilies/"))) die ("Cannot open ./smilies/");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
if ($file_count > 0)
{
$first_record = $page * $conf["items_per_page"];
$last_record = $first_record + $conf["items_per_page"];
while (list($fileIndexValue, $file_name) = each ($file_array))
{
if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
{
$user = explode ('.', $file_name);
echo "<img src=\"smilies/$file_name\" alt=\".".$user[0].".\"/> .".$user[0].".<br/>";
}
}
if (($file_count > 0) AND ($last_record < $file_count))
{
// next button
$next_page = $page + 1;
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room&page=$next_page\">$lan g_next</a><br/>";
}
if (($file_count > 0) AND ($page != 0))
{
// previous button
$prev_page = $page -1;
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G& amp;A=$A&room=$room&page=$prev_page\">$lan g_prev</a><br/>";
}
}
closedir($dp);
echo "<b>$file_count</b> $lang_smilies";
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\">$lang_chat</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
if ($gum=="online") {
echo "<card id=\"Online\" title=\"$lang_who_is_online ($_time)\">";
echo "<do type=\"options\" name=\"refresh\" label=\"$lang_chat\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room&r=".$New_Time."\" method=\"get\"/></do>";
echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
echo "<p align=\"left\">";
$xfile = @file("online/on$room");
$xfile = array_reverse($xfile);
$p = 25;
if ($npage == ""){$npage = "1";}
$countfile= count($xfile);
$first = $countfile - ($p * ($npage - 1));
$second = $countfile - ($p * $npage) + 1;
if ($second < 1) {$second = 1;}
$npages = ceil($countfile / $p);
if ($npage <= $npages and $npage>1) $gline_rew = "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room&npage=".($npage-1)."\">$lang_prev</a>";
if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&a mp;A=$A&room=$room&npage=".($npage+1)."\"> $lang_next</a>";
$nn=1;
for ($i = $first-1; $i >= $second-1; $i--) {
$udata = explode("!",$xfile[$i]);
if($udata[4]==m) $gender=$lang_male;
if($udata[4]==f) $gender=$lang_female;
print $nn++." <b>$udata[1]</b> $gender ($udata[5]) $udata[2]<br/>";
}
print"<br/>";
if ($npages>1)
print $gline_rew."| ".$gline_next;
echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&am p;A=$A&room=$room\">$lang_chat</a>";
echo "<br/>(c) GumSlone</p>";
echo "</card>";
}
function filterBadWords($str){
// words to filter, you can add here some more
$badwords=array( "****", "Bitch", "Dick", "Hitler", "Nazi", "Asshole", "Wichser");
// replace filtered words with
$replacements=array( "censored", "have a nice day");
for($i=0;$i < sizeof($badwords);$i++){
srand((double)microtime()*1000000);
$rand_key = (rand()%sizeof($replacements));
$str=eregi_replace($badwords[$i], $replacements[$rand_key], $str);
}
return $str;
}
function ReplaceTextToSmilies($str){
$dir = "smilies/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$smilie=explode(".",$file);
$str = str_replace('.'.$smilie[0].'.', '<img src="'.$dir.'/'.$file.'" alt=".'.$smilie[0].'." />', $str);
}
closedir($dh);
}
}
return $str;
}
function latrus($str) {
$tran = array(
"A"=>"А","a"=>"а","B"=>"Б","b"=>"б","V"=>"В",
"v"=>"в","G"=>"Г","g"=>"г","D"=>"Д","d"=>"д",
"E"=>"Е","e"=>"е","yo"=>"Ё","Zh"=>"Ж","zh"=>"ж ",
"Z"=>"З","z"=>"з","I"=>"И","i"=>"и","J"=>"Й",
"j"=>"й","K"=>"К","k"=>"к","L"=>"Л","l"=>"л",
"M"=>"М","m"=>"м","N"=>"Н","n"=>"н","O"=>"О",
"o"=>"о","P"=>"П","p"=>"п","R"=>"Р","r"=>"р",
"S"=>"С","s"=>"с","T"=>"Т","t"=>"т","U"=>"У",
"u"=>"у","F"=>"Ф","f"=>"ф","H"=>"Х","h"=>"х",
"C"=>"Ц","c"=>"ц","Ch"=>"Ч","ch"=>"ч","Sh"=>"Ш ",
"sh"=>"ш","Sch"=>"Щ","sch"=>"щ","''"=>"ъ",
"Y"=>"Ы","y"=>"ы","'"=>"ь","Ye"=>"Э",
"ye"=>"э","Yu"=>"Ю","yu"=>"ю","Ya"=>"Я","ya"=> "я",
"Yo"=>"ё"
);
return strtr($str,$tran);
}
///////////////////////////////////////////////////////////////////////////
// END OF SCRIPT ENJOY!
///////////////////////////////////////////////////////////////////////////
?>
</wml>
Comment