Hi,
habe den Tabellenname mailkontakt durch con_smgmailkontakt ergänzt. Sowohl im Install-Skript als auch in den Modulen. Hier die Datei:
Eingabe:
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : Mailkontakt
* Author : agon
* Copyright : Contenido - four for business
* Created : 05-11-2003
* Modified : 05-11-2003
* Modified again : Feb. 17th 2004 by Lars D. Forseth <
lars@forseth.de>
************************************************/
$db = new DB_contenido;
$db->query("LOCK TABLES con_smgmailkontakt WRITE"); // LOCK TABLES
/* FILTER GIVEN DATA */
if (!(eregi("([0-9]{1,11})",$mailkontaktid))) $mailkontaktid = 0;
$mailkontakt_name = str_replace (";","",$mailkontakt_name);
$mailkontakt_name = str_replace ("--","",$mailkontakt_name);
$mailkontakt_name = str_replace ("'","",$mailkontakt_name);
$mailkontakt_name = str_replace ("\"","",$mailkontakt_name);
$mailkontakt_name = htmlentities($mailkontakt_name);
$new_mailkontakt_name = str_replace (";","",$new_mailkontakt_name);
$new_mailkontakt_name = str_replace ("--","",$new_mailkontakt_name);
$new_mailkontakt_name = str_replace ("'","",$new_mailkontakt_name);
$new_mailkontakt_name = str_replace ("\"","",$new_mailkontakt_name);
$new_mailkontakt_name = htmlentities($new_mailkontakt_name);
$mailkontakt_email = str_replace (";","",$mailkontakt_email);
$mailkontakt_email = str_replace ("--","",$mailkontakt_email);
$mailkontakt_email = str_replace ("'","",$mailkontakt_email);
$mailkontakt_email = str_replace ("\"","",$mailkontakt_email);
$mailkontakt_email = htmlentities($mailkontakt_email);
$new_mailkontakt_email = str_replace (";","",$new_mailkontakt_email);
$new_mailkontakt_email = str_replace ("--","",$new_mailkontakt_email);
$new_mailkontakt_email = str_replace ("'","",$new_mailkontakt_email);
$new_mailkontakt_email = str_replace ("\"","",$new_mailkontakt_email);
$new_mailkontakt_email = htmlentities($new_mailkontakt_email);
if (($mailkontakt_sil!="Y") and ($mailkontakt_sil!="N")) $mailkontakt_sil!="N";
if (($mailkontakt_spd!="Y") and ($mailkontakt_spd!="N")) $mailkontakt_spd!="N";
if (($new_mailkontakt_sil!="Y") and ($new_mailkontakt_sil!="N")) $new_mailkontakt_sil!="N";
if (($new_mailkontakt_spd!="Y") and ($new_mailkontakt_spd!="N")) $new_mailkontakt_spd!="N";
if (($mailkontaktid>0) and $mailkontakt_name and $mailkontakt_email
and $mailkontakt_sil and $mailkontakt_spd and ($do=="edit")) {
if ($save=="yes") {
$sql = "UPDATE con_smgmailkontakt SET mailkontakt_name=\"$mailkontakt_name\", ".
"mailkontakt_email=\"$mailkontakt_email\", mailkontakt_sil=\"$mailkontakt_sil\", ".
"mailkontakt_spd=\"$mailkontakt_spd\" WHERE mailkontaktid=$mailkontaktid";
} // end if
if ($del_user=="yes") {
$sql = "DELETE FROM con_smgmailkontakt WHERE mailkontaktid=$mailkontaktid";
$view_mailkontaktid = 0;
} // end if
$db->query($sql);
} // end if
if ($new_mailkontakt_name and $new_mailkontakt_email and $new_mailkontakt_sil
and $new_mailkontakt_spd and ($do=="new")) {
$sql = "INSERT INTO con_smgmailkontakt VALUES('', \"$new_mailkontakt_name\", ".
"\"$new_mailkontakt_email\", \"$new_mailkontakt_sil\", \"$new_mailkontakt_spd\")";
$db->query($sql);
$view_mailkontaktid = 0;
} // end if
$sql = "SELECT * FROM con_smgmailkontakt ORDER BY mailkontaktid";
$db->query($sql);
$db->next_record();
$nr = $db->num_rows();
if (($nr>=1) and ($view_mailkontaktid<1)) {
$view_mailkontaktid = $db->f("mailkontaktid");
} // end if
if ($nr < 1) $display = " display:none;";
echo "
<!-- start Mailkontakt-backend -->
<table width=\"600\" cellspacing=\"0\" cellpadding=\"3\" border=\"0\" style=\"font-size: 10pt;\">
<tr valign=\"top\">
<td>
<input type=\"radio\" name=\"do\" value=\"edit\">
<b>Bereits vorhandenen Empfänger einsehen und dann evtl. bearbeiten oder löschen:</b>
</td>
</tr>
<tr>
<td align=\"center\">
<select name=\"view_mailkontaktid\" style=\"width: 400px;\">";
for ($i=0; $i<$nr; $i++) {
if (($db->f("mailkontaktid")) == $view_mailkontaktid) {
$mailkontakt_name = $db->f("mailkontakt_name");
$mailkontakt_email = $db->f("mailkontakt_email");
$mailkontakt_sil = $db->f("mailkontakt_sil");
$mailkontakt_spd = $db->f("mailkontakt_spd");
$a = " selected";
} else {$a = "";}
echo "
<option value=\"".($db->f("mailkontaktid"))."\"".$a."> ".($db->f("mailkontakt_name")).
" <".($db->f("mailkontakt_email"))."> ";
$db->next_record();
} // end for
echo "
</select>
</td>
</tr>
<tr><td> </td></tr>
<tr><td align\"center\">
<table align=\"center\" width=\"600\" border=\"0\" cellpsacing=\"0\" cellpadding=\"0\"
style=\"font-size: 10pt; border: 1px;border-color: #000000;
border-style: solid; background-color: #EFEFEF;".$display."\">
<tr>
<td width=\"20\"><b>ID</b></td>
<td width=\"245\"><b>Empfänger-Name</b></td>
<td width=\"245\"><b>Empfänger-Email</b></td>
<td width=\"45\"><b>sil</b></td>
<td width=\"45\"><b>spd</b></td>
</tr>";
echo "
<tr>
<td>
<input type=\"hidden\" name=\"mailkontaktid\" value=\"".$view_mailkontaktid."\">".$view_mailkontaktid."
</td>
<td><input type=\"\" name=\"mailkontakt_name\" value=\"".$mailkontakt_name."\" size=\"32\"></td>
<td><input type=\"\" name=\"mailkontakt_email\" value=\"".$mailkontakt_email."\" size=\"32\"></td>
<td align=\"center\">
<select name=\"mailkontakt_sil\">
<option value=\"Y\"";
if ($mailkontakt_sil == "Y") echo " selected";
echo ">Y
<option value=\"N\"";
if ($mailkontakt_sil == "N") echo " selected";
echo ">N
</select>
</td>
<td align=\"center\">
<select name=\"mailkontakt_spd\">
<option value=\"Y\"";
if ($mailkontakt_spd == "Y") echo " selected";
echo ">Y
<option value=\"N\"";
if ($mailkontakt_spd == "N") echo " selected";
echo ">N
</select>
</td>
</tr>";
echo "
<tr><td colspan=\"5\"> </td></tr>
<tr>
<td> </td>
<td align=\"left\">
<input type=\"checkbox\" name=\"del_user\" value=\"yes\">
!* Empfänger löschen *!
</td>
<td colspan=\"3\" align=\"right\">
<input type=\"checkbox\" name=\"save\" value=\"yes\">
Änderungen übernehmen.
</td>
</tr>
<tr><td colspan=\"5\"> </td></tr>
</table>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr valign=\"top\">
<td>
<input type=\"radio\" name=\"do\" value=\"new\">
<b>Einen neuen Empfänger anlegen:</b>
</td>
</tr>
";
echo "
<tr><td align\"center\">
<table align=\"center\" width=\"600\" border=\"0\" cellpsacing=\"0\" cellpadding=\"0\"
style=\"font-size: 10pt; border: 1px;border-color: #000000;
border-style: solid; background-color: #EFEFEF;\">
<tr>
<td width=\"20\"><b>ID</b></td>
<td width=\"245\"><b>Empfänger-Name</b></td>
<td width=\"245\"><b>Empfänger-Email</b></td>
<td width=\"45\"><b>sil</b></td>
<td width=\"45\"><b>spd</b></td>
</tr>";
echo "
<tr>
<td>N</td>
<td><input type=\"\" name=\"new_mailkontakt_name\" size=\"32\"></td>
<td><input type=\"\" name=\"new_mailkontakt_email\" size=\"32\"></td>
<td align=\"center\">
<select name=\"new_mailkontakt_sil\">
<option value=\"Y\">Y
<option value=\"N\">N
</select>
</td>
<td align=\"center\">
<select name=\"new_mailkontakt_spd\">
<option value=\"Y\">Y
<option value=\"N\">N
</select>
</td>
</tr>";
echo "
<tr><td colspan=\"5\"> </td></tr>
</table>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>";
echo "
<tr valign=\"top\">
<td><pre>
<b><u>
Legende:</u></b><br>
» sil = \"show in list\",
bedeutet dass der Empfänger in dem Drop-Down-Menü für den Endnutzer erscheint.
Mögliche Werte sind \"Y\" für \"YES\" und \"N\" für \"NO\".<br>
» spd = \"send per default\",
bedeutet dass diesem Empfänger auf jeden Fall eine Kopie der Email zugeht,
falls er nicht in der Drop-Down-Liste angezeigt wird.
Die möglichen Werte entsprechen denen von \"sil\".<br>
</pre></td>
</tr>
</table>
<!-- end Mailkontakt-backend -->
";
$db->query("UNLOCK TABLES"); // UNLOCK TABLES
Ausgabe:
<?php
/*******************************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Mailkontakt
* Author : agon
* Copyright : Contenido - four for business
* Created : 05-11-2003
* Modified again : Feb. 17th 2004 by Lars D. Forseth <
lars@forseth.de>
********************************************************/
echo "
<!-- start Mailkontakt output -->
";
$db = new DB_Contenido;
/* data was given */
if (($mail == "yes") and (strlen($from_name)>1) and
(strlen($from_mail)>5) and (strlen($mailkontaktid)>0) and (strlen($comment)>2)) {
// if invalid mailkontaktid given
if (!(eregi("([0-9]{1,11})",$mailkontaktid))) {
$error = "
<!-- error: invalid mailkontaktid given -->
<br><br><br>
<center><font color=\"darkred\"><b>
Diesen Empfänger gibt es nicht (mehr)!
<br>
Versuch' es später bitte nochmal.
</b></font></center>
<br><br><br>
";
break;
} // end if invalid mailkontaktid given
$sql = "SELECT * FROM con_smgmailkontakt WHERE mailkontaktid=$mailkontaktid ".
"OR mailkontakt_spd=\"Y\" ORDER BY mailkontaktid";
$db->query($sql);
$db->next_record();
$nr = $db->num_rows();
$mailto = "";
$spd = "";
$mailkontakt_name = "";
$header="From:".$from_name."<".$from_mail.">";
// no data in DB
if ($nr < 1) {
$error = "
<!-- error: no data in DB -->
<br><br><br>
<center><font color=\"darkred\"><b>
Diesen Empfänger gibt es nicht (mehr)!
<br>
Versuch' es später bitte nochmal.
</b></font></center>
<br><br><br>
";
break;
} // end no data in DB
// get recipients from DB
for ($i=0; $i<$nr; $i++) {
if ($mailkontaktid == ($db->f("mailkontaktid"))) {
$mailto = ($db->f("mailkontakt_email"));
$mailkontakt_name = $db->f("mailkontakt_name");
} // end if
if (!($mailkontaktid == ($db->f("mailkontaktid"))) and (($db->f("mailkontakt_spd"))=="Y")) {
$spd .= ",".($db->f("mailkontakt_email"));
} // end if
$db->next_record();
} // end "get recipients from DB"
if (strlen($mailto) < 5) {
$tmp = explode(",",$spd,2);
$mailto = $tmp[1];
} else {$mailto .= $spd;}
// check if email-adress from user is correct
$length = (int) (strlen($from_mail));
if ($length > 100 or $length < 5) {$length_err = 1;}
else {$length_err = 0;}
$valid = (eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]+$",$from_mail));
if (strlen($error)>3) {echo $error;}
else { // no error occured
if (!($valid==1) or ($length_err==1)) {
$links = explode('?',$PHP_SELF);
$link = $links[0];
$link = $link."?idcat=".$idcat; // back-link
echo "
<br><br><br>
<font color=\"red\"><b>
<u>ACHTUNG:</u><br>
Die angegebene Email-Adresse ist ungültig!<br>
Bitte überprüfen...<br><br>
<center>
<form action=\"$link\" method=\"post\">
<input type=\"hidden\" name=\"mailkontaktid\" value=\"$mailkontaktid\">
<input type=\"hidden\" name=\"from_name\" value=\"$from_name\">
<input type=\"hidden\" name=\"from_mail\" value=\"$from_mail\">
<input type=\"hidden\" name=\"comment\" value=\"$comment\">
<input type=\"submit\" value=\"« zurück\">
</form>
</center>
</b></font>
<br><br>";
} // end check user email-address
else {
/* for security reasons in case of spam and the kind */
$now = date("l dS of F Y \@ G:i:s"); // Example: Wednesday 15th of January 2004 15:51:38
$ip = getenv("REMOTE_ADDR");
$comment .= "\n\n\n\nDieses Mail wurde mit der IP-address ".$ip." am ".$now." gesendet".".\n";
/* finally mail message */
mail($mailto,"Kontaktanfrage aus dem Internet",$comment,$header);
// give confirmation to user:
if (strlen($mailkontakt_name) < 1) $mailkontakt_name = "uns";
echo "
<br><br><br><br>
<font color=\"red\"><i>Folgende Nachricht wurde eben an <b>".$mailkontakt_name."</b> gesendet:</i></font>
<br><br><br>
<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">
<tr>
<td class=\"text\"><b>Absender:</b></td>
<td> </td>
<td width=\"90%\" class=\"text\">";
echo $from_name." <".$from_mail.">";
echo "</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class=\"text\"><b>Empfänger:</b></td>
<td> </td>
<td width=\"90%\" class=\"text\">".$mailkontakt_name."</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr valign=\"top\">
<td class=\"text\"><b>Nachricht:</b></td>
<td> </td>
<td class=\"text\">".nl2br($comment)."</td>
</tr>
</table>
<br><br><br>";
} // end else ("user's email-addres is ok")
} // end else ("no error occured")
} // end "data was given"
/* no data was given (yet), so give back form */
else {
$sql = "SELECT * FROM con_smgmailkontakt WHERE mailkontakt_sil=\"Y\" LIMIT 1";
$db->query($sql);
$db->next_record();
$nr = $db->num_rows();
if ($nr > 0) $show_list = "yes";
$sql = "SELECT * FROM con_smgmailkontakt ORDER BY mailkontakt_name";
$db->query($sql);
$db->next_record();
$nr = $db->num_rows();
/* there are recipients in DB */
if ($nr > 0) {
echo "<br><br><br>";
// not all fields were filled during last submission!
if ($mail == "yes") {
echo "
<font class=\"text\"><font color=\"red\">
<u>ACHTUNG:</u> <i>Bitte alle Felder <b>korrekt</b> ausfüllen!</i>
</font></font><br><br>";
} // end if "not all fields filled"
echo "
<form name=\"mail\" action=\"".$auth->url()."\" method=\"post\" class=\"text\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
";
/* if there are any recipients with sil=="Y" */
if ($show_list == "yes") {
echo"
<tr>
<td valign=\"middle\" class=\"text\">Empfänger:</td>
<td> </td>";
echo "
<td>
<select name=\"mailkontaktid\" style=\"width: 251px;\">";
for($x=0; $x<$nr; $x++){
echo "
<option value=\"".($db->f("mailkontaktid"))."\"";
if (($db->f("mailkontaktid")) == $mailkontaktid) echo " selected";
echo ">".($db->f("mailkontakt_name"));
$db->next_record();
} // end for
echo "
</select>
</td>
";
// end drop-down-menu
echo "
<td> </td>
</tr>";
} // end if($show_list == "yes")
else {echo "<tr><td colspan=\"4\"><input type=\"hidden\" name=\"mailkontaktid\" value=\"0\"</td></tr>";}
echo "
<tr>
<td class=\"text\" valign=\"middle\">Name:</td>
<td> </td>
<td><input type=\"text\" name=\"from_name\" size=\"38\" value=\"".$from_name."\" maxlength=\"100\"></td>
<td> </td>
</tr>
<tr>
<td class=\"text\" valign=\"middle\">Email:</td>
<td> </td>
<td><input type=\"text\" name=\"from_mail\" size=\"38\" value=\"".$from_mail."\" maxlength=\"100\"></td>
<td> </td>
</tr>
<tr>
<td class=\"text\" valign=\"middle\">Nachricht:</td>
<td> </td>
<td>
<text"."area cols=\"45\" rows=\"10\" name=\"comment\" style=\"width:250px\" wrap=\"physical\">".
$comment.
"</text"."area></td>
<td> </td>
</tr>
<tr>
<td colspan=\"4\" align=\"center\">
<br>
<input type=\"hidden\" name=\"mail\" value=\"yes\">
<input type=\"submit\" value=\"Mail senden »\">
</td>
</tr>
</table>
</fo"; echo "rm>
<br><br>";
} // end "there are recipients in DB"
/* there are no recipients in DB */
else {
echo "
<br><br><br>
<center><font color=\"darkred\"><b>
Momentan sind leider keine Empfänger in der Datenbank eingetragen,
bitte versuch' es später nocheinmal.
</b></font></center>
<br><br><br>
";
} // end "there are no recipients in DB"
} // end "no data was given (yet)"
echo "
<!-- end Mailkontakt output -->
";
?>
Wenn ich nur einen User angelegt habe, dann kann ich diesen mit sil N ausblenden. Ab zwei werden alle angezeigt.
THX
Stephan