bom pessoal eu tenho os arquivos aki do bate papo que eu baixei tudo já feito porem no arquivo de explicação ele dis pra fazer a configuração do php mysql.php3
Quem poder me ajudar a fazer essa conecção com meu servidor pois eu não estou conseguindo, e nem compreender os dados que esta pedindo, vou mandar pra vocês..
Ah outra questão é que o arquivo esta em extensão .php3 e estou com dificuldades sobre isso, me ajude ai galera.
Eu coloquei ai pra melhor visualização mais vocês podem baixar no scriptbrasil mesmo
$query = "SELECT id FROM chat_text_db ORDER BY date ASC LIMIT 0, $verschil;";
$res1 = mysql_query($query, $mysql_link);
while ($r = mysql_fetch_array($res1))
{
$ids .= $r["id"].",";
}
$ids = substr($ids, 0, strrpos($ids, ","));
mysql_query("DELETE FROM chat_text_db WHERE id IN ($ids);", $mysql_link);
}
$eerste = "nee";
$is_tekst = TRUE;
$username = user($mysql_link, $session);
$username = addslashes($username);
if ($session != "")
{
check_secure($mysql_link, $session);
if ($state==")
{
$state="started";
$eerste="já";
$readback = 10;
if ($lijst == "no") { $readback = 0; }
$query = "SELECT MAX(id)-$readback AS latestid FROM chat_text_db;";
$ids = mysql_query($query, $mysql_link);
$temp = mysql_fetch_array($ids);
$latestid = $temp["latestid];
if ($latestid != "") $is_tekst = TRUE;
if ($latestid == "") $is_tekst = FALSE;
}
$check_userlist = $userlist;
if ($is_tekst): // start if
// show chat messages
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND status = '50';";
$cm_result = mysql_query($query, $mysql_link);
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '0' ORDER BY date ASC;";
$result = mysql_query($query, $mysql_link);
// can this user see all private entries ?
$userlevel = user_level($mysql_link, $session);
if (!validate($userlevel, _readprivate))
{
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '$username' AND saidby != '$username' ORDER BY date ASC;";
$result2 = mysql_query($query, $mysql_link);
$is_god = FALSE;
}
else
{
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto != '0' AND saidto != '1' AND status != '50' ORDER BY date ASC;";
$result2 = mysql_query($query, $mysql_link);
$is_god = TRUE;
}
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto <> '0' AND saidby = '$username' AND saidto != '1' AND status != '50' ORDER BY date ASC;";
$result3 = mysql_query($query, $mysql_link);
$mods = FALSE;
if (validate($userlevel, _modmessages))
{
// get modmessages
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '1' ORDER BY date ASC;";
$result4 = mysql_query($query, $mysql_link);
$mods=TRUE;
}
$query = "SELECT MAX(id) AS latestid FROM chat_text_db;";
$query = "SELECT * FROM ipbans WHERE ip LIKE '%$REMOTE_ADDR%'";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) != 0)
{
$ipbanned = TRUE;
}
mysql_close($mysql_link);
// do browser check, IE only
$browser= $HTTP_USER_AGENT;
if (!eregi("MSIE", $browser))
{
?>
<html>
<script>
<!--
alert("Sorry, your browser is not able to view this chatbox, since I use kind of advanced techniques (D-HTML and loads of frames, which SHOULD work on other browsers, but as you guessed, they don't work...).\n\n You will need Internet Explorer (yeahyeah, it's MS, I know...) to be able to chat.\n\n\nLife's a bitch....");
//-->
</script>
You're amongst the 9% of internet users that doesn't use Internet Explorer... Sorry, but this chat won't work...
"...Nimm mir, nimm mir hart....", "Hmm....ich will dich..", "..lick meine Mushi....", "O já...ich komme.", "..já...komm mal...", "...Ich spritze meines riesiges Schwanz in dein gesicht ab!...");
"...ken wel janke....", "....wat een vent...", "...hij gaf geen kick.......", "....ik weet het nog goed...", "..al die nieuwerwetse zooi...", "...hebtie met z'n eigen handen gedaan...");
$words = array( "-Screw you, hippie-", "-fattass-", "-I hate you Kenny-", "-Oh my God, they killed kenny !!-", "-That is so gay-",
"-Screw you guys-", "-Ass sucker-", "-Uncle Fucker-", "-BEEFCAKE !!-", "-You bastards !!-", "-Spank my ass and call me charley-",
"-You little DILDO-", "-KICK THE BABY !!-", "-KICKASS-", "-You go to hell! You go to hell and you die!-", "-Ah, son of a bitch!-",
"-ass-master!-", "-You piece of crap, I'll kill you!-", "-Stan's dog's a homo-", "-shut up dude-", "-Stanley, gay people...well, gay people are evil-",
"-I'll kick you in the nuts!-", "-you shitfaced cockmaster!-", "-Suck my balls!-", "-SWEEET-", "-This chat has warped my fragile little mind-",
"-M’kay?-", "-Aw, crap!-", "-Ah! Fuckin’ weak, dude!-", "-Cheers, fuckface.-", "-Holy shit, dude!-", "-Hey, relax, guy!-", "-Dude, what the fuck is wrong with German people?-",
"-God? He is the biggest bitch of them all!-", "-Damn! Shit! Respect my fuckin’ authorita!-", "-blood drenched frozen tampon popsicle!-", "-Fuck! Shit! Cock! Ass! Shitty boner bitch! Muff! Pussy! Cock!-",
$query = "SELECT id FROM chat_text_db WHERE text = '$typed_text';";
$res = mysql_query($query, $mysql_link);
if (mysql_num_rows($res) > 2)
{
mysql_query("INSERT INTO chat_text_db(saidby, saidto, status, text, date) VALUES ('system', '0', 0, '$user_name is flooding and will therefore be killed', now());", $mysql_link);
?>
<script languague=JavaScript">
alert("You are flooding. Goodbye !");
window.parent.close();
</script>
<?
mysql_query("DELETE FROM chat_session_ids WHERE session_id = '$session';", $mysql_link);
Question
Mateus Conti
bom pessoal eu tenho os arquivos aki do bate papo que eu baixei tudo já feito porem no arquivo de explicação ele dis pra fazer a configuração do php mysql.php3
Quem poder me ajudar a fazer essa conecção com meu servidor pois eu não estou conseguindo, e nem compreender os dados que esta pedindo, vou mandar pra vocês..
Ah outra questão é que o arquivo esta em extensão .php3 e estou com dificuldades sobre isso, me ajude ai galera.
Eu coloquei ai pra melhor visualização mais vocês podem baixar no scriptbrasil mesmo
Link Download: https://www.scriptbrasil.com.br/script/php/chatengine.zip
Arquivos
blank.php3
control.php3
empty.htm
help.php3
includes.php3
index.php3
layout.php3
logout.php3
mysql.php3
password.php3
private.php3
process.php3
process_speak.php3
register.php3
ruler.php3
security.php3
showtext.php3
speak.php3
special_options.php3
title.php3
update.php3
users.php3
users_external.php3
A opçao Codigo não esta funcinando ta dando error então vou postar assim mesmo.
Primeiro vou postar o mysql.php3 que tem q configurar e eu não sei me ajudem principalmente nessa parte
mysql.php3------------------------------------------------------------------
<?
// MySQL + general info
// define constants
define("_hostname", "localhost"); // your database host
define("_username", ""); // your MySQL username
define("_userpassword", ""); // your MySQL password
define("_database", ""); // your MySQL database name
define("_timeout", 666); // idle time-out
define("_refresh", 5000); // refresh rate in milliseconds
?>
blank.php3-------------------------------------------------------------------
<?
// just a blank page
require("includes.php3");
?>
control.php3------------------------------------------------------------------
<html>
<?
if ($session != "") $extra_info = "onLoad=\"start_timer()\"";
require("includes.php3");
erase_is($mysql_link);
$saidby = addslashes($saidby);
$saidto = addslashes($saidto);
require("process.php3");
// erase old text from database
$query = "SELECT COUNT(*) AS aantal FROM chat_text_db;";
$res = mysql_fetch_array(mysql_query($query, $mysql_link));
$aantal = $res["aantal"];
$maxaantal = 50;
if ($aantal > $maxaantal)
{
$verschil = $aantal - $maxaantal;
$query = "SELECT id FROM chat_text_db ORDER BY date ASC LIMIT 0, $verschil;";
$res1 = mysql_query($query, $mysql_link);
while ($r = mysql_fetch_array($res1))
{
$ids .= $r["id"].",";
}
$ids = substr($ids, 0, strrpos($ids, ","));
mysql_query("DELETE FROM chat_text_db WHERE id IN ($ids);", $mysql_link);
}
$eerste = "nee";
$is_tekst = TRUE;
$username = user($mysql_link, $session);
$username = addslashes($username);
if ($session != "")
{
check_secure($mysql_link, $session);
if ($state==")
{
$state="started";
$eerste="já";
$readback = 10;
if ($lijst == "no") { $readback = 0; }
$query = "SELECT MAX(id)-$readback AS latestid FROM chat_text_db;";
$ids = mysql_query($query, $mysql_link);
$temp = mysql_fetch_array($ids);
$latestid = $temp["latestid];
if ($latestid != "") $is_tekst = TRUE;
if ($latestid == "") $is_tekst = FALSE;
}
$check_userlist = $userlist;
if ($is_tekst): // start if
// show chat messages
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND status = '50';";
$cm_result = mysql_query($query, $mysql_link);
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '0' ORDER BY date ASC;";
$result = mysql_query($query, $mysql_link);
// can this user see all private entries ?
$userlevel = user_level($mysql_link, $session);
if (!validate($userlevel, _readprivate))
{
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '$username' AND saidby != '$username' ORDER BY date ASC;";
$result2 = mysql_query($query, $mysql_link);
$is_god = FALSE;
}
else
{
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto != '0' AND saidto != '1' AND status != '50' ORDER BY date ASC;";
$result2 = mysql_query($query, $mysql_link);
$is_god = TRUE;
}
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto <> '0' AND saidby = '$username' AND saidto != '1' AND status != '50' ORDER BY date ASC;";
$result3 = mysql_query($query, $mysql_link);
$mods = FALSE;
if (validate($userlevel, _modmessages))
{
// get modmessages
$query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '1' ORDER BY date ASC;";
$result4 = mysql_query($query, $mysql_link);
$mods=TRUE;
}
$query = "SELECT MAX(id) AS latestid FROM chat_text_db;";
$ids = mysql_fetch_array(mysql_query($query, $mysql_link));
$latestid = $ids["latestid"];
$data = "";
$data2 = "";
$data3 = "";
while ($rec = mysql_fetch_array($cm_result))
{
$pr_cm = TRUE;
if ($rec["saidto"] == "ask_for_refresh")
{
?>
<script>
<!--
parent.users.document.location.href = 'users.php3?session=<? print($session); ?>';
//-->
</script>
<?
$pr_cm = FALSE;
}
if ($pr_cm)
{
js_alert("General chatmessage by ".addslashes($rec["saidby"]).":\\n\\n".addslashes($rec["text"]));
}
}
while ($record = mysql_fetch_array($result))
{
$data .= process_normal($mysql_link, $session, $record["saidby"], $record["saidto"], $record["text"], $record["status"]);
}
while ($record = mysql_fetch_array($result2))
{
$data2 .= process_private($mysql_link, $session, $record["saidby"], $record["saidto"], $record["text"]);
}
while ($record = mysql_fetch_array($result3))
{
$data3 .= process_private($mysql_link, $session, $record["saidby"], $record["saidto"], $record["text"]);
}
if ($mods)
{
while ($record = mysql_fetch_array($result4))
{
$data4 .= process_mod($mysql_link, $session, $record["saidby"], $record["saidto"], $record["text"]);
}
}
// add slashes to data
$data = addslashes($data);
$data2 = addslashes($data2);
$data3 = addslashes($data3);
if ($mods) $data4 = addslashes($data4);
endif; // end if
if (!$is_tekst) $latestid = 0;
$encodedurl = urlencode($latestid);
// make userlist
$userlist = "";
$add_tag = "WHERE status_online <> 99";
if (validate($userlevel, _canseeinvisible)) $add_tag=";
$query = "SELECT login FROM chat_session_ids $add_tag ORDER BY id;";
$idresult = mysql_query($query, $mysql_link);
while ($recc = mysql_fetch_array($idresult))
{
$userlist .= $recc["login].",";
}
?>
<script>
<!--
function do_print()
{
<?
if ($eerste=="já")
{
// stuur de algemene startup header door
$gen_header = "<style>";
$gen_header .= "body { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 12px ; scrollbar-base-color:black;scrollbar-arrow-color:black }";
$gen_header .= "td { font-family : tahoma ; font-size: 14px }";
$gen_header .= "input.typetext { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 14px }";
$gen_header .= "select.typetext { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 14px }";
$gen_header .= "b.user { line-height: 16px; background-color: #000000; color: #A13834 ; font-family : tahoma ; font-size: 12px; position: relative; left:0px}";
$gen_header .= "b.text { line-height: 16px; background-color: #000000; color: #white; font-family : tahoma ; font-weight: normal}";
$gen_header .= "b.pr { line-height: 16px; background-color: #000000; color: gold ; font-family : tahoma ; font-weight: normal}";
$gen_header .= "b.system { line-height: 16px; background-color: #000000; color: gray ; font-family : tahoma ; font-weight: normal; position : relative; left:0px}";
$gen_header .= "b.private { line-height: 16px; background-color: #000000; color: gray ; font-family : tahoma ; font-weight: normal}";
$gen_header .= "</style><body>";
$gen_header = eregi_replace("\n", "", $gen_header);
print("parent.content.document.writeln(\"".$gen_header."\");");
print("parent.private.document.writeln(\"".$gen_header."\");");
}
?>
<?
if ($is_tekst):
if (mysql_num_rows($result) > 0)
{
?>
parent.content.document.writeln("<? print($data); ?>");
parent.content.scrollBy(0, 100);
<?
}
if (mysql_num_rows($result2) > 0)
{
?>
parent.private.document.writeln("<? print($data2); ?>");
parent.private.scrollBy(0, 100);
<?
}
if ((mysql_num_rows($result3) > 0) AND (!$is_god))
{
?>
parent.private.document.writeln("<? print($data3); ?>");
parent.private.scrollBy(0, 100);
<?
}
if (($mods) AND (mysql_num_rows($result4) > 0))
{
?>
parent.private.document.writeln("<? print($data4); ?>");
parent.private.scrollBy(0, 100);
<?
}
if ($check_userlist != $userlist)
{
?>
parent.users.document.location.href = 'users.php3?session=<? print($session); ?>';
<?
}
endif;
?>
}
function update_now()
{
document.update_this.submit();
}
function start_timer()
{
self.setTimeout('update_now()', <? print(_refresh); ?>);
}
//-->
</script>
<body onLoad="document.update_this.page_loaded.value = '1'; do_print(); start_timer()" bgcolor="black">
<form name="update_this" action="<? print($scriptnaam); ?>" method="post">
<input type="hidden" name="session" value="<? print($session); ?>">
<input type="hidden" name="state" value="started">
<input type="hidden" name="latestid" value="<? print($encodedurl); ?>">
<input type="hidden" name="userlist" value="<? print($userlist); ?>">
<input type="hidden" name="check_userlist" value="<? print($check_userlist); ?>">
<input type="hidden" name="page_loaded" value="0">
</form>
<?
end_page($mysql_link);
}
if ($session == "")
{
?>
<body bgcolor="black">
<?
}
// end
?>
empty.htm--------------------------------------------------------------------------
<html>
<body style="background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt ; font-weight : bold ; margin-top : 0px ; margin-right : 0px ; margin-left : 5px ; margin-bottom : 0px">
</body>
</html>
help.php3------------------------------------------------------------------------------
<?
if ($item == "") $item = 0;
$extra_info = "style=\"scrollbar-base-color:black;scrollbar-arrow-color:black\"";
require("includes.php3");
function show_main()
{
?>
<b>Main topics:</b><br><br>
<a href="help.php3?item=1">General chatting</a><br>
<a href="help.php3?item=2">Special commands</a><br>
<a href="help.php3?item=3">Logging out</a><br>
<a href="help.php3?item=5">Using icons</a><br>
<br>
<a href="help.php3?item=4">Credits</a><br>
<br>
<br>
<?
}
function back_to_main()
{
?>
<br><br>
<a href="help.php3?item=0">back to main</a>
<?
}
function show_general()
{
?>
<b>General chatting:</b><br><br>
<font color="#FFFFCC">
Chatting is easy. Just type your sentence into the text box and press enter or click speak.
If you want to send a message to somebody special, select that person's name in the "to" list.
</font>
<?
back_to_main();
}
function show_commands()
{
?>
<b>Special commands:</b><br><br>
<font color="#FFFFCC">
Right now you can use:<br><br>
-<b><span style="color:red">!brb</span></b> to show an "away" message<br>
-<b><span style="color:red">!back</span></b> to show a "back" message<br>
-<b><span style="color:red">!me</span></b> to speak as "third person"<br>
-<b><span style="color:red">!greet</span></b> to greet the chat<br>
</font>
<?
back_to_main();
}
function show_loggingout()
{
?>
<b>Logging out:</b><br><br>
<font color="#FFFFCC">
Logging out doesn't require you to do anything special. Just close the chatwindow and you're done.
</font>
<?
back_to_main();
}
function using_icons()
{
?>
<b>Using icons:</b><br><br>
<font color="#FFFFCC">
You can use icons (see <a href="help.php3?item=2">Special commands</a>) to show small icons.
But there are limits to the use of these icons: you can use a maximum of two icons (that are not
the same) per line you write. If you use more than one icon of the same kind, you will get an
error message. This was merely implemented to keep users from flooding.
</font>
<?
back_to_main();
}
function credits()
{
?>
<b>Credits:</b><br><br>
<font color="#FFFFCC">
Programming:<br><b>Michiel Papenhove</b><br>
<a href="mailto:mipa@we-h8-u.com">e-mail</a><br><br>
</font>
<?
back_to_main();
}
function show_help($mysql_link, $item)
{
switch ($item)
{
case "0": show_main(); break;
case "1": show_general(); break;
case "2": show_commands(); break;
case "3": show_loggingout(); break;
case "4": credits(); break;
case "5": using_icons(); break;
}
}
?>
<table bgcolor="#555555" border="0" width="100%" height="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top">
<table border="0" bgcolor="#000000" width="100%" height="100%" cellpadding="5">
<tr>
<td valign="top">
<p><font size="1">Help:</font></p>
<? show_help($mysql_link, $item); ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
// end
?>
includes.php3--------------------------------------------------------------------------------------
<?
// includes.php3
require("mysql.php3");
// version
define("_version", "1.9");
define("_programming", "Michiel Papenhove");
define("_design", "Michiel Papenhove");
define("_chatboxname", "-- your chatbox name here --");
// userlevel constants
define("_striphtml", "0,1,3"); // html is stripped for these groups
define("_readprivate", "2,100"); // these groups can read privates
define("_cankick", "2,1,100"); // these groups can kick
define("_unkickable", "2,100"); // these groups are unkickable
define("_specialoptions", "2,100"); // these groups can access the special options
define("_modmessages", "2,1,100"); // these groups can see modmessages
define("_allowsilentlogin", "2,100"); // these groups can silently login
define("_canseeinvisible", "2,100"); // these groups can see invisible users
define("_god", "100"); // define the god level
// groups
define("sysops", "2,9,100"); // sysop group
define("moderators", "1"); // moderator group
define("special", "3"); // special group
// connect to database
$mysql_link = mysql_connect(_hostname, _username, _userpassword);
mysql_select_db(_database, $mysql_link);
$gods = array("yournick"); // define the god nicks
$mipa = "yournick"; // define the mega mega mega god's nick :-)
// determine scriptname
$scriptname = substr($PHP_SELF, strrpos($PHP_SELF, "/")+1 );
// include basic layout elements
require("layout.php3");
// session functions
function check_timeout($mysql_link, $session)
{
$query = "SELECT UNIX_TIMESTAMP(now())- UNIX_TIMESTAMP(last_action)) AS verschil FROM chat_session_ids WHERE session_id = '$session';";
$result = mysql_fetch_array(mysql_query($query, $mysql_link));
if ($result["verschil"] > _timeout)
{
?>
<script>
<!--
parent.document.location.href = "index.php3";
//-->
</script>
<?
}
}
function check_secure($mysql_link, $session)
{
global $chatSessionCookie;
$username = user($mysql_link, $session);
$query = "SELECT * FROM chat_session_ids WHERE session_id = '$session';";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) == 0)
{
?>
<script>
<!--
parent.document.location.href = "index.php3";
//-->
</script>
<?
exit;
}
}
function user($mysql_link, $session)
{
$query = "SELECT login FROM chat_session_ids WHERE session_id = '$session';";
$result = mysql_fetch_array(mysql_query($query, $mysql_link));
return $result["login"];
}
function user_level($mysql_link, $session)
{
$query = "SELECT userlevel FROM chat_session_ids WHERE session_id = '$session';";
$result = mysql_query($query, $mysql_link);
$usertemp = mysql_fetch_array($result);
$userl = $usertemp["userlevel"];
return $userl;
}
function validate($item, $haystack)
{
$val_array = split(",", $haystack);
$validated = FALSE;
while (list ($vkey, $vval) = each($val_array))
{
if ($vval == $item)
{
$validated = TRUE;
break;
}
}
return $validated;
}
function status_online($mysql_link, $session)
{
$query = "SELECT status_online FROM chat_session_ids WHERE session_id = '$session'";
$result = mysql_fetch_array(mysql_query($query, $mysql_link));
return $result["status_online"];
}
function system_message($mysql_link, $mesg)
{
$query = "INSERT INTO chat_text_db(saidby, saidto, status, text, date) ";
$query .=VALUES ('system', '0', 0, '$mesg', now());";
mysql_query($query, $mysql_link);
}
function clean_up($mysql_link)
{
$query = "SELECT login FROM chat_session_ids;";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) == 0)
{
mysql_query("DELETE FROM chat_text_db;", $mysql_link);
}
}
// perform actions
function js($strng)
{
?>
<script>
<!--
parent.content.document.writeln('<? print($strng); ?>');
//-->
</script>
<?
}
function js_alert($strng)
{
?>
<script>
<!--
alert('<? print($strng); ?>');
//-->
</script>
<?
}
function erase_is($mysql_link)
{
// erase invalid sessions
$query = "SELECT login FROM chat_session_ids WHERE UNIX_TIMESTAMP(last_action) < (UNIX_TIMESTAMP(NOW()) - "._timeout.") AND status_online <> 99;";
$result = mysql_query($query, $mysql_link);
$query = "DELETE FROM chat_session_ids WHERE UNIX_TIMESTAMP(last_action) < (UNIX_TIMESTAMP(NOW()) - "._timeout.") AND status_online <> 99;";
mysql_query($query, $mysql_link);
while($reccie = mysql_fetch_array($result))
{
system_message($mysql_link,$reccie["login]." was logged out due to inactivity");
}
// end erase
}
function update_stats($mysql_link, $username, $stat_name, $inc)
{
// check if record exists
$username = addslashes($username);
$query = "SELECT nick FROM chat_stats WHERE nick = '$username';";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) == 0)
{
// does not exist, make new one
mysql_query("INSERT INTO chat_stats (nick, started_at) VALUES ('$username', now());", $mysql_link);
}
$query = "UPDATE chat_stats SET $stat_name = $stat_name + $inc WHERE nick = '$username';";
mysql_query($query, $mysql_link);
}
?>
index.php3-----------------------------------------------------------------------------------
<?
require("mysql.php3");
$mysql_link = mysql_connect(_hostname, _username, _userpassword);
mysql_select_db(_database, $mysql_link);
// check for banned IP
$ipbanned = false;
$query = "SELECT * FROM ipbans WHERE ip LIKE '%$REMOTE_ADDR%'";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) != 0)
{
$ipbanned = TRUE;
}
mysql_close($mysql_link);
// do browser check, IE only
$browser= $HTTP_USER_AGENT;
if (!eregi("MSIE", $browser))
{
?>
<html>
<script>
<!--
alert("Sorry, your browser is not able to view this chatbox, since I use kind of advanced techniques (D-HTML and loads of frames, which SHOULD work on other browsers, but as you guessed, they don't work...).\n\n You will need Internet Explorer (yeahyeah, it's MS, I know...) to be able to chat.\n\n\nLife's a bitch....");
//-->
</script>
You're amongst the 9% of internet users that doesn't use Internet Explorer... Sorry, but this chat won't work...
</html>
<?
exit;
}
?>
<html>
<title>Your chat title here</title>
<frameset rows="20,*, 15" frameborder="no" border="0">
<frame src="title.php3" name="title" frameborder="no" border="0" scrolling="no" noresize>
<frameset cols="10, 2, * ,150" border="0">
<frame src="empty.htm" name="links" frameborder="no" border="0" scrolling="no" noresize>
<frame src="ruler.php3" name="links" frameborder="no" border="0" scrolling="no" noresize>
<frameset rows="15, *, 15, 100, 15, 50, 15, 0" border="0">
<frame src="ruler.php3?txt=Public+messages:&type=0" name="publicheader" frameborder="no" border="0" scrolling="no" noresize>
<frame src="security.php3" name="content" frameborder="no" border="0" noresize>
<frame src="ruler.php3?txt=Private+messages:&type=1" name="privateheader" frameborder="no" border="0" scrolling="no" noresize>
<frame src="private.php3" name="private" frameborder="no" border="0" noresize>
<frame src="ruler.php3?txt=Controls:" name="header" frameborder="no" border="0" scrolling="no" noresize>
<frame src="speak.php3" name="type" frameborder="no" border="0" noresize>
<frame src="ruler.php3" name="header" frameborder="no" border="0" scrolling="no" noresize>
<frame src="control.php3" name="control" frameborder="no" border="0" noresize>
</frameset>
<frameset rows="50%, 50%" frameborder="no" border="0">
<frame src="users.php3" name="users" frameborder="no" border="0">
<frame src="help.php3" name="help" frameborder="no" border="0">
</frameset>
</frameset>
<frame src="empty.htm" name="empty" frameborder="no" border="0" scrolling="no">
</frameset><noframes></noframes>
</html>
<?
?>
layout.php3-------------------------------------------------------------------------------------------------
<?
// layout.php3
// function end_page()
function end_page($mysql_link)
{
?>
</body>
</html>
<?
}
// end function end_page()
if (($scriptname != "control.php3")):
?>
<html>
<title><? print($page_title); ?></title>
<style>
body { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 10pt ; margin-top : 0px ; margin-right : 0px ; margin-left : 0px ; margin-bottom : 0px ;}
td { font-family : tahoma ; font-size: 8pt }
input.text { background-color: #ffffff; color: #000000 ; font-family : tahoma ; font-size: 8pt ; }
input.blacktext { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt ; border : 1px, solid ; border-color : #555555 ;}
input.button { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt ; border : 1px, solid}
input.submit { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt ; border : 1px, solid}
#typetext { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt ; border : 1px, solid}
select.typetext { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt ; border : 1px, solid}
a:link { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt }
a:active { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt }
a:visited { background-color: #000000; color: #ffffff ; font-family : tahoma ; font-size: 8pt }
a.b1:link { background-color: #000000; color: red; font-family : tahoma ; font-size: 8pt; text-decoration: underline }
a.b1:active { background-color: #000000; color: red; font-family : tahoma ; font-size: 8pt; text-decoration: underline }
a.b1:visited { background-color: #000000; color: red; font-family : tahoma ; font-size: 8pt; text-decoration: underline }
a.b1:hover { background-color: #FFFCC; color: white; font-family : tahoma ; font-size: 8pt; text-decoration: underline }
</style>
<body <? print($extra_info); ?>>
<?
endif;
// end
?>
logout.php3-----------------------------------------------------------------------------------------------------------------------
<?
$extra_info = "onLoad=\"position_window(); window.close(); \"";
require("includes.php3");
?>
<script>
<!--
function position_window()
{
var sAvailH = screen.availHeight;
var sAvailW = screen.availWidth;
window.moveTo( (sAvailW/2)-200, (sAvailH/2)-25);
}
//-->
</script>
<?
$username = "";
$status_online = 0;
$username = user($mysql_link, $session);
// get status_online
$query = "SELECT status_online FROM chat_session_ids WHERE session_id = '$session';";
$ures = mysql_query($query, $mysql_link);
if ($ures)
{
$urec = mysql_fetch_array($ures);
$status_online = $urec["status_online"];
}
if ($add_message != "")
{
$add_message = "(".$add_message.")";
}
if ($username != "")
{
if ($status_online <> 99)
{
system_message($mysql_link,"$username logged out");
}
}
// log user out
$query = "DELETE FROM chat_session_ids WHERE session_id = '$session';";
mysql_query($query, $mysql_link);
end_page($mysql_link);
?>
password.php3---------------------------------------------------------------------------------------------------------------
<?
// password.php3
// change user's password
$extra_info = "onLoad=\"position_window();\"";
$page_title = "Change your password";
require("includes.php3");
function show_form($mysql_link)
{
global $scriptname, $session;
?>
<script>
<!--
function check_form()
{
if (document.password_form.c_password.value == "")
{
alert("Please supply your old password");
document.password_form.c_password.focus();
return;
}
if (document.password_form.n_password.value == "")
{
alert("Please supply your new password");
document.password_form.n_password.focus();
return;
}
document.password_form.submit();
}
//-->
</script>
<form name=password_form" action="<? print($scriptname); ?>">
<table border="0">
<tr>
<td width="150">
<b>Current password:</b>
</td>
<td>
<input type="password" name="c_password" value="" class="typetext" size="17" maxlength="50">
</td>
</tr>
<tr>
<td>
<b>New password:</b>
</td>
<td>
<input type="password" name="n_password" value="" class="typetext" size="17" maxlength="50">
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="hidden" name="action" value="change_password">
<input type="hidden" name="session" value="<? print($session); ?>">
<input type="button" class="button" onClick="check_form()" value="register">
</td>
</tr>
</table>
<?
}
function change_password($mysql_link, $c_password, $n_password, $session)
{
// check if old password matches database entry
$username = user($mysql_link, $session);
$username = addslashes($username);
$query = "SELECT password FROM chat_users WHERE login = '$username'";
$record = mysql_fetch_array(mysql_query($query, $mysql_link));
if ($record["password] != $c_password)
{
js_alert("The password you entered as your old password is not valid !");
show_form($mysql_link);
return;
}
// valid, change password
$query = "UPDATE chat_users SET password = '$n_password' WHERE login = '$username';";
mysql_query($query, $mysql_link);
{
js_alert("Your password has been changed.");
?>
<script>
<!--
window.close();
//-->
</script>
<?
return;
}
}
?>
<table bgcolor="#555555" border="0" width="100%" height="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top">
<table border="0" bgcolor="#000000" width="100%" height="100%" cellpadding="5">
<tr>
<td valign="top">
<p><font size="1"><b>Change your password:</b></font></p>
<?
switch($action)
{
case "": show_form($mysql_link); break;
case "change_password": change_password($mysql_link, $c_password, $n_password, $session); break;
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script>
<!--
function position_window()
{
var sAvailH = screen.availHeight;
var sAvailW = screen.availWidth;
window.moveTo( (sAvailW/2)-225, (sAvailH/2)-100);
}
//-->
</script>
<?
end_page($mysql_link);
?>
private.php3--------------------------------------------------------------------------------------------------------
<?
// just another blank page
require("includes.php3");
?>
process.php3------------------------------------------------------------------------------------------------------
<?
// process.php3
// included in control.php3
function bre()
{
return("<br>");
}
function process_normal($mysql_link, $session, $saidby, $saidto, $text, $status)
{
// pre-process
if ($status == 1)
{
$text = eregi_replace("!me", "", $text);
$total = "<b class=\"pr\" style=\"position: relative; left:0px\">".$saidby.$text."</b>";
return $total."<br>";
}
if ($status == 2)
{
$text = eregi_replace("!me", "", $text);
$total = "<b style=\"color:lightblue; position: relative; left:0px\">".$saidby." will be right back</b>";
return $total."<br>";
}
if ($status == 3)
{
$text = eregi_replace("!back", "", $text);
$total = "<b style=\"color:lightblue; position: relative; left:0px\"\">".$saidby." is back</b>";
return $total."<br>";
}
if ($status == 4)
{
$text = eregi_replace("!greet", "", $text);
$total = "<b style=\"color:blue; position: relative; left:0px\"\">".$saidby." greets the chat</b>";
return $total."<br>";
}
if ($saidby == "system")
{
$total = "<b class=\"system\" style=\"position: relative; left:0px\">".$text."</b>";
return $total."<br>";
}
//
$userlevel = user_level($mysql_link, $session);
// make line
$name = "<b class=\"user\">$saidby: </b><b class=\"text\">";
$total = $name.$text."</b><br>";
return $total;
}
function process_private($mysql_link, $session, $saidby, $saidto, $text)
{
$userlevel = user_level($mysql_link, $session);
$text = strip_tags($text);
$query = "SELECT color FROM chat_users WHERE login='$saidby'";
$bcolors = mysql_fetch_array(mysql_query($query, $mysql_link));
$query = "SELECT color FROM chat_users WHERE login='$saidto'";
$tcolors = mysql_fetch_array(mysql_query($query, $mysql_link));
// make line
$name = "<b style=\"position : relative; left:0px\">Private by <b style=\"color:".$bcolors["color"]."\">$saidby</b> to <b style=\"color:".$tcolors["color"]."\">".stripslashes($saidto).": </b>";
$total = $name."<b class=\"pr\">".$text."</b></b><br>";
return $total;
}
function process_mod($mysql_link, $session, $saidby, $saidto, $text)
{
$userlevel = user_level($mysql_link, $session);
$text = strip_tags($text);
$query = "SELECT color FROM chat_users WHERE login=$saidby'";
$bcolors = mysql_fetch_array(mysql_query($query, $mysql_link));
// make line
$total = "<b style=\"position: relative; left:0px\"><b style=\"color:green\">Modmessage by</b> <b style=\"color:".$bcolors["color]."\">$saidby</b>: ".$text."</b></b><br>";
return $total;
}
?>
process_speak.php3--------------------------------------------------------------------------------------------------
<?
// process_speak.php3
function crap($text)
{
$pool = "!@ #$%^&*() oaeiuoae eiuo";
srand((double)microtime()*1000000);
$strng = "";
for ($f = 0; $f < strlen($text); $f++)
{
$randval = rand(0,strlen($pool));
$strng .= substr($pool, $randval, 1);
}
return $strng;
}
function no_spaces($text)
{
$text = eregi_replace(" ", "", $text);
return $text;
}
function reverse($text)
{
$text = strrev($text);
return $text;
}
function yell($text)
{
$text = "<b>".strtoupper($text)."</b>";
return $text;
}
function stutter($text)
{
$words = split(" ", $text);
$aantal = count($words);
$new_text = "";
for ($f = 0; $f < $aantal; $f++)
{
// pak eerste letter
if (strlen($words[$f]) > 1)
{
$letter = substr($words[$f], 0, 1);
$words[$f] = $letter."-".$letter."-".$letter."-".$words[$f];
}
$new_text .= $words[$f]." ";
}
return $new_text;
}
function nerdie($text)
{
$text = eregi_replace("e", "3", $text);
$text = eregi_replace("i", "1", $text);
$text = eregi_replace("a", "@", $text);
$text = eregi_replace("o", "0", $text);
$text = eregi_replace("s", "5", $text);
return $text;
}
function swear($text)
{
srand((double)microtime()*1000000);
$words = array( "-FUCK!-", "-COCKSUCKER!-", "-ASSHOLE!-", "-CUNT!-", "-BITCH!-",
"-WHORE!-", "-SLUT!-", "-GODDAMN!-", "-MOTHERFUCKER!-", "-DICK!-");
$aantal = count($words);
$lengte = strlen($text);
$new_text = "";
for ($f = 0; $f < $lengte; $f++)
{
$letter = substr($text, $f, 1);
$rval = rand(0, 15);
if ($rval < 2)
{
$letter .= $words[rand(0, $aantal)];
}
$new_text .= $letter;
}
return $new_text;
}
function porn($text)
{
srand((double)microtime()*1000000);
$words = array( "....hmmm....weiter...", "....já weiter!.....", "....mmmmmmmmm...", "..Fick mich, du geiles luder..", "...Lick meine natte Arsloch..",
"...Nimm mir, nimm mir hart....", "Hmm....ich will dich..", "..lick meine Mushi....", "O já...ich komme.", "..já...komm mal...", "...Ich spritze meines riesiges Schwanz in dein gesicht ab!...");
$aantal = count($words);
$lengte = strlen($text);
$new_text = "";
for ($f = 0; $f < $lengte; $f++)
{
$letter = substr($text, $f, 1);
if ($letter == " ")
{
$randval = rand (0, 15);
if ($randval < 5)
{
$letter .= ".<i>".$words[rand(0, $aantal)]."</i>.";
}
}
$new_text .= $letter;
}
return $new_text;
}
function no_vowels($text)
{
$text = eregi_replace("[aAeEiIuUoO]", "", $text);
return $text;
}
function ome_jo($text)
{
srand((double)microtime()*1000000);
$words = array( "...Hee hallo..", "...nee....é..já...", "..hoe gaat het..", "....wat moffe duike....", ".....met jou?....",
"...ken wel janke....", "....wat een vent...", "...hij gaf geen kick.......", "....ik weet het nog goed...", "..al die nieuwerwetse zooi...", "...hebtie met z'n eigen handen gedaan...");
$aantal = count($words);
$lengte = strlen($text);
$new_text = "";
for ($f = 0; $f < $lengte; $f++)
{
$letter = substr($text, $f, 1);
if ($letter == " ")
{
$randval = rand (0, 15);
if ($randval < 10)
{
$letter .= ".<i>".$words[rand(0, $aantal)]."</i>.";
}
}
$new_text .= $letter;
}
return $new_text;
}
function nazi($text)
{
srand((double)microtime()*1000000);
$words = array( "-AUFMACHEN!!!!-", "-WASS IST DAS???-", "-GEGEN DIE MAUER!!!-", "-SCHNELL!!!!-", "-LINKS, RECHTS, LINKS, RECHTS!!!!-",
"-JAWOHL!!!!-", "-ICH HABE ES NICHT GEWUST!!!!-");
$aantal = count($words);
$lengte = strlen($text);
$new_text = "";
for ($f = 0; $f < $lengte; $f++)
{
$letter = substr($text, $f, 1);
if ($letter == " ")
{
$randval = rand (0, 15);
if ($randval < 10)
{
$letter .= ".<i>".$words[rand(0, $aantal)]."</i>.";
}
}
$new_text .= $letter;
}
return $new_text;
}
function maroc($text)
{
srand((double)microtime()*1000000);
$words = array( "-wat moetzje dan??-", "-waar izz die jonco??-", "-jij kaikt naar mai-", "-dazz mooie maisje!!!-", "-jij tyfuzzz zzsjlet-",
"-allah akbar-", "-wat izzsjer dan??-", "-kom dan!!!-", "-ik weet waar je huisj woont-");
$aantal = count($words);
$lengte = strlen($text);
$new_text = "";
for ($f = 0; $f < $lengte; $f++)
{
$letter = substr($text, $f, 1);
// voeg scheldwoord toe of niet
if ($letter == " ")
{
$randval = rand (0, 15);
if ($randval < 10)
{
$letter .= ".<i>".$words[rand(0, $aantal)]."</i>.";
}
}
$new_text .= $letter;
}
return $new_text;
}
function southpark($text)
{
srand((double)microtime()*1000000);
$words = array( "-Screw you, hippie-", "-fattass-", "-I hate you Kenny-", "-Oh my God, they killed kenny !!-", "-That is so gay-",
"-Screw you guys-", "-Ass sucker-", "-Uncle Fucker-", "-BEEFCAKE !!-", "-You bastards !!-", "-Spank my ass and call me charley-",
"-You little DILDO-", "-KICK THE BABY !!-", "-KICKASS-", "-You go to hell! You go to hell and you die!-", "-Ah, son of a bitch!-",
"-ass-master!-", "-You piece of crap, I'll kill you!-", "-Stan's dog's a homo-", "-shut up dude-", "-Stanley, gay people...well, gay people are evil-",
"-I'll kick you in the nuts!-", "-you shitfaced cockmaster!-", "-Suck my balls!-", "-SWEEET-", "-This chat has warped my fragile little mind-",
"-M’kay?-", "-Aw, crap!-", "-Ah! Fuckin’ weak, dude!-", "-Cheers, fuckface.-", "-Holy shit, dude!-", "-Hey, relax, guy!-", "-Dude, what the fuck is wrong with German people?-",
"-God? He is the biggest bitch of them all!-", "-Damn! Shit! Respect my fuckin’ authorita!-", "-blood drenched frozen tampon popsicle!-", "-Fuck! Shit! Cock! Ass! Shitty boner bitch! Muff! Pussy! Cock!-",
"-Butthole! Barbara Streisand!");
$aantal = count($words);
$lengte = strlen($text);
$new_text = "";
for ($f = 0; $f < $lengte; $f++)
{
$letter = substr($text, $f, 1);
if ($letter == " ")
{
$randval = rand (0, 15);
if ($randval < 5)
{
$letter .= ".<i>".$words[rand(0, $aantal)]."</i>.";
}
}
$new_text .= $letter;
}
return $new_text;
}
function shut_up($text)
{
$text = "<font color=\"Red\">This user is in shut-up mode</font>";
return $text;
}
?>
register.php3-----------------------------------------------------------------------------------------------------
<?
$extra_info = "onload=\"position_window(); document.register_user.nick.focus()\"";
$page_title = "Register new nick";
require("includes.php3");
function register_form($mysql_link)
{
global $scriptname;
?>
<script>
<!--
function check_form()
{
if (document.register_user.nick.value == "")
{
alert("Please supply a nick");
document.register_user.nick.focus();
return;
}
if (document.register_user.e_mail.value == "")
{
alert("Please supply a valid e-mailaddress");
document.register_user.e_mail.focus();
return;
}
if (document.register_user.real_name.value == "")
{
alert("Please supply your real name");
document.register_user.real_name.focus();
return;
}
document.register_user.submit();
}
//-->
</script>
<font color=#FFFCC">
Please enter your desired nick and the e-mailaddress where we need to send you
your password to. If you supply a fake e-mailaddress, you will not receive your
password and you won't be able to log in.<br>
</font>
<form name="register_user" method="get" action="<? print($scriptname); ?>">
<table border="0">
<tr>
<td width="150">
<b>Nick:</b>
</td>
<td>
<input type="text" name="nick" value="" class="typetext" size="17" maxlength="17">
</td>
</tr>
<tr>
<td>
<b>E-mail address:</b>
</td>
<td>
<input type="text=" name="e_mail" value="" class="typetext" size="17">
</td>
</tr>
<tr>
<td>
<b>Real name:</b>
</td>
<td>
<input type="text=" name="real_name" value="" size="17">
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="hidden" name="action" value="check_register">
<input type="button" class="button" onClick="check_form()" value="register">
</td>
</tr>
</table>
</form>
<?
}
function check_register($mysql_link, $nick, $e_mail, $real_name)
{
// check if the nick isn't taken
$query = "SELECT login FROM chat_users WHERE login = '$nick'";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) != 0)
{
js_alert("Sorry, that nick has already been taken.");
register_form($mysql_link);
return;
}
// check if e-mailaddress already exists
$query = "SELECT e_mail FROM chat_users WHERE e_mail = '$e_mail'";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) != 0)
{
js_alert("That e-mailaddress has already been used to register a nick");
register_form($mysql_link);
return;
}
// add new user nick to database
$items = "abcdefghijklmnopqrstuvwxyz";
$items .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$password = "";
srand(time());
for ($f = 1; $f < 16; $f++)
{
$password .= substr($items, (rand()%(strlen($items))), 1);
}
$nick = strip_tags($nick);
$real_name = strip_tags($real_name);
$query = "INSERT INTO chat_users (login, password, e_mail, status, realname) ";
$query .= "VALUES ('$nick', '$password', '$e_mail', 0, '$real_name');";
mysql_query($query, $mysql_link);
// E-mail the new user
$mailTo = $e_mail;
$mailSubject = "Your registration for the - your chat's name here -";
$mailBody = "Thanks for registering to the - whatever :-) -.\n\n";
$mailBody .= "This mail has been sent to you to provide you with your log-in information. ";
$mailBody .= "You will need the username and password listed below to access the chat. ";
$mailBody .= "You can change your password inside the chat, but you will need at least the ";
$mailBody .= "first time you log-in, so please keep this message stored until you change ";
$mailBody .= "your password into something easier to remember.\n\n";
$mailBody .= "Username: $nick \n";
$mailBody .= "Password: $password \n\n";
$mailBody .= "See you in the chat !\n";
$mailBody .= "<Sender name>.";
$mailHeaders = "From: youremail@here.com\nReply-To: youremail@here.com";
mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
js_alert("You have been registerd. An e-mail containing your password has been sent to you.");
?>
<script>
<!--
window.close();
//-->
</script>
<?
}
// MAIN
?>
<table bgcolor="#555555" border="0" width="100%" height="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top">
<table border="0" bgcolor="#000000" width="100%" height="100%" cellpadding="5">
<tr>
<td valign="top">
<p><font size="1"><b>Register new nick:</b></font></p>
<?
switch($action)
{
case "": register_form($mysql_link); break;
case "check_register": check_register($mysql_link, $nick, $e_mail, $real_name); break;
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script>
<!--
function position_window()
{
var sAvailH = screen.availHeight;
var sAvailW = screen.availWidth;
window.moveTo( (sAvailW/2)-225, (sAvailH/2)-200);
}
//-->
</script>
<?
end_page($mysql_link);
?>
ruler.php3----------------------------------------------------------------------------------------------------
<?
// layout object
?>
<html>
<script language="JavaScript">
<!--
function passCom(type)
{
//alert(type)
parent.title.clean_frame(type)
}
//-->
</script>
<style>
body { background-color: #555555; color: #ffffff ; font-family : tahoma ; font-size: 8pt ; font-weight : bold ; margin-top : 0px ; margin-right : 0px ; margin-left : 5px ; margin-bottom : 0px }
td { color : #333333 ; font-family : tahoma ; font-size: 8pt ; font-weight : bold ; margin-top : 0px ; margin-right : 0px ; margin-left : 5px ; margin-bottom : 0px }
a:link { color: #ffffff ; font-family : tahoma ; font-size: 8pt }
a:active { color: #ffffff ; font-family : tahoma ; font-size: 8pt }
a:visited { color: #ffffff ; font-family : tahoma ; font-size: 8pt }
</style>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><?print($txt);?></td>
<?
if (($type!="") AND ($session != "")):
?>
<td align="right"><a href="java script: passCom(<?print($type);?>)">Empty</a></td>
<?
endif;
?>
</tr>
</table>
</body>
</html>
segurity.php3--------------------------------------------------------------------------------------------------------
<?
if ($action == "") $extra_info = "onLoad=\"document.login.username.focus()\"";
// security
// this is the module that controls logging in and out, as well as the sessions
require("includes.php3");
// clean up
clean_up($mysql_link);
function show_login()
{
global $scriptname;
?>
<form action="<? print($scriptname); ?>" method="post" name="login">
<table height="100%" width="500"border="0">
<tr>
<td style="background-repeat : no-repeat" width="350" valign="bottom">
<table border="0">
<tr>
<td width="20"> </td>
<td>
<br><br><br><br><br><br><br><br><br>
<table border="0">
<tr>
<td>Username:</td><td><input class="blacktext" type="text" name="username" value="" maxlength="17"></td>
</tr>
<td>Password:</td><td><input class="blacktext" type="password" name="password" value=""> <input class="button" type="submit" value=" log in "></td>
</tr>
<tr>
<td colspan="2" align="left"><input type="checkbox" name="silent">silent login (sysops only)</td>
</tr>
<tr>
</table>
<input type="hidden" name="action" value="check_login">
</td>
</tr>
</table>
</td>
<td valign="top">
</td>
</tr>
<tr>
<td colspan="2">
This chat has been designed to run on Internet Explorer at a resolution of at least 800x600<br><br>
<font color="red">DISCLAIMER</font>: By entering this chat you agree with the following: this chat can be (and usually is) monitored by so-called
sysops (both visible and invisible) that can read all messages, <b>public</b> or <b>private</b>. If you don't agree with that, please
do not log in.
</td>
</tr>
</table>
</form>
<?
}
function navi_form($session)
{
?>
<form action="showtext.php3" method="post" name="move">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<?
}
function check_login($mysql_link, $username, $password, $silent)
{
// check if account exists
$allow_silent = FALSE;
// see how many sessions there are
$query = "SELECT COUNT(*) AS usercount FROM chat_session_ids;";
$result = mysql_fetch_array(mysql_query($query, $mysql_link));
$amount_of_users = $result["usercount];
if ($amount_of_users > 49) // currenly, no more than 49 users are allowed
{
js_alert("Sorry, the maximum amount of users for this chat session has been reached. Try again later.");
show_login();
return;
}
global $scriptname, $REMOTE_ADDR;
$query = "SELECT * FROM chat_users WHERE login = '$username' AND password = '$password';";
$result = mysql_query($query, $mysql_link);
if (mysql_num_rows($result) == 0)
{
js_alert("Invalid login, please try again");
show_login();
return;
}
$temp = mysql_fetch_array($result);
$userlevel = $temp["status"];
$banned = $temp["banned"];
// check if silent login is allowed
$check = validate($userlevel, _allowsilentlogin);
if (($silent == "on") and (!$check))
{
js_alert("You are not allowed to log in silently");
}
if (($silent == "on") and ($check))
{
$status_online = 99;
}
else
{
$status_online = 0;
}
// check if banned
if ($banned == 1)
{
js_alert("You have been banned from this chatbox. Go away.");
?>
<table width=100%" height="100%" border="0">
<td align="middle" valign="middle">
You're banned. Go away. Go bother somebody else.<br><br>-= Fuck off =-</br>
</td>
</table>
<?
return;
}
$session = "";
// check if user is already logged in, if so, delete entry
$query = "SELECT * FROM chat_session_ids WHERE login = '$username';";
$result = mysql_query($query, $mysql_link);
$already_logged_in = FALSE;
if (mysql_num_rows($result) != 0)
{
// erase entry
$query = "DELETE FROM chat_session_ids WHERE login = '$username';";
mysql_query($query, $mysql_link);
$already_logged_in = TRUE;
}
if ($session == ""):
// make new session id
$pool = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for ($f = 0; $f < 20; $f++)
{
srand((double)microtime()*1000000);
$session .= substr($pool, rand(0, strlen($pool)), 1);
}
endif;
// insert session id into database
$query = "INSERT INTO chat_session_ids (session_id, login, last_action, status_online, lastlogin, IP, userlevel) ";
$query .="VALUES ('$session', '$username', now(), $status_online, now(), '$REMOTE_ADDR' , '$userlevel');";
mysql_query($query);
// update last_date
$query = "UPDATE chat_users SET last_date = now() WHERE login = '$username';";
mysql_query($query, $mysql_link);
$username = strtolower($username);
// show logged in message
if ($status_online <> 99)
{
if (!$already_logged_in)
{
system_message($mysql_link, "$username logged in");
}
else
{
system_message($mysql_link, "$username re-logged in");
}
}
update_stats($mysql_link, $username, "logins", 1);
navi_form($session);
?>
<script>
<!--
document.move.submit();
//-->
</script>
<?
}
function do_relogin($mysql_link, $session)
{
$username = strtolower(user($mysql_link, $session));
$silent = "";
$query = "SELECT login, password FROM chat_users WHERE login = '$username';";
$result = mysql_fetch_array(mysql_query($query, $mysql_link));
check_login($mysql_link, $result["login], $result["password"], $silent);
}
// ***** MAIN
switch ($action)
{
case "": show_login(); break;
case "check_login": check_login($mysql_link, $username, $password, $silent); break;
case "relogin": do_relogin($mysql_link, $session); break;
}
end_page($mysql_link);
?>
showtext.php3---------------------------------------------------------------------------------------------------------
<?
setcookie("chatSessionCookie", $session, time()+3600); // not really necessary, but
// maybe you can think of a use ?
require("includes.php3");
check_secure($mysql_link, $session);
// trigger other frames
?>
<form name=triggerspeak" action="speak.php3" method="post" target="type">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<form name="triggercontrol" action="control.php3" method="post" target="control">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<form name="titlecontrol" action="title.php3" method="post" target="title">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<form name="usercontrol" action="users.php3" method="post" target="users">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<form name="headercontrol1" action="ruler.php3" method="post" target="privateheader">
<input type="hidden" name="txt" value="Private messages:">
<input type="hidden" name="type" value="1">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<form name="headercontrol2" action="ruler.php3" method="post" target="publicheader">
<input type="hidden" name="txt" value="Public messages:">
<input type="hidden" name="type" value="0">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<script>
<!--
document.usercontrol.submit();
document.triggerspeak.submit();
document.triggercontrol.submit();
document.titlecontrol.submit();
document.headercontrol1.submit();
document.headercontrol2.submit();
//-->
</script>
<?
// the end
?>
speak.php3--------------------------------------------------------------------------------------------------------------------------------
<?
function update_timer($mysql_link, $session)
{
// update timer
$query = "UPDATE chat_session_ids SET last_action = now() WHERE session_id = '$session';";
mysql_query($query, $mysql_link);
}
// speak.php3
// This is the actual text-typing module
if ($session != "") $extra_info = "onload=\"document.typetext.typed_text.focus();\"";
require("includes.php3");
function show_form($mysql_link)
{
global $scriptname, $session, $users, $keep;
$userlevel = user_level($mysql_link, $session);
if ($session != ""):
?>
<script language="JavaScript">
var speakState = 0;
var teller = 0;
function check_speakstate()
{
if (speakState == 0)
{
speakState = 1;
return true;
}
else
{
alert("You are flooding........ \n\n\nSystem will be kicking you in "+(5-teller)+" more submit(s)")
{
teller++;
if (teller > 5) { }
document.typetext.typed_text.value = "";
return false;
}
}
}
</script>
<form onSubmit="check_speakstate()" name="typetext" action="<? print($scriptname); ?>" method="post" style="margin-top : 0px ; margin-right : 0px ; margin-left : 0px ; margin-bottom : 0px ;">
<table height="90%" width="100%" border="0" bgcolor="#555555" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" valign="top" align="left" bgcolor="#000000" cellpadding="0" cellspacing="5">
<table width="100%" border="0">
<tr>
<td width="200">
<?
$login = user($mysql_link, $session);
$query2 = "SELECT color FROM chat_users WHERE login = '".addslashes($login)."';";
$result2 = mysql_fetch_array(mysql_query($query2, $mysql_link));
$kleur = $result2["color];
if ($kleur == "") $kleur = "gray";
?>
<font color="<?print($kleur);?>" style="font-size: 8pt; font-weight : bold"><?print($login);?></font><br>
<input class="text" type="text" maxlength="250" size="35" name="typed_text" value="">
</td>
<td>
<font style="font-size: 8pt; font-weight : bold">to:</font><br>
<select name="users" class="typetext">
<?
$add = "";
if (($users == "0") and ($keep == "on")){ $add = " SELECTED"; }
?>
<option value="0"<? print($add); ?>>all users</option>
<?
$add = "";
if (($users == "1") and ($keep == "on")) { $add = "SELECTED"; }
if (validate($userlevel, _modmessages)):
?>
<option value="1"<? print($add); ?>>moderators</option>
<?
endif;
$add = "";
if (($users == "2") and ($keep == "on")) { $add = "SELECTED"; }
if (validate($userlevel, sysops)):
?>
<option value="2"<? print($add); ?>>system</option>
<?
endif;
// show other users
$query = "SELECT login FROM chat_session_ids WHERE status_online <> 99 ORDER BY login;";
$result = mysql_query($query, $mysql_link);
while ($rec = mysql_fetch_array($result))
{
$add = "";
if (($users == $rec["login"]) and ($keep == "on")) { $add = " SELECTED"; }
print("<option value=\"".$rec["login"]."\"$add>".$rec["login"]."</option>");
}
?>
</select>
<?
// check input
$add_keep = "";
if ($keep == "on") $add_keep = " CHECKED";
?>
<input type=checkbox" name="keep"<? print($add_keep); ?>>lock
</td>
<td>
<font style="font-size: 8pt; font-weight : bold">action:</font><br>
<input class="button" type="submit" value="speak">
<input type="hidden" name="action" value="speak">
<input type="hidden" name="session" value="<? print($session); ?>">
</td>
<td>
<?
if (validate($userlevel, _cankick)):
?>
<font style="font-size: 8pt; font-weight : bold"> </font><br>
<input class="button" type="button" value="kick" onClick="kick_user()">
<?
endif;
?>
</td>
<?
if (validate($userlevel, _allowsilentlogin))
{
if (status_online($mysql_link, $session) != 99)
{
?>
<td>
<font style="font-size: 8pt; font-weight : bold"> </font><br>
<input class="button" type="button" value="hide yourself" onClick="change_status(0)">
</td>
<?
}
else
{
?>
<td>
<font style="font-size: 8pt; font-weight : bold"> </font><br>
<input class="button" type="button" value="show yourself" onClick="change_status(1)">
</td>
<?
}
}
if (validate($userlevel, sysops))
{
?>
<td>
<font style="font-size: 8pt; font-weight : bold"> </font><br>
<input class="button" type="button" value="chat message" onClick="sendmessage()">
</td>
<?
}
?>
</tr>
</table>
</td>
</tr>
</table>
</form>
<script>
<!--
function kick_user()
{
tempvar = document.typetext.users.value;
document.kickuser.username.value = tempvar;
document.kickuser.submit();
}
function change_status(hi)
{
document.status_online.submit();
}
function sendmessage()
{
var waarde = document.typetext.typed_text.value;
if (waarde == "")
{
alert("You cannot send an empty chat message");
return;
}
document.chat_message.chat_mesg.value = waarde;
document.chat_message.submit();
}
function updatecontrol()
{
waarde = parent.control.update_this.page_loaded.value;
if (waarde != 0)
{
parent.control.update_this.submit();
}
else
{
turn_timer_on();
}
}
function turn_timer_on()
{
self.setTimeout('updatecontrol()', 500);
}
//-->
</script>
<form name="kickuser" action="<? print($scriptname); ?>" method="post" style="margin-top : 0px ; margin-right : 0px ; margin-left : 0px ; margin-bottom : 0px ;">
<input type="hidden" name="username" value="">
<input type="hidden" name="action" value="kick">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<form name="status_online" action="<? print($scriptname); ?>" method="post" style="margin-top : 0px ; margin-right : 0px ; margin-left : 0px ; margin-bottom : 0px ;">
<input type="hidden" name="status" value="<? print(status_online($mysql_link, $session)); ?>">
<input type="hidden" name="action" value="status_online">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<form name="chat_message" action="<? print($scriptname); ?>" method="post" style="margin-top : 0px ; margin-right : 0px ; margin-left : 0px ; margin-bottom : 0px ;">
<input type="hidden" name="chat_mesg" value="">
<input type="hidden" name="action" value="chat_message">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?
check_secure($mysql_link, $session);
endif;
}
require("process_speak.php3");
function image_scan($mysql_link, $text, $session)
{
// retrieve all images
$query = "SELECT * FROM chat_images;";
$result = mysql_query($query, $mysql_link);
// store in array
while ($rec = mysql_fetch_array($result))
{
$paths[] = $rec["filename];
$commands[] = $rec["command"];
$userlevels[] = $rec["userlevels"];
}
// check text for matches
$aantal = count($paths);
$counter = 0;
$username = user($mysql_link, $session);
for ($f = 0; $f < $aantal; $f++)
{
// see if command is present
$check = eregi($commands[$f], $text);
if ($check)
{
// command is present
// determine if userlevel has to be used
if ($userlevels[$f] != "")
{
// userlevel is not "any"
// get own userlevel
$userlevel = user_level($mysql_link, $session);
if ($userlevel == $userlevels[$f])
{
$go = TRUE;
}
else
{
$go = FALSE;
}
if ($go)
{
// add image
$text = eregi_replace($commands[$f], "<img src=\"images/".$paths[$f]."\">", $text);
update_stats($mysql_link, $username, "icons", 1);
$counter++;
} // end go check
else
{
$text = "<font color=\"red\">***unauthorized use of icon***</font>";
}
} // end userlevel check
else
{
// no userlevel check necessary, display image
$split_text = split(strtoupper($commands[$f]), strtoupper($text));
if (count($split_text) > 2)
{
$text = "<font color=\"red\">***1 icon of a kind per line***</font>";
}
else
{
$text = eregi_replace($commands[$f], "<img align=\"absmiddle\" src=\"images/".$paths[$f]."\">", $text);
update_stats($mysql_link, $username, "icons", 1);
}
$counter++;
}
} // end check if
if ($counter > 1) { return $text; }
}
return $text;
}
function process($mysql_link, $session, $typed_text)
{
$userlevel = user_level($mysql_link, $session);
check_secure($mysql_link, $session);
// strip html
if (validate($userlevel, _striphtml)):
$typed_text = htmlentities($typed_text);
endif;
// end strip
// detect modes
// determine on-line status
$query = "SELECT status_online FROM chat_session_ids WHERE session_id = '$session';";
$record = mysql_fetch_array(mysql_query($query, $mysql_link));
switch ($record["status_online"])
{
case "10": $typed_text = crap($typed_text); break; // total crap
case "11": $typed_text = no_spaces($typed_text); break; // no spaces
case "12": $typed_text = reverse($typed_text); break; // reverse
case "13": $typed_text = yell($typed_text); break; // yell
case "14": $typed_text = stutter($typed_text); break; // stutter
case "15": $typed_text = nerdie($typed_text); break; // nerdie
case "16": $typed_text = swear($typed_text); break; // swear
case "17": $typed_text = porn($typed_text); break; // porn
case "18": $typed_text = no_vowels($typed_text); break; // no vowels
case "19": $typed_text = ome_jo($typed_text); break; // ome jo
case "20": $typed_text = nazi($typed_text); break; // nazi
case "21": $typed_text = shut_up($typed_text); break; // shut up
case "22": $typed_text = maroc($typed_text); break; // maroc
case "23": $typed_text = southpark($typed_text); break; // southpark
}
// look for image replacements
$typed_text = image_scan($mysql_link, $typed_text, $session);
return $typed_text;
}
function speak($mysql_link, $session, $typed_text, $users)
{
// do processing
$typed_text = process($mysql_link, $session, $typed_text);
$user_name = user($mysql_link, $session);
$my_userlevel = user_level($mysql_link, $session);
check_secure($mysql_link, $session);
if (($users == "2") and ($my_userlevel > 1))
{
$user_name = "system";
$users = "0";
}
// add to database
$status = 0;
// check for !me tags
$check = eregi("!me", $typed_text);
if ($check):
$status = 1;
endif;
// end check
// check for !brb tags
$check = eregi("!brb", $typed_text);
if ($check):
$status = 2;
endif;
// end check
// check for !back tags
$check = eregi("!back", $typed_text);
if ($check):
$status = 3;
endif;
// end check
// check for !greet tags
$check = eregi("!greet", $typed_text);
if ($check):
$status = 4;
endif;
// end check
if ($typed_text != "")
{
// update linez counter
update_stats($mysql_link, $user_name, "linez", 1);
// count words
$wordsarray = split(" ", $typed_text);
update_stats($mysql_link, $user_name, "words", count($wordsarray));
// count chars
update_stats($mysql_link, $user_name, "chars", strlen($typed_text));
$user_name = addslashes($user_name);
$users = addslashes($users);
$query = "SELECT id FROM chat_text_db WHERE text = '$typed_text';";
$res = mysql_query($query, $mysql_link);
if (mysql_num_rows($res) > 2)
{
mysql_query("INSERT INTO chat_text_db(saidby, saidto, status, text, date) VALUES ('system', '0', 0, '$user_name is flooding and will therefore be killed', now());", $mysql_link);
?>
<script languague=JavaScript">
alert("You are flooding. Goodbye !");
window.parent.close();
</script>
<?
mysql_query("DELETE FROM chat_session_ids WHERE session_id = '$session';", $mysql_link);
}
else
{
$user_name = strip_tags($user_name);
$query = "INSERT INTO chat_text_db (saidby, saidto, status, text, date) ";
$query .="VALUES ('$user_name', '$users', $status, '$typed_text', now());";
mysql_query($query, $mysql_link);
}
}
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
// update timer
update_timer($mysql_link, $session);
}
function kick($mysql_link, $username, $session)
{
check_secure($mysql_link, $session);
update_timer($mysql_link, $session);
$my_username = user($mysql_link, $session);
$my_userlevel = user_level($mysql_link, $session);
if ($my_userlevel < 1)
{
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
return;
}
if (validate($my_userlevel, _god))
{
$query = "DELETE FROM chat_session_ids WHERE login = '$username';";
mysql_query($query, $mysql_link);
system_message($mysql_link, $username." was kicked by ".$my_username);
update_stats($mysql_link, $username, "kicks", 1);
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
return;
}
// do not kick moderators
if ($username == "1")
{
js_alert("You cannot kick the moderators");
show_form($mysql_link);
return;
}
if ($username == "2")
{
js_alert("You cannot kick the system");
show_form($mysql_link);
return;
}
if ($username != '0')
{
// check if user is still logged in
$query = "SELECT * FROM chat_session_ids WHERE login ='$username';";
$ress = mysql_query($query, $mysql_link);
if (mysql_num_rows($ress) != 0)
{
$usrec = mysql_fetch_array($ress);
if (validate($usrec["userlevel], _god))
{
js_alert("No");
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
return;
}
if (validate($usrec["userlevel"], sysops))
{
system_message($mysql_link, $my_username." cannot kick $username");
}
else
{
$query = "DELETE FROM chat_session_ids WHERE login = '$username';";
mysql_query($query, $mysql_link);
system_message($mysql_link, $username." was kicked by ".$my_username);
update_stats($mysql_link, $username, "kicks", 1);
}
}
else
{
js_alert("User has already left the chat and cannot be kicked... Damn !");
}
}
else
{
js_alert("You cannot kick all users at once...");
}
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
}
function change_status_online($mysql_link, $status, $session)
{
check_secure($mysql_link, $session);
$my_userlevel = user_level($mysql_link, $session);
if ($my_userlevel < 2)
{
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
return;
}
$username = user($mysql_link, $session);
$c_status = status_online($mysql_link, $session);
if ($c_status == 0) $new_status = 99;
if ($c_status == 99) $new_status = 0;
$query = "UPDATE chat_session_ids SET status_online = $new_status WHERE session_id = '$session';";
mysql_query($query, $mysql_link);
if ($new_status == 0) js_alert("You are now visible");
if ($new_status == 99) js_alert("You are now invisible");
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
if ($new_status == 0) system_message($mysql_link, "<font color=lightgreen>$username goes ***POOF*** and is now visible</font>");
if ($new_status == 99) system_message($mysql_link, "<font color=lightgreen>$username goes ***POOF*** and is now invisible</font>");
$query = "INSERT INTO chat_text_db (saidby, saidto, status, text, date) ";
$query .= "VALUES ('$username', 'ask_for_refresh', 50, '', now());";
mysql_query($query, $mysql_link);
update_timer($mysql_link, $session);
}
function chat_message($mysql_link, $chat_mesg, $session)
{
$my_userlevel = user_level($mysql_link, $session);
if ($my_userlevel < 2)
{
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
return;
}
$userlevel = user_level($mysql_link, $session);
$username = user($mysql_link, $session);
check_secure($mysql_link, $session);
if (validate($userlevel, sysops))
{
$query = "INSERT INTO chat_text_db (saidby, saidto, status, text, date) ";
$query .= "VALUES ('$username', 'chatmessage', 50, '$chat_mesg', now());";
mysql_query($query, $mysql_link);
}
show_form($mysql_link);
?>
<script>
<!--
updatecontrol();
//-->
</script>
<?
update_timer($mysql_link, $session);
}
// ****** MAIN
// determine action
switch ($action)
{
case "": show_form($mysql_link); break;
case "speak": speak($mysql_link, $session, $typed_text, $users); break;
case "kick": kick($mysql_link, $username, $session); break;
case "status_online": change_status_online($mysql_link, $status, $session); break;
case "chat_message": chat_message($mysql_link, $chat_mesg, $session); break;
}
end_page($mysql_link);
?>
special_option.php3-------------------------------------------------------------------------------------------------------------------------------
<?
// special options
// general definitions
$levels = array (0, 1, 3, 2);
$levelnames = array("normal", "moderator", "special", "sysop");
$modes = array (0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
$modenames = array("normal", "crap", "no spaces", "reverse", "yell", "stutter", "nerdie", "swear", "german porn", "no vowels", "ome jo", "nazi", "shut up", "maroc", "southpark");
$page_title = "Special Sysop options";
require("includes.php3");
function userlevel_list($mysql_link, $current_level, $login)
{
global $levelnames, $levels;
$aantal = count($levelnames);
?>
<select style=font-size:12px" name="userlevels[]">
<?
for ($f = 0; $f < $aantal; $f++)
{
if ($current_level == $levels[$f])
{
$add = " SELECTED ";
}
else
{
$add = "";
}
?>
<option value="<? print($levels[$f]); ?>"<? print($add); ?>><? print($levelnames[$f]); ?></option>
<?
}
?>
</select>
<?
}
function usermode_list($mysql_link, $current_status, $login)
{
global $modenames, $modes;
$aantal = count($modenames);
?>
<select style="font-size:12px" name="mode[]">
<?
for ($f = 0; $f < $aantal; $f++)
{
if ($current_status == $modes[$f])
{
$add = " SELECTED ";
}
else
{
$add = "";
}
?>
<option value="<? print($modes[$f]); ?>"<? print($add); ?>><? print($modenames[$f]); ?></option>
<?
}
?>
</select>
<?
}
function image_list($mysql_link, $img, $login)
{
$dirobj = opendir("icons/");
if ($img == "") $img = "nobody.gif";
?>
<select style="font-size:12px" name="img[]">
<?
while (($filen = readdir($dirobj))!=false)
{
if (($filen != ".") AND ($filen != "..")):
if ($filen == $img)
{
$add = " SELECTED ";
}
else
{
$add = "";
}
?>
<option value="<? print($filen); ?>"<? print($add); ?>><? print($filen); ?></option>
<?
endif;
}
?>
</select>
<?
}
function show_main($mysql_link)
{
global $scriptname, $session, $gods, $mipa;
print("<p> Special Sysop options:</p>");
// fetch users
// determine mode
$check_login = strtoupper(user($mysql_link, $session));
$is_godmember = false;
$aantal = count($gods);
for ($f = 0; $f < $aantal; $f++)
{
if ($check_login == $gods[$f]) { $is_godmember = true; }
}
if (!$is_godmember)
{
$query= "SELECT * FROM chat_session_ids WHERE userlevel NOT IN (".sysops.") ORDER BY login;";
}
else
{
$query= "SELECT * FROM chat_session_ids WHERE login <> '$mipa' ORDER BY login;";
}
$result = mysql_query($query, $mysql_link);
?>
<form name="userform" method="post" action="<? print($scriptname); ?>">
<table width="100%" border="0">
<tr>
<td><b>userinfo</b></td>
<td><b>color</b></td>
<td><b>image</b></td>
<td><b>level</b></td>
<td><b>mode</b></td>
<td><b>kick</b></td>
<td><b>ban</b></td>
</tr>
<?
while ($record = mysql_fetch_array($result))
{
// fetch userrecord
$query = "SELECT * FROM chat_users WHERE login = '".addslashes($record["login])."';";
$userrecord = mysql_fetch_array(mysql_query($query, $mysql_link));
$login = $userrecord["login"];
?>
<tr>
<td>Nickname: <font color=gold"><? print($record["login]); ?></font><br>IP: <? print($record["IP"]); ?><br>Real Name: <? print($userrecord["realname"]); ?><br>E-mail:<? print($userrecord["e_mail"]); ?><input type=hidden" name="loginname[]" value="<? print($login); ?>"></td>
<td><input style="font-size:10px" type="text" name="color[]" value="<? print($userrecord["color]); ?>"></td>
<td><? image_list($mysql_link, $userrecord["img"], $login); ?></td>
<td><? userlevel_list($mysql_link, $record["userlevel"], $login); ?></td>
<td><? usermode_list($mysql_link, $record["status_online"], $login); ?></td>
<td><input type=checkbox" name="<? print(urlencode($login)); ?>_kick"></td>
<td><input type="checkbox" name="<? print(urlencode($login)); ?>_ban"></td>
</tr>
<?
}
?>
</table>
<input type="submit" value="update changes" class="button">
<input type="hidden" name="action" value="update">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
<?
}
function update($mysql_link, $loginname, $color, $img, $levels, $mode)
{
// update session table
$aantal = count($loginname);
for ($f = 0; $f < $aantal; $f++)
{
// check if user was in invisible mode
$query = "SELECT status_online FROM chat_session_ids WHERE login = '".$loginname[$f]."'";
$checkres = mysql_fetch_array(mysql_query($query, $mysql_link));
if ($checkres["status_online] == 99) { $mode[$f] = 99; }
$query = "UPDATE chat_session_ids SET status_online = ".$mode[$f].", userlevel = ".$levels[$f]." WHERE login = '".$loginname[$f]."';";
mysql_query($query, $mysql_link);
}
//update user table
for ($f = 0; $f < $aantal; $f++)
{
$query = "UPDATE chat_users SET color = '".$color[$f]."', img = '".$img[$f]."' WHERE login = '".$loginname[$f]."'";
mysql_query($query, $mysql_link);
}
// see if anyone has to be kicked or banned
global $HTTP_POST_VARS;
$hv = $HTTP_POST_VARS;
while (list ($rkey, $rval) = each($hv))
{
if (eregi("kick", $rkey))
{
$naam = urldecode(addslashes(substr($rkey, 0, strpos($rkey, "_"))));
$query = "DELETE FROM chat_session_ids WHERE login = '$naam';";
system_message($mysql_link, $naam . " was kicked by the system");
update_stats($mysql_link, $naam, "kicks", 1);
mysql_query($query, $mysql_link);
}
if (eregi("ban", $rkey))
{
$naam = urldecode(addslashes(substr($rkey, 0, strpos($rkey, "_"))));
$query = "UPDATE chat_users SET banned = 1 WHERE login = '$naam';";
system_message($mysql_link, "".stripslashes($naam)." was banned by the system");
mysql_query($query, $mysql_link);
}
}
print("Updated.<br>");
show_main($mysql_link);
}
// ******* MAIN
// check if user is sysop
$userlevel = user_level($mysql_link, $session);
$checked = validate($userlevel, sysops);
if ($checked)
{
// options
switch ($action)
{
case "": show_main($mysql_link); break;
case "update": update($mysql_link, $loginname, $color, $img, $userlevels, $mode); break;
}
}
else
{
print("You are not authorized to use these options.");
}
end_page($mysql_link);
?>
title.php3-------------------------------------------------------------------------------------------------------
<?
if ($session != "") $extra_info = " marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 onUnload=\"do_log_out();\"";
if ($session == "") $extra_info = " marginwidth=0 marginheight=0 topmargin=0 leftmargin=0";
require("includes.php3");
?>
<table border=0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td width="11"> </td>
<td align="left" valign="middle" width="350">
<b style="letter-spacing:.75px; font-weight:800"><? print(_chatboxname); ?> <b style="font-weight:normal; font-size: 10px; color: gray; letter-spacing:0.25px">version <? print(_version); ?></b>
</td>
<td align="left" valign="top" width="90">
<a href="mailto:bugreport@within-temptation.com?subject=BugReport%20WTchat">report a bug</a></b>
</td>
<? // special options, only when not logged in
if ($session == ""):
?>
<td align="left" valign="top">
<a class="b1" href="#" onClick="window.open('register.php3', 'registerwindow', config='height=450,width=400,toolbar=no,resizable=no,menubar=no,scrollbars=no,location=no,directories=no,status=no');">register new nick</a>
</td>
<? endif; // end special options, not logged in
// special options, only when logged in
if ($session != ""):
?>
<td align="left" valign="top">
<a href="#" onClick="window.open('password.php3?session=<? print($session); ?>', 'passwordwindow', config='height=200,width=400,toolbar=no,resizable=no,menubar=no,scrollbars=no,location=no,directories=no,status=no');">change your password</a>
</td>
<?
$userlevel = user_level($mysql_link, $session);
if (validate($userlevel, sysops))
{
?>
<td align="left" valign="top">
<a href="#" onClick="window.open('special_options.php3?session=<? print($session); ?>', 'passwordwindow', config='height=400,width=600,toolbar=no,resizable=yes,menubar=no,scrollbars=yes,location=no,directories=no,status=no');">special sysop options</a>
</td>
<?
}
endif; // end special options, logged in
// <td align="middle" valign="top">
// <a href="java script:re_login()">fast re-login</a>
// </td>
?>
</tr>
</table>
<?
if ($session != ""):
$add_message = urlencode($add_message);
?>
<script>
<!--
function do_log_out()
{
sessionid = '<? print($session); ?>';
testwindow = window.open("logout.php3?session="+sessionid+"&add_message=<? print($add_message); ?>", '', config='height=50,width=400,toolbar=no,resizable=yes,menubar=no,scrollbars=yes,location=no,directories=no,status=no');
}
function re_login()
{
parent.content.document.location.href = 'security.php3?action=relogin&session=<? print($session); ?>';
}
function clean_frame(framenr)
{
if (framenr == 0)
{
parent.content.document.location.href = 'blank.php3';
}
if (framenr == 1)
{
parent.private.document.location.href = 'blank.php3';
}
parent.control.document.location = 'control.php3?started=&session=<? print($session); ?>&lijst=no';
}
//-->
</script>
<?
endif;
end_page($mysql_link);
?>
update.php3---------------------------------------------------------------------------------------------------------------------------
?>
// determine which text has to be shown
require("includes.php3");
$eerste = "nee";
if ($state=="")
{
$state="started";
$eerste="já";
$query = "SELECT MAX(id) AS latestid FROM chat_session_ids;"
$ids = mysql_fetch_array(mysql_query($query, $mysql_link));
$latestid = $ids["latestid];
?>
<script>
<!--
alert("<? print($latestid); ?>");
//-->
</script>
<?
}
// Fetch new text from database
$query = "SELECT * FROM Chat_Text WHERE date_time > '$nu';";
$result = mysql_query($query, $mysql_link);
$query = "SELECT now() AS nu;";
$now_time = mysql_fetch_array(mysql_query($query, $mysql_link));
$nu = $now_time["nu"];
$data = "";
if (mysql_num_rows($result) > 0)
{
$teller++;
}
while ($record = mysql_fetch_array($result))
{
$data .= strip_tags($record["said_by"]).":".strip_tags($record["text"])."<br>";
}
$data = addslashes($data);
$encodedurl = urlencode($nu);
?>
<html>
<meta http-equiv=refresh content=5; URL=update.php3?state=started&nu=<? print($encodedurl); ?>&garb=<? print(date("U")); ?>">
<head>
<script>
<?
if ($eerste=="já") print("parent.text.document.writeln(\"<body bgcolor=black text=white><font size=3 face=tahoma>\"+\"\\n\");");
?>
<?
if (mysql_num_rows($result) > 0)
{
?>
parent.text.document.writeln("<? print($data); ?>");
parent.text.scrollBy(0, 50);
<?
}
?>
</script>
</head>
<body>
</body>
</html>
users.php3----------------------------------------------------------------------------------------------------------------------
<?
$extra_info = "style=\"scrollbar-base-color:black;scrollbar-arrow-color:black\"";
require("includes.php3");
?>
<script>
<!--
function add_t(tekst)
{
waarde = parent.type.document.typetext.typed_text.value;
waarde = waarde + tekst + ": ";
parent.type.document.typetext.typed_text.value = waarde;
parent.type.document.typetext.typed_text.focus();
parent.type.document.typetext.typed_text.select();
}
//-->
</script>
<?
//($session != ""):
$add_tag = "WHERE status_online <> 99";
if ($session != "")
{
$userlevel = user_level($mysql_link, $session);
$showhidden = validate($userlevel, _canseeinvisible);
if ($showhidden) $add_tag = "";
}
$query = "SELECT login, status_online FROM chat_session_ids $add_tag ORDER BY login ASC;";
$result = mysql_query($query, $mysql_link);
?>
<table bgcolor="#555555" border="0" width="100%" height="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top">
<table border="0" bgcolor="#000000" width="100%" height="100%" cellpadding="5">
<tr>
<td valign="top">
<font size="1">Online Users:</font><br><br>
<b style="font-size: 8pt; font-weight : bold">
<?
while ($record = mysql_fetch_array($result))
{
$query2 = "SELECT color, img FROM chat_users WHERE login = '".addslashes($record["login])."';";
$result2 = mysql_fetch_array(mysql_query($query2, $mysql_link));
$kleur = $result2["color"];
$image = $result2["img"];
if ($kleur == "") $kleur = "gray";
if ($image == "") $image = "nobody.gif";
$at = ""; $aet = "";
if ($record["status_online"] == 99)
{
$at = "<i>";
$aet = "</i>";
}
$check_login = $record["login"];
$check_state = $record["status_online"];
$is_godmember = false;
$aantal = count($gods);
for ($f = 0; $f < $aantal; $f++)
{
if (strtoupper($check_login) == $gods[$f]) { $is_godmember = true; }
}
if ( (!$is_godmember))
{
print("<img src=\"icons/$image\" align=absmiddle> $at<span style=\"cursor:e-resize\" onClick=\"add_t('".addslashes($record["login"])."');\"><font color=\"".$kleur."\">".$record["login"]."</span></font>$aet<br>");
}
else
{
if ($check_state == 0) print("<img src=\"icons/$image\" align=absmiddle> $at<span style=\"cursor:e-resize\" onClick=\"add_t('".addslashes($record["login"])."');\"><font color=\"".$kleur."\">".$record["login"]."</span></font>$aet<br>");
}
}
if (mysql_num_rows($result) == 0) print("<font color=\"red\">no users are on-line at this moment</font>");
?>
</b>
<form name=usercontrol" action="users.php3" method="post" target="users">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
//endif;
end_page($mysql_link);
// end
?>
user_external.php3---------------------------------------------------------------------------------------
<?
$extra_info = "onLoad=\"start_timer()\" style=\"scrollbar-base-color:black;scrollbar-arrow-color:black\"";
require("includes.php3");
?>
<script>
<!--
function start_timer()
{
self.setTimeout('update_screen()', 10000);
}
function update_screen()
{
document.location.href = document.location.href;
}
//-->
</script>
<?
$add_tag = "WHERE status_online <> 99";
if ($session != "")
{
$userlevel = user_level($mysql_link, $session);
$showhidden = validate($userlevel, _canseeinvisible);
if ($showhidden) $add_tag = "";
}
$query = "SELECT login, status_online FROM chat_session_ids $add_tag ORDER BY login ASC;";
$result = mysql_query($query, $mysql_link);
?>
<table bgcolor="#555555" border="0" width="100%" height="100%" cellpadding="2" cellspacing="0">
<tr>
<td valign="top">
<table border="0" bgcolor="#000000" width="100%" height="100%" cellpadding="5">
<tr>
<td valign="top">
<font size="1">Online Users:</font><br><br>
<b style="font-size: 8pt; font-weight : bold">
<?
while ($record = mysql_fetch_array($result))
{
$query2 = "SELECT color, img FROM chat_users WHERE login = '".addslashes($record["login])."';";
$result2 = mysql_fetch_array(mysql_query($query2, $mysql_link));
$kleur = $result2["color"];
$image = $result2["img"];
if ($kleur == "") $kleur = "gray";
if ($image == "") $image = "nobody.gif";
$at = ""; $aet = "";
if ($record["status_online"] == 99)
{
$at = "<i>";
$aet = "</i>";
}
$check_login = $record["login"];
$check_state = $record["status_online"];
$is_godmember = false;
$aantal = count($gods);
for ($f = 0; $f < $aantal; $f++)
{
if (strtoupper($check_login) == $gods[$f]) { $is_godmember = true; }
}
if ( (!$is_godmember))
{
print("<img src=\"icons/$image\" align=absmiddle> $at<span style=\"cursor:e-resize\" onClick=\"add_t('".addslashes($record["login"])."');\"><font color=\"".$kleur."\">".$record["login"]."</span></font>$aet<br>");
}
else
{
if ($check_state == 0) print("<img src=\"icons/$image\" align=absmiddle> $at<span style=\"cursor:e-resize\" onClick=\"add_t('".addslashes($record["login"])."');\"><font color=\"".$kleur."\">".$record["login"]."</span></font>$aet<br>");
}
}
if (mysql_num_rows($result) == 0) print("<font color=\"red\">no users are on-line at this moment</font>");
?>
</b>
<form name="usercontrol" action="users.php3" method="post" target="users">
<input type="hidden" name="session" value="<? print($session); ?>">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
//endif;
end_page($mysql_link);
// end
?>
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.