version 1.10, 2002/05/14 15:55:44 |
version 1.12, 2002/05/31 08:29:09 |
|
|
Author: Martin Karas a.k.a. Wolcano |
Author: Martin Karas a.k.a. Wolcano |
Date: 24.04.2002 |
Date: 24.04.2002 |
Mail: wolcano@pobox.sk |
Mail: wolcano@pobox.sk |
Version: v5.2 |
Version: v5.4 |
License: not chosen yet - this file is strictly private, |
License: not chosen yet - this file is strictly private, |
you may not copy/change/distribute it without authors |
you may not copy/change/distribute it without authors |
explicit premission. |
explicit premission. |
|
|
$reply_to - index of message you want to reply (inserts quoted message) |
$reply_to - index of message you want to reply (inserts quoted message) |
|
|
CHANGE LOG: |
CHANGE LOG: |
|
* 5.4 - fixed <form action> <-> <input> conflicts |
|
* 5.3 - external CSS file |
* 5.2 - added "reply" link |
* 5.2 - added "reply" link |
* 5.1 - updated SQL queries |
* 5.1 - updated SQL queries |
- sprtinf()-ed and quote()-ed all SQL queries |
- sprtinf()-ed and quote()-ed all SQL queries |
|
|
|
|
|
|
// IMPORTANT CONSTANTS (change if needed) |
// IMPORTANT CONSTANTS (change if needed) |
$WB_version = "5.2"; |
$WB_version = "5.4"; |
$WB_name = "Wol's Message Board"; |
$WB_name = "Wol's Message Board"; |
$strip_slashes = 1; |
$strip_slashes = 1; |
$DEFAULT_HEAD_FRAME = ""; |
$DEFAULT_HEAD_FRAME = ""; |
$DEFAULT_BODY_FRAME = ""; |
$DEFAULT_BODY_FRAME = ""; |
|
$css_file = "style.css"; |
$use_virtual_delete = 1; //use delete flagging instead of real delete |
$use_virtual_delete = 1; //use delete flagging instead of real delete |
$root_name = "root"; |
$root_name = "root"; |
$root_md5_password = "896ae34257056a6edb7643e3db85bb21"; |
$root_md5_password = "896ae34257056a6edb7643e3db85bb21"; |
|
|
); |
); |
} // create_link() |
} // create_link() |
|
|
|
function split_url_vars($s) { |
|
$a = explode('&', $s); |
|
$i = 0; |
|
$s = array(); |
|
while ($i < sizeof($a)) { |
|
$b = explode('=', $a[$i]); |
|
$s[htmlspecialchars(urldecode($b[0]))] = |
|
htmlspecialchars(urldecode($b[1])); |
|
$i++; |
|
} |
|
return $s; |
|
} // split_url_vars($s) |
|
|
|
function create_hidden_inputs($a, $val = 0) { |
|
if (is_array($a)) { |
|
$k = array_keys($a); |
|
$ret = ''; |
|
for($i = 0; $i < sizeof($a); $i++) { |
|
$ret .= "<input type=hidden name=\"$k[$i]\" ". |
|
"value=\"" . $a[$k[$i]] . "\">\n"; |
|
} |
|
return $ret; |
|
} |
|
else { |
|
return "<input type=hidden name=\"$a\" value=\"$val\">\n"; |
|
} |
|
} // create_hidden_inputs($a); |
|
|
function create_reply($msg_arr) { |
function create_reply($msg_arr) { |
/* |
/* |
$msg_arr keys: time, name, message, email |
$msg_arr keys: time, name, message, email |
|
|
Current time is <?echo format_time(time())?>. |
Current time is <?echo format_time(time())?>. |
<br> |
<br> |
<table border=0> |
<table border=0> |
<form name=data method=GET action="<? |
<form name=data method=GET action="<?echo "$self"?>" target="<?echo $bodyframe?>"> |
echo "$self?"; |
<? |
$tmp = link_replace(create_link(), "page", ""); |
$tmp = link_replace(create_link(), 'page', ''); |
if (good($frameset)) |
if (good($frameset)) |
$tmp = link_replace($tmp, "disablepart", "2"); |
$tmp = link_replace($tmp, 'disablepart', '2'); |
echo $tmp; |
echo create_hidden_inputs(split_url_vars($tmp)); |
?>" target="<?echo $bodyframe?>"> |
?> |
<tr> |
<tr> |
<td align=center valign=middle rowspan=3> |
<td align=center valign=middle rowspan=3> |
<textarea name="message" cols=30 rows=<? |
<textarea name="message" cols=30 rows=<? |
Line 878 Current time is <?echo format_time(time( |
|
Line 909 Current time is <?echo format_time(time( |
|
<tr> |
<tr> |
<td align=right><? |
<td align=right><? |
if (!$style) |
if (!$style) |
echo "Board\t /</td><td><a href=$self?" . |
echo "Board /</td><td><a href=$self?" . |
link_replace(create_link(), "style", "1") . ">Chat</a></td>"; |
link_replace(create_link(), "style", "1") . ">Chat</a></td>"; |
else |
else |
echo "<a href=$self?" . link_replace(create_link(), "style", "0") . |
echo "<a href=$self?" . link_replace(create_link(), "style", "0") . |
Line 908 Current time is <?echo format_time(time( |
|
Line 939 Current time is <?echo format_time(time( |
|
<td align=center> |
<td align=center> |
<a href="<? |
<a href="<? |
echo "$self?" . link_replace(link_replace(create_link(), "setframes", 1), "disablepart", 3); |
echo "$self?" . link_replace(link_replace(create_link(), "setframes", 1), "disablepart", 3); |
?>" target=_top>Switch to frames</a> |
?>" target=_top>Switch to frames</a> <font size=-3><a href="<? |
|
echo $self . '?' . link_replace(create_link(), 'nick', 'root'); |
|
?>">π</a></font> |
</td> |
</td> |
</tr> |
</tr> |
</form> |
</form> |
Line 974 Current time is <?echo format_time(time( |
|
Line 1007 Current time is <?echo format_time(time( |
|
<html> |
<html> |
<head> |
<head> |
<title><?echo "$WB_name v$WB_version"?></title> |
<title><?echo "$WB_name v$WB_version"?></title> |
|
<link rel="stylesheet" href="<?echo $css_file?>" type="text/css"> |
</head> |
</head> |
<body bgcolor="black" text="#C0C0C0" link="#888ff" alink="#888ff" vlink="#888ff"> |
<body bgcolor="black" text="#C0C0C0" link="#8888ff" alink="#8888ff" vlink="#8888ff"> |
<? |
<? |
} // show_nonrefresh_head() |
} // show_nonrefresh_head() |
|
|
function show_delete_dialog($nick, $time) { |
function show_delete_dialog($nick, $time) { |
global $self; |
global $self; |
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Delete message</font></b><br><br>"; |
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Delete message</font></b><br><br>"; |
echo "\n<center>\n<form name=deletemessage method=get action=$self?" . |
echo "\n<center>\n<form name=deletemessage method=get action=$self>\n"; |
link_replace(link_replace(create_link(), "deleteok", 1), |
echo create_hidden_inputs(split_url_vars(link_replace(link_replace(create_link(), "deleteok", 1), "time", $time))); |
"time", $time) . ">\n"; |
|
echo "<table align=center>\n"; |
echo "<table align=center>\n"; |
echo "\t\n<tr>\n\t\t<td>Nick:</td><td><input type=text value=\"$nick\" readonly></td></tr>\n"; |
echo "\t\n<tr>\n\t\t<td>Your Nick:</td><td><input type=text value=\"$nick\" readonly></td></tr>\n"; |
echo "\t\n<tr>\n\t\t<td>Message No.:</td><td><input type=text value=\"$time\" readonly></td></tr>\n"; |
echo "\t\n<tr>\n\t\t<td>Message No.:</td><td><input type=text value=\"$time\" readonly></td></tr>\n"; |
echo "\t\n<tr>\n\t\t<td>Password:</td><td><input type=password name=pass></td></tr>\n"; |
echo "\t\n<tr>\n\t\t<td>Password:</td><td><input type=password name=pass></td></tr>\n"; |
echo "\t\n<tr>\n\t\t<td colspan=2 align=center><input type=submit name=submit_type value=Delete>\n</td></tr>\n"; |
echo "\t\n<tr>\n\t\t<td colspan=2 align=center><input type=submit name=submit_type value=Delete>\n</td></tr>\n"; |
Line 1002 Current time is <?echo format_time(time( |
|
Line 1035 Current time is <?echo format_time(time( |
|
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Create new user</font></b><br><br>"; |
echo "\n<center><font color=#C0C0C0 face=Courier size=4><b>Create new user</font></b><br><br>"; |
echo "<table size=90% align=center>\n"; |
echo "<table size=90% align=center>\n"; |
|
|
echo "\n<form name=createuser method=get action=$self?" . |
echo "\n<form name=createuser method=get action=$self>"; |
|
echo create_hidden_inputs(split_url_vars( |
link_replace(link_replace( |
link_replace(link_replace( |
create_link(), "createok", 1), "createuser", 1 |
create_link(), "createok", 1), "createuser", 1 |
) . |
))); |
">\n"; |
|
echo "\t<tr>\n\t\t<td>New Nick:</td><td><input type=text name=newnick maxsize=16 value=$newnick></td>\n"; |
echo "\t<tr>\n\t\t<td>New Nick:</td><td><input type=text name=newnick maxsize=16 value=$newnick></td>\n"; |
echo "\t<tr><td>E-mail:</td><td><input type=text name=mail value=$email></td>\n\t</tr>\n"; |
echo "\t<tr><td>E-mail:</td><td><input type=text name=mail value=$email></td>\n\t</tr>\n"; |
echo "\t<tr><td>Password:</td><td><input type=password name=pass></td>\n\t</tr>\n"; |
echo "\t<tr><td>Password:</td><td><input type=password name=pass></td>\n\t</tr>\n"; |
Line 1267 Current time is <?echo format_time(time( |
|
Line 1300 Current time is <?echo format_time(time( |
|
// CREATE NEW USER |
// CREATE NEW USER |
if ($createuser) { |
if ($createuser) { |
$mails = get_emails($user_file, $use_db, $db_handle); |
$mails = get_emails($user_file, $use_db, $db_handle); |
|
echo "1"; |
if ((!($mails === false)) && |
if ((!($mails === false)) && |
good($newnick) && |
good($newnick) && |
($mails[$newnick] == "") && |
($mails[$newnick] == "") && |
good($createok) && |
good($createok) && |
($createok == 1)) { |
($createok == 1)) { |
if (write_mail($user_file, $newnick, $mail, $pass, $use_db, $db_handle)) |
echo "1"; |
; // something failed, ignoring for now |
if (write_mail($user_file, $newnick, $mail, $pass, $use_db, $db_handle)) { |
|
echo "drblo to"; // something failed, ignoring for now |
|
die(); |
|
} |
|
|
header("HTTP/1.0 302 Found"); |
header("HTTP/1.0 302 Found"); |
header("Location: $abs_self?" . create_link()); |
header("Location: $abs_self?" . create_link()); |
Line 1294 Current time is <?echo format_time(time( |
|
Line 1331 Current time is <?echo format_time(time( |
|
$hist_file_prefix, $allowed_tags, $use_db, $db_handle)) |
$hist_file_prefix, $allowed_tags, $use_db, $db_handle)) |
; // something failed, ignoring for now |
; // something failed, ignoring for now |
|
|
$message = ""; |
$message = ''; |
header("HTTP/1.0 302 Found"); |
header('HTTP/1.0 302 Found'); |
header("Location: $abs_self?" . create_link()); |
header("Location: $abs_self?" . create_link()); |
die(); |
die(); |
} |
} |
Line 1321 Current time is <?echo format_time(time( |
|
Line 1358 Current time is <?echo format_time(time( |
|
echo "<center>Fatal Error while deleting: unknown error code!</center><br>\n"; |
echo "<center>Fatal Error while deleting: unknown error code!</center><br>\n"; |
break; |
break; |
} |
} |
die(); |
//die(); |
header("HTTP/1.0 302 Found"); |
header('HTTP/1.0 302 Found'); |
header("Location: $abs_self?" . create_link()); |
header("Location: $abs_self?" . create_link()); |
die(); |
die(); |
} else { |
} else { |
Line 1340 Current time is <?echo format_time(time( |
|
Line 1377 Current time is <?echo format_time(time( |
|
<html> |
<html> |
<head> |
<head> |
<title><?echo "$WB_name v$WB_version"?></title> |
<title><?echo "$WB_name v$WB_version"?></title> |
|
<link rel="stylesheet" href="<?echo $css_file?>" type="text/css"> |
<? |
<? |
/* |
/* |
If set, do nothing, just create frames and recursively call self |
If set, do nothing, just create frames and recursively call self |