[php]代码库
<?php //-*- C++ -*-
/* ******************************************************************** **
** Copyright (C) 1995-2000 Michael Oertel **
** Copyright (C) 2000- PHPOpenChat Development Team **
** http://www.ortelius.de/phpopenchat/ **
** **
** This program is free software. You can redistribute it and/or modify **
** it under the terms of the PHPOpenChat License Version 1.0 **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY, without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **
** **
** You should have received a copy of the PHPOpenChat License **
** along with this program. **
** ******************************************************************** */
if (!$update && !$clear_txt && !$aendern) {
echo "
<html>
<head><title>$CHAT_SETUP</title></head><BODY BGCOLOR=\"#FFFFFF\" BACKGROUND=\"\">
<CENTER><A HREF=\"$INSTALL_DIR/\" onMouseOver=\"window.status='$BACK_TO_CHAT'; return true\">$BACK_TO_CHAT</a>
</CENTER>
";
}
include("defaults.inc");
/*
* Open a database connection
* The following include returns a database handle
*/
include("connect_db.inc");
$db_handle = connect_db($DATABASEHOST, $DATABASEUSER, $DATABASEPASSWD);
if (!$db_handle) {
exit; //the error message is printed in connect_db.inc
}
switch ($task) {
case "sprueche":
if ($update) {
$Tabellenfelder = mysql_Listfields($DATABASENAME, "chat_messages");
$i = 0;
while ($i < 10) {
$aktuellesFeld = mysql_FieldName($Tabellenfelder, $i);
$result = mysql_query("UPDATE chat_messages SET $aktuellesFeld='${$aktuellesFeld}'", $db_handle);
$i++;
}
}
echo "<H1 ALIGN=\"CENTER\">$AUTOMATIC_HINTS</H1>";
echo "<FORM ACTION=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\" METHOD=\"POST\">";
$message_result = mysql_query("SELECT * FROM chat_messages", $db_handle);
$i = 0;
while ($i < 10) {
$feld = "Message_$i";
echo "<INPUT NAME=\"Message_$i\" TYPE=\"text\" SIZE=\"70\" VALUE=\"";
echo mysql_result($message_result, 0, $feld);
echo "\"><BR>\n";
$i++;
}
echo "<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"sprueche\">";
echo "<INPUT TYPE=\"submit\" NAME=\"update\" VALUE=\"$SAVE_HINTS\">";
echo "</FORM>\n<BR>";
echo "<P><A HREF=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\">$CHAT_SETUP</A><P>";
break;
case "channels":
//workaround
$PASSWORD = $passwd;
$Tabellenfelder = mysql_Listfields($DATABASENAME, "channels", mysql_connect($DATABASEHOST, $DATABASEUSER, $DATABASEPASSWD));
$num2 = mysql_num_fields($Tabellenfelder);
if ($aendern) {
if ($insert) {
$update = mysql($DATABASENAME, "INSERT INTO channels (Id,zeile_0) VALUES(0,'<!-- ||0|-->')");
$Id = mysql_insert_id();
}
if ($clear_txt) {
$update = mysql($DATABASENAME, "UPDATE channels SET zeile_0='',zeile_39='',zeile_38='',zeile_37='',zeile_36='',zeile_35='',zeile_34='',zeile_33='',zeile_32='',zeile_31='',zeile_30='',zeile_29='',zeile_28='',zeile_27='',zeile_26='',zeile_25='',zeile_24='',zeile_23='',zeile_22='',zeile_21='',zeile_20='',zeile_19='',zeile_18='',zeile_17='',zeile_16='',zeile_15='',zeile_14='',zeile_13='',zeile_12='',zeile_11='',zeile_10='',zeile_9='',zeile_8='',zeile_7='',zeile_6='',zeile_5='',zeile_4='',zeile_3='',zeile_2='',zeile_1='',zeile=0 WHERE Id=$Id");
}
if ($loesche) {
$update = mysql($DATABASENAME, "DELETE FROM channels WHERE Id=$Id");
}
if ($update) {
$x = 0;
while ($num2 > $x) {
$aktuellesFeld = mysql_FieldName($Tabellenfelder, $x);
if (substr($aktuellesFeld, 0, 5) != "zeile" && substr($aktuellesFeld, 0, 5) != "Allow" && substr($aktuellesFeld, 0, 5) != "User_") {
if ($aktuellesFeld != "") {
if ((mysql_FieldType($Tabellenfelder, $x) != "string") && (mysql_FieldType($Tabellenfelder, $x) != "blob") && (mysql_FieldType($Tabellenfelder, $x) != "char") && (mysql_FieldType($Tabellenfelder, $x) != "text") && (mysql_FieldType($Tabellenfelder, $x) != "date") && (mysql_FieldType($Tabellenfelder, $x) != "datetime")) {
$update = mysql($DATABASENAME, "UPDATE channels SET $aktuellesFeld=" . ${$aktuellesFeld} . " WHERE Id=$Id");
} else {
$update = mysql($DATABASENAME, "UPDATE channels SET $aktuellesFeld='" . ${$aktuellesFeld} . "' WHERE Id=$Id");
}
}
}
$x++;
}
if (!$loesche) {
header("Status: 301");
header("Location: $INSTALL_DIR/admin/admin.$FILE_EXTENSION?id=$Id&task=$task&aendern=1");
}
}
$result = mysql_query("SELECT Name,Id FROM channels where User_Channel=0 ORDER BY Id", $db_handle);
$num1 = mysql_num_rows($result);
$j = 0;
if (!isset($id)) {
while ($num1 > $j) {
$name = mysql_result($result, $j, Name);
$id = mysql_result($result, $j, Id);
echo "<a href=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION?id=$id&task=channels&aendern=1\">$name</a>";
echo "<BR>";
$j++;
}
} else {
$result = mysql_query("SELECT * from channels where Id=$id", $db_handle);
echo "\n<TABLE border=1><FORM ACTION=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\" METHOD=\"POST\">\n";
echo "<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">\n";
echo "<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"channels\">\n";
echo "<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">\n";
$i = 0;
$num = mysql_num_fields($result);
while ($num > $i) {
$feldname = mysql_FieldName($Tabellenfelder, $i);
if (substr($feldname, 0, 5) != "zeile" && substr($feldname, 0, 5) != "Allow" && substr($feldname, 0, 5) != "User_") {
echo "<TR><TH>" . $TBL_FIELDS[$feldname] . "<TD><INPUT TYPE=\"";
if ($feldname != "Id") {
echo "text";
} else {
echo "hidden";
}
echo "\" NAME=\"";
//workaround
if ($feldname == "PASSWORD") {
echo "passwd";
} else {
echo $feldname;
}
echo "\" VALUE=\"";
echo htmlspecialchars(mysql_result($result, 0, $feldname));
echo "\">\n";
if ($feldname == "stops_at") {
echo " max value is [2037-12-31 23:59:59]";
}
}
$i++;
}
}
echo "<TR><TD BGCOLOR=\"#FF0000\">";
if ($num1 > 1) {
echo "<INPUT TYPE=\"submit\" NAME=\"loesche\" VALUE=\"Löschen\">";
}
echo "<TD BGCOLOR=\"#DDDDDD\"><INPUT TYPE=\"submit\" NAME=\"update\" VALUE=\"$SAVE\"> ";
echo "<INPUT TYPE=\"submit\" NAME=\"clear_txt\" VALUE=\"$CLEAR_LINES\">";
echo "</FORM></TABLE><HR>\n";
echo " <A HREF=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION?Aufgabe=chat&insert=1&task=channels&aendern=1\" onMouseover=\"window.status='$CREATE_CHANNEL'; return true\">$CREATE_CHANNEL</a></H2>";
}
echo "<P><A HREF=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\">$CHAT_SETUP</A><P>";
break;
case "paten":
if ($add && $Nick_to_add) {
$result = mysql_query("INSERT INTO paten VALUES('$Nick_to_add')", $db_handle);
}
if ($del && $paten) {
$result = mysql_query("DELETE FROM paten WHERE Nick='$paten'", $db_handle);
}
$result = mysql_query("SELECT * FROM paten", $db_handle);
echo "\n<TABLE BORDER=1 ALIGN=\"CENTER\"><FORM>";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"paten\">";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">";
echo "\n<TR BGCOLOR=#999999><TH>$MODERATORS<TH>$ADD_REMOVE";
echo "\n<TR><TD rowspan=2><SELECT NAME=\"paten\" SIZE=10>";
while ($row = mysql_fetch_object($result)) {
echo "\n\t<OPTION VALUE=\"", $row->Nick, "\">", $row->Nick;
}
echo "\n</SELECT>";
echo "\n<TD><INPUT NAME=\"add\" TYPE=\"submit\" VALUE=\"?---\"><INPUT NAME=\"Nick_to_add\" TYPE=\"text\" MAXLENGTH=15 SIZE=15>";
echo "\n<TR><TD><INPUT NAME=\"del\" TYPE=\"submit\" VALUE=\"--- 籠"><IMG SRC=\"$INSTALL_DIR/images/trash.gif\" ALIGN=\"middle\">";
echo "\n</FORM></TABLE>";
echo "<P><A HREF=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\">$CHAT_SETUP</A><P>";
break;
case "comod":
if ($add && $Nick_to_add) {
$result = mysql_query("INSERT INTO comoderators VALUES('$Nick_to_add')", $db_handle);
}
if ($del && $como) {
$result = mysql_query("DELETE FROM comoderators WHERE Nick='$como'", $db_handle);
}
$result = mysql_query("SELECT * FROM comoderators", $db_handle);
echo "\n<TABLE BORDER=1 ALIGN=\"CENTER\"><FORM>";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"comod\">";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">";
echo "\n<TR BGCOLOR=#999999><TH>$COMODERATORS<TH>$ADD_REMOVE";
echo "\n<TR><TD rowspan=2><SELECT NAME=\"como\" SIZE=10>";
while ($row = mysql_fetch_object($result)) {
echo "\n\t<OPTION VALUE=\"", $row->Nick, "\">", $row->Nick;
}
echo "\n</SELECT>";
echo "\n<TD><INPUT NAME=\"add\" TYPE=\"submit\" VALUE=\"?---\"><INPUT NAME=\"Nick_to_add\" TYPE=\"text\" MAXLENGTH=15 SIZE=15>";
echo "\n<TR><TD><INPUT NAME=\"del\" TYPE=\"submit\" VALUE=\"--- 籠"><IMG SRC=\"$INSTALL_DIR/images/trash.gif\" ALIGN=\"middle\">";
echo "\n</FORM></TABLE>";
echo "<P><A HREF=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\">$CHAT_SETUP</A><P>";
break;
case "vip":
if ($add && $Nick_to_add) {
$result = mysql_query("INSERT INTO vip VALUES('$Nick_to_add','$Responsible_to_add','$Channel')", $db_handle);
}
if ($del && $vip) {
$result = mysql_query("DELETE FROM vip WHERE Nick='$vip'", $db_handle);
}
$result = mysql_query("SELECT * FROM vip", $db_handle);
echo "\n<TABLE BORDER=1 ALIGN=\"CENTER\"><FORM>";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"vip\">";
echo "\n<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">";
echo "\n<TR BGCOLOR=#999999><TH>$VIPS<TH>$ADD_REMOVE";
echo "\n<TR><TD rowspan=2><SELECT NAME=\"vip\" SIZE=10>";
while ($row = mysql_fetch_object($result)) {
echo "\n\t <OPTION VALUE=\"", $row->Nick, "\">$VIP: '", $row->Nick;
echo "' Channel: '", $row->Channel, "' $MODERATOR: '", $row->Moderator, "'";
}
echo "\n</SELECT>";
echo "\n<TD><INPUT NAME=\"add\" TYPE=\"submit\" VALUE=\"?---\">$VIP:<INPUT NAME=\"Nick_to_add\" TYPE=\"text\" MAXLENGTH=15 SIZE=15> Channel: <INPUT NAME=\"Channel\" TYPE=\"text\" MAXLENGTH=20 SIZE=20> $MODERATOR: <INPUT NAME=\"Responsible_to_add\" TYPE=\"text\" MAXLENGTH=15 SIZE=15>";
echo "\n<TR><TD><INPUT NAME=\"del\" TYPE=\"submit\" VALUE=\"--- 籠"><IMG SRC=\"$INSTALL_DIR/images/trash.gif\" ALIGN=\"middle\">";
echo "\n</FORM></TABLE>";
echo "<P><A HREF=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\">$CHAT_SETUP</A><P>";
break;
default:
echo "<TR>
<TH VALIGN=\"middle\" BGCOLOR=\"B0B0B0\" align=\"center\"><STRONG>$CHAT_SETUP</STRONG></TH></TR>
<TR><TD ALIGN=\"center\" VALIGN=\"middle\" BGCOLOR=\"#66B886\">
<FORM ACTION=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\" METHOD=\"POST\">
<INPUT TYPE=\"submit\" VALUE=\"$AUTOMATIC_HINTS\">
<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">
<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"sprueche\">
<INPUT TYPE=\"hidden\" NAME=\"Messages\" VALUE=\"1\">
</FORM></TR>
<TR><TD ALIGN=\"center\" VALIGN=\"middle\" BGCOLOR=\"#66B886\">
<FORM ACTION=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\" METHOD=\"POST\">
<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">
<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"channels\">
<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">
<INPUT TYPE=\"submit\" VALUE=\" $SETUP_CHANNELS \">
</FORM></TR>
<TR><TD ALIGN=\"center\" VALIGN=\"middle\" BGCOLOR=\"#66B886\">
<FORM ACTION=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\" METHOD=\"POST\">
<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">
<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"paten\">
<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">
<INPUT TYPE=\"submit\" VALUE=\" $SETUP_MODERATORS \">
</FORM></TR>
<TR><TD ALIGN=\"center\" VALIGN=\"middle\" BGCOLOR=\"#66B886\">
<FORM ACTION=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\" METHOD=\"POST\">
<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">
<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"comod\">
<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">
<INPUT TYPE=\"submit\" VALUE=\" $SETUP_COMODERATORS \">
</FORM></TR>
<FORM ACTION=\"$INSTALL_DIR/admin/admin.$FILE_EXTENSION\" METHOD=\"POST\">
<INPUT TYPE=\"hidden\" NAME=\"Aufgabe\" VALUE=\"chat\">
<INPUT TYPE=\"hidden\" NAME=\"task\" VALUE=\"vip\">
<INPUT TYPE=\"hidden\" NAME=\"aendern\" VALUE=\"1\">
<INPUT TYPE=\"submit\" VALUE=\" $SETUP_VIPS \">
</FORM></TR>
<TR>";
break;
} //end switch
?>
<!-- Created: Wed Jul 30 17:08:03 MET DST 1997 -->
<!-- hhmts start -->
Last modified: Mon May 29 10:41:16 MET DST 2000
<!-- hhmts end -->
</body>
</html>
[源代码打包下载]