Gumchat

Started on the old forum in October 2008 · view the original in the archive · old links redirect here

2 replies · 1,616 views · started 18 years ago · 1 min read

3 participants
spicysoul Newbie · 5 posts #1

pix the error ples

CODE

<? ///////////////////////////////////////////////////////////////////////////////////////////////// // // // 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 © 2006 GumSlone. All rights reserved. // // Additional scripts can be found at <http://www.wapforum.org.uk> // // 17.12.2006 // ///////////////////////////////////////////////////////////////////////////////////////////////// $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"; //$encoding="UTF-8"; $_translit="0"; $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... please wait"; $lang_exit="Logout"; 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\">";

<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 "

"; echo "<img src="logo.gif" alt="GumChat"/> "; $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! "; echo "$lang_nickname <input name="us" maxlength="20"/> "; echo $lang_gender.' <select name="g" multiple="false"> <option value="m">'.$lang_male.'</option> <option value="f">'.$lang_female.'</option> </select> '; echo"$lang_age<input name="a" maxlength="2" format="NN" size="2"/> "; echo $lang_show_smilies.' <select name="sm" multiple="false"> <option value="1">'.$lang_yes.'</option> <option value="0">'.$lang_no.'</option> </select> '; 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 "

<a href="$home_page_url">$home_page_title</a>"; echo " © GumSlone "; 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 " "; $nick = ereg_replace(" ", "", $nick); $nick = ereg_replace("!", "", $nick); if(preg_match("/[^\da-zA-Z-@_]+/", $nick)||$nick=="") $error='Not suported chars in Nickname! '; if(empty($error)){ echo "$lang_select_chatroom "; $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&A=$A&room=$file">$file [$counts]</a> "; } } } closedir($handle); } }else echo $error."<anchor>Back<prev/></anchor> "; echo " $total $lang_users $n $lang_chatrooms!"; echo " © GumSlone "; 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&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&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&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 " $lang_loading "; $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&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&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=$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&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&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 " "; 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&A=$A&room=$room&r="; echo $New_Time; echo "">$lang_refresh</a> ";

  $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@:%_\+.~#?&//=]+)','<#>', $udata[2]);
    $udata[2] = eregi_replace('([[:space:]()[{}])(<http://www.[-a-zA-Z0-9@:%_\+.~#?&//=]+>)','\\1[\\2](http://\\2)', $udata[2]);
    $udata[2] = filterBadWords($udata[2]);
    if($sm==1)$udata[2] = ReplaceTextToSmilies($udata[2]);
    if($_translit==1)latrus($udata[2]);

  echo"**".htmlspecialchars($udata[1])." »**

".$udata[2]." "; } 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&A=$A&room=$room&r="; echo $New_Time; echo "">$lang_refresh</a> "; echo "<a href="".$_SERVER["PHP_SELF"]."?gum=online&nick=$nick&sm=$sm&G=$G&A=$A&room=$room">$lang_who_is_online</a> "; echo "<a href="".$_SERVER["PHP_SELF"]."?gum=rooms&nick=$nick&sm=$sm&G=$G&A=$A">$lang_change_chatroom</a> "; echo "<a href="".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G&A=$A&room=$room">$lang_smilies</a> "; echo "<a href="".$_SERVER["PHP_SELF"]."">$lang_exit</a> "; echo " © GumSlone "; 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&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 " ";

    echo "$lang_message <input name=\"mess".$New_Time."\" maxlength=\"200\"/>

"; 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 " <a href="".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&A=$A&room=$room">$lang_chat</a>"; echo " © GumSlone "; 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&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 " ";

$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].".

";

                                    }
                            }

                    if (($file_count > 0) AND ($last_record < $file_count))
                            {
                            // next button
                            $next_page = $page + 1;
                            echo "

<a href="".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G&A=$A&room=$room&page=$next_page">$lang_next</a> "; } if (($file_count > 0) AND ($page != 0)) { // previous button $prev_page = $page -1; echo " <a href="".$_SERVER["PHP_SELF"]."?gum=smilies&nick=$nick&sm=$sm&G=$G&A=$A&room=$room&page=$prev_page">$lang_prev</a> "; }

                    }

closedir($dp); echo "$file_count $lang_smilies"; echo " <a href="".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&A=$A&room=$room">$lang_chat</a>"; echo " © GumSlone "; 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&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 " "; $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=$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=$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++." $udata[1] $gender ($udata[5]) $udata[2] "; } print" "; if ($npages>1) print $gline_rew."| ".$gline_next; echo " <a href="".$_SERVER["PHP_SELF"]."?gum=croom&nick=$nick&sm=$sm&G=$G&A=$A&room=$room">$lang_chat</a>"; echo " © GumSlone "; echo "</card>"; }

function filterBadWords($str){

// words to filter, you can add here some more $badwords=array( "Fuck", "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].'.', 'External image (may be gone)', $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>
WhiteWarrior Principal · 1,419 posts #3

Upload the original with cuteftp and do any edits by using the edit file option... edit what ever you want to without messing up any coding etc.. sometimes with that script if you edit with notepad etc.. it can mess up part of the coding what will make the site full of errors etc..

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close