6 |
kaklik |
1 |
<?php
|
|
|
2 |
error_reporting(1);
|
|
|
3 |
if(function_exists('import_request_variables')){import_request_variables("gpc");$REMOTE_ADDR=$HTTP_SERVER_VARS['REMOTE_ADDR'];$PHP_SELF=$HTTP_SERVER_VARS['PHP_SELF'];}
|
|
|
4 |
error_reporting(8);
|
|
|
5 |
|
|
|
6 |
$version='2.2 [2005-04-08]'; // version number
|
|
|
7 |
|
|
|
8 |
$time_format='M d, H:i'; // set time format using proper attributes. details: http://www.php.net/date
|
|
|
9 |
$default_zone=0; // default timezone, 0=GMT
|
|
|
10 |
$refresh_rate='6:12:24:48:60'; // refresh rates (sec, 5 entries)
|
|
|
11 |
$default_rate=12; // default refresh rate (sec) [an Apache server with default settings closes the socket in 15 sec. With refresh rate 12 sec the socket will be reused.]
|
|
|
12 |
$password_field='text'; // ['text' or 'password'] - 'password' would display ****
|
|
|
13 |
$no_cache=0; // use random numbers in the address bar to prevent caching (1=yes, 0=no)
|
|
|
14 |
$check_space=0; // check free disk space before writing to a file (1=yes, 0=no, might cause problems on some servers)
|
|
|
15 |
$gzip=1; // use gzip compression (1=yes, 0=no) [try to turn this option on (1). if it works, the size of an ordinary chat page is less than 1kB]
|
|
|
16 |
$clear_chat=0; // clear each chatroom when the last user leaves (1=yes, 0=no)
|
|
|
17 |
$secret_word='blabla'; // secret word (whatever you wish, but it is ESSENTIAL 'blabla' to be changed!)
|
|
|
18 |
|
|
|
19 |
include 'incl/lang-en.inc'; // set a language file
|
|
|
20 |
$skin_dir='s-blue'; // skin directory (no trailing slashes)
|
|
|
21 |
$data_dir='data'; // data directory (no trailing slashes)
|
|
|
22 |
|
|
|
23 |
$bad_words=array('fuck','bitch'); // words which are not acceptable
|
|
|
24 |
|
|
|
25 |
$users_per_room=10; // users per room
|
|
|
26 |
$chat_lines=10; // lines in chat
|
|
|
27 |
$keep_lines=150; // history lines
|
|
|
28 |
$username_length=10; // set greater values (at least current*5) for Chinese, Japanese etc
|
|
|
29 |
$words_length=80; // -||- -||-
|
|
|
30 |
$entry_length=200; // -||- -||-
|
|
|
31 |
$full_length=600; // entry length + additional html tags (smilies etc)
|
|
|
32 |
|
|
|
33 |
$room_name='BlaB! Lite'; // name of the room
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
/*---------------------------------------------------------------------------*/
|
|
|
37 |
|
|
|
38 |
include "$skin_dir/skin.inc";
|
|
|
39 |
set_magic_quotes_runtime(0);
|
|
|
40 |
|
|
|
41 |
$log_file=$data_dir.'/room';
|
|
|
42 |
$usr_file=$data_dir.'/user';
|
|
|
43 |
$timestamp=time();
|
|
|
44 |
$random=mt_rand(1,999999);
|
|
|
45 |
|
|
|
46 |
function time_to_run(){$time=microtime();$time=explode(" ",$time);return $time[1]+$time[0];}$start_time=time_to_run();
|
|
|
47 |
$row_bg='a';function change_row_color(){global $row_bg;if($row_bg=='a'){$row_bg='b';}else{$row_bg='a';}}
|
|
|
48 |
function check_space(){$s=true;global $check_space;if(function_exists('disk_free_space')&&$check_space==1){$a=disk_free_space("/");if(is_int($a)&&$a<204800){$s=false;}}return $s;}
|
|
|
49 |
function show_pic($q,$a){$q=explode("|",$q);if(isset($q[0])&&isset($q[1])&&isset($q[2])&&isset($q[3])){global $skin_dir;print "<img src=\"$skin_dir/$q[0]\" width=\"$q[1]\" height=\"$q[2]\" border=\"0\" alt=\"$q[3]\" ";if(isset($q[4])&&strlen($q[4])>4){print "onmouseover=\"this.src='$skin_dir/$q[4]'\" onmouseout=\"this.src='$skin_dir/$q[0]'\"";}if(isset($a)&&strlen($a)>3){print " $a";}if(isset($q[5])&&strlen($q[5])>4){print " $q[5]";}print " />";}else{$q=implode(":",$q);print $q;}}if(!is_file('info.php')||filesize('info.php')!=1392){die('?');}
|
|
|
50 |
function open_file($q,$a){$fd=fopen($q,"r") or die('..');$fs=fread($fd,filesize($q));fclose($fd);if($a!=0){$fs=explode("\n",$fs);}return $fs;}
|
|
|
51 |
function save_file($q,$a,$o){if(check_space()){$a=trim($a);$a=str_replace("\n\n","\n",$a);if($a==''){$a=' ';}$m=0;do{$fd=fopen($q,"w") or die($o);$fout=fwrite($fd,$a);fclose($fd);$m++;}while(filesize($q)<1&&$m<5);}}
|
|
|
52 |
function clean_entry($q){$q=trim($q);$q=stripslashes($q);$q=str_replace("<","",$q);$q=str_replace(">","",$q);$q=str_replace("\r\n","",$q);$q=str_replace("\r","",$q);$q=str_replace("\n","",$q);$q=str_replace(":|:","",$q);return $q;}
|
|
|
53 |
function check_user(){global $name,$xpas,$secret_word;if(md5($name.$secret_word)!=$xpas){die("</head><body onload=\"parent.location='index.php?name=0'\"></body></html>");}}
|
|
|
54 |
function show_time($s){global $time_format,$time_offset;return gmdate($time_format,$s+$time_offset*3600);}
|
|
|
55 |
function refresh_online($n,$s){global $data_dir,$timestamp,$refresh_rate,$usr_file;$x=explode(':',$refresh_rate);$y=$x[count($x)-1];$y+=10;$j=0;$online=array();$fs=open_file($usr_file,1);for($i=0;$i<count($fs);$i++){if(isset($fs[$i])&&strlen($fs[$i])>9){$row=explode(":|:",$fs[$i]);settype($row[1],"integer");if(strtolower($n)!=strtolower($row[0])&&($timestamp-$row[1])<$y){$online[$j]=$fs[$i];$j++;}}}if($s!=0){$sf=implode("\n",$online);save_file($usr_file,$sf,0);}return $online;}
|
|
|
56 |
function remove_bad_words($w){global $bad_words;for($i=0;$i<count($bad_words);$i++){$w=eregi_replace($bad_words[$i],'***',$w);}return $w;}
|
|
|
57 |
|
|
|
58 |
if(isset($time_offset)){$time_offset=(int)$time_offset;}elseif(isset($blabtime)){$time_offset=(int)$blabtime;}else{$time_offset=$default_zone;}
|
|
|
59 |
$local_time=gmdate('H:i',time()+$time_offset*3600);
|
|
|
60 |
|
|
|
61 |
if(!is_writeable($log_file)){save_file($log_file,'','CHMOD /data to 777!');}
|
|
|
62 |
if(!is_writeable($usr_file)){save_file($usr_file,'','CHMOD /data to 777!');}
|
|
|
63 |
|
|
|
64 |
if(isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])){$browser=$HTTP_SERVER_VARS['HTTP_USER_AGENT'];}else{$browser='';}
|
|
|
65 |
|
|
|
66 |
if(stristr($browser,'msie')&&!stristr($browser,'opera')){
|
|
|
67 |
if(function_exists('ob_gzhandler')&&$gzip==1&&(stristr($PHP_SELF,'chat')||stristr($PHP_SELF,'admin')||stristr($PHP_SELF,'history'))){ob_start("ob_gzhandler");}
|
|
|
68 |
else{
|
|
|
69 |
if(!stristr($PHP_SELF,'smilies')&&!stristr($PHP_SELF,'top')&&!stristr($PHP_SELF,'bottom')){
|
|
|
70 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
|
71 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
72 |
header("Cache-Control: no-cache, must-revalidate");
|
|
|
73 |
header("Pragma: no-cache");}}}
|
|
|
74 |
|
|
|
75 |
else{
|
|
|
76 |
if(function_exists('ob_gzhandler')&&$gzip==1){ob_start("ob_gzhandler");}
|
|
|
77 |
if(!stristr($PHP_SELF,'smilies')&&!stristr($PHP_SELF,'top')&&!stristr($PHP_SELF,'bottom')){
|
|
|
78 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
|
79 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
80 |
header("Cache-Control: no-cache, must-revalidate");
|
|
|
81 |
header("Pragma: no-cache");}}
|
|
|
82 |
?>
|